usb/173182: usbus appears as a network device

2012-10-29 Thread Rick Richard

>Number: 173182
>Category:   usb
>Synopsis:   usbus appears as a network device
>Confidential:   no
>Severity:   non-critical
>Priority:   low
>Responsible:freebsd-usb
>State:  open
>Quarter:
>Keywords:   
>Date-Required:
>Class:  sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 29 08:10:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Rick Richard
>Release:9.0-RELEASE
>Organization:
>Environment:
FreeBSD thinking2 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 
UTC 2012 r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  
amd64
>Description:
A change, apparently in later FBSD 8.x and in FBSD 9.x, causes usbus[0-n] 
devices to appear as network devices.  They do not show up in ifconfig -a but 
the do show up in netstat -i.

This causes a slowdown and errors at startup when both ifconfig_DEFAULT="DHCP" 
and synchronous_dhclient="YES" are set in rc.conf:

usbus0: not found
exiting.
Starting Network: usbus0.
usbus1: not found
exiting.
Starting Network: usbus1.

etc.

This has been mentioned in various places:
http://lists.freebsd.org/pipermail/freebsd-current/2011-October/028752.html

http://freebsd.1045724.n5.nabble.com/stable-9-usbus-entries-in-network-namespace-td5615804.html

http://permalink.gmane.org/gmane.os.freebsd.current/129625

http://freebsd.1045724.n5.nabble.com/Prevent-starting-network-on-usbus-td5142292.html

etc.
>How-To-Repeat:
edit /etc/rc.conf and add
ifconfig_DEFAULT="DHCP"
synchronous_dhclient="YES"

restart and observe errors at startup or manually produce the problem by 
executing
/etc/rc.d/netif start usbus0
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Current problem reports assigned to freebsd-usb@FreeBSD.org

2012-10-29 Thread FreeBSD bugmaster
Note: to view an individual PR, use:
  http://www.freebsd.org/cgi/query-pr.cgi?pr=(number).

The following is a listing of current problems submitted by FreeBSD users.
These represent problem reports covering all versions including
experimental development code and obsolete releases.


S Tracker  Resp.  Description

o usb/173182   usbusbus appears as a network device
o usb/172937   usbFreeBSD 9.1-RC2 usb3 port disconnects
o usb/172633   usbSony Cybershot not recognized as USB mem stick
o usb/172199   usbhigh interrupts load xhci
o usb/171810   usb[patch] make hid_start_parse(3) respect report ID argu
o usb/171354   usb[umass] Medium not present error on flash drive [regre
o usb/171262   usbplug in sdhc via usb reader reboots machine
o usb/171197   usbADATA Classic CH11 USB HDD doesn't work in FreeBSD 9.1
o usb/170699   usbFreeBSD 9.0 Doesn't list HDD or its partitions in part
o usb/170688   usbpatch][usbdevs][wlan] Patch for ASUS Black Diamond USB
o usb/170606   usbr239222 kernel panic at boot - usb locking issue
o usb/170358   usb[ums] Wrong (duplicate) button numbers
o usb/170123   usb[umass] HP v210w USB stick not supported
o usb/169935   usb[keyboard] Unable use USB keyboard while panic
o usb/169789   usb[u3g] [patch] add support for huawei e3131
o usb/169461   usb[ugen] USB2 high-speed device detected as full speed
o usb/169428   usb[ugen] ugen not detecting all endpoints on device [reg
o usb/168551   usb[umass] Issues with embedded card reader (Laptop ASUS 
o usb/168132   usb[umass] MATSHITA memory card size reported wrong, moun
o usb/167847   usb[ural] dlink dwl-122g e crashes(?) when trying wap2 cr
o usb/167001   usb[USB] [PATCH] add support for Smart G2 64MB memory key
o usb/165815   usb[usbdevs] [patch] add k3772z 3g modem support
o usb/165163   usb[keyboard] The USB RF keyboard and mouse become non-re
o usb/164058   usb[umass] Lexar 8GB USB flash drive doesn't work by defa
f usb/163328   usb[usb] Support for Atheros USB abgn devices
o kern/163091  usb[panic] Fatal trap 12: page fault while in kernel mode
f usb/162306   usbusb devices cant get address asignation, no memories, 
o usb/162054   usbusbdump just hangs on 9.0-RC1
f usb/161793   usbpoor EHCI usb2 i/o performance
o usb/160436   usbucom wedges machine on parity error ?
o usb/160299   usbMicroSDHC-to-USB adapters do not work in FreeBSD 8.x
o usb/160192   usb[install] Installation from USB-Stick doesn't find the
o usb/159274   usbUSB 3.0 Etron EJ168A does not work.
f usb/159191   usb[fusefs-ntfs] write on fusefs-ntfs mounted partition r
o usb/157376   usbLaCie USB disk not recognized
o usb/157074   usb[boot] [usb8] vfs_mountroot_ask is called when no usb 
o usb/156898   usb[keyboard] usb keyboard does not work while boot (ps2 
f usb/156735   usbNeed Quirk for Goflex USB Disk Drives
o usb/156726   usb[snd_uaudio]: snd_uaudio(4) fails to detach when mixer
o usb/156725   usbUSB stack stall cause complete system input loss
o usb/156596   usb[ehci] Extremely high interrupt rate on ehci/uhci IRQ1
o usb/156000   usbrum(4) Fatal trap 18: integer divide fault while in ke
f usb/155996   usbNanoBSD not booted as Disk
o usb/155784   usbProblem with Transcend StoreJet 25M3 (2AJ1) on Asus M2
o usb/155663   usb[usbdevs] [patch] Add support for Supertop Nano 1GB US
o usb/154753   usb[usbdevs] [patch] Support for Qualcomm USB modem/stora
o usb/154506   usb[umass] Copying dir with large files makes FreeBSD loa
o usb/154192   usb[umass] In Garmin Oregon GPS, only the first umass dev
o i386/153851  usb[keyboard] keyboard issues on new Intel Mother boards.
o usb/153703   usb[keyboard] My USB keyboard can not be used in 8-STABLE
o usb/153609   usb[zyd] [panic] kernel: Fatal trap 12: page fault while 
o usb/153149   usb[umass] USB stick quirk regression [regression]
o usb/152075   usb[usb8] [ehci] [request] Add quirk for CS5536 USB
o usb/150892   usb[zyd] Whenever network contacted in any shape, way or 
o usb/150189   usb[run] [usb8] [patch] if_run appears to corrupt IP traf
p usb/149764   usb[u3g] [patch] usbdevs update: Huawei K3765 3G modem
o usb/149283   usb[uftdi] avrdude unable to talk to Arduino board (via u
o usb/149162   usb[ural] ASUS WL-167g doesn't work in 8.1 (continue of 1
s usb/148702   usb[usb8] [request] IO DATA USB-RSAQ5 support on FreeBSD-
o usb/148080   usbusbconfig(8) sometimes does not turn off the device
o i386/147475  usb[install] FreeBSD 8.x does not install on ASUS K8N4-E 

isochronous transfer for UVC camera

2012-10-29 Thread SAITOU Toshihide
I'm trying to get the streaming data from the UVC camera, but isochronous 
transfer callback isn't invoked. Is this lack of parameters to be set or wrong 
coding for my isochronous transfer?

$ uname -a
FreeBSD Kingyo.ens.tut.ac.jp 9.1-RC2 FreeBSD 9.1-RC2 #0 r241106: Mon Oct  1 
18:26:44 UTC 2012 r...@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC 
 amd64


/*
 *   $ cc -o ex10 ex10.c -lusb
 *   $ ./ex10 
 *
 * [UVC1.5] Universal Serial Bus Device Class Definition for Video Devices,
 *  (UVC 1.5 Class specification.pdf),
 *  .
 *
 * [USB2.0] USB 2.0 Specification Universal Serial Bus Revision 2.0 
specification,
 *  (usb_20.pdf), .
 */

#include 
#include 
#include 
 
#define VID 0x0458
#define PID 0x7081
#define TIMEOUT 500 // 500 ms
 
#define ConfNum1// Configuration Number
#define IfNum  1// Interface Number
#define AltIfNum   1// Alternate Interface Number


static void cb(struct libusb_transfer *transfer)
{
printf("\nReceived.\n");
libusb_submit_transfer(transfer); // repeat
}


int main( int argc, char **argv)
{
struct libusb_device_descriptor desc;
libusb_context *ctx = NULL;
libusb_device **deviceLst;
ssize_t deviceCnt = 0;
libusb_device *camdev = NULL;
libusb_device_handle *handle;   
int attached = 0;

uint8_t buf[256];
int i;
int rcv;


// populate list with the list of usb devices available.
libusb_init(&ctx);
if ((deviceCnt = libusb_get_device_list(ctx, &deviceLst)) < 0) {
fprintf(stderr, "no usb devices found\n");
return;
}

libusb_set_debug(ctx, 99);

// find device
for (i = 0; i < deviceCnt; i++) {
libusb_get_device_descriptor(deviceLst[i], &desc);
if (desc.idVendor == VID && desc.idProduct == PID) {
camdev = (libusb_device *)deviceLst[i];
break;
}
}

if (!camdev)
{
fprintf(stderr, "device not found.");
return;
}


// open device
if (libusb_open(camdev, &handle) != 0)
{
fprintf(stderr, "Unable to open usb device\n");
return;
}
 
// if kernel driver is active, detach a kernel driver.
if (libusb_kernel_driver_active(handle, 0) == 1)
{
printf("Detaching kernel driver.\n");
libusb_detach_kernel_driver(handle, 0);
attached = 1;
}

// set the active configuration
if (libusb_set_configuration(handle, ConfNum) != 0)
{
fprintf(stderr, "Set configuration failed.");
}


// 
// negotiate the streaming parameters

// Device State Transition [UVC1.5, p. 107]
// Video Probe and Commit Controls [UVC1.5, p. 134]

// set some parameters described to set by the host. [UVC1.5, p. 134]
for (i=0; i<48; i++) {
buf[i] = 0x00;
}
buf[0] = 0x01;  // what fields shall be kept fixed (0x01: 
dwFrameInterval)
buf[1] = 0x00;  // 
buf[2] = 0x01;  // video format index
buf[3] = 0x01;  // video frame index
buf[4] = 0x40;  // interval
buf[5] = 0x4b;  //   propose:   0x4c4b40 (500 ms)
buf[6] = 0x4c;  //   agreement: 0x1312d0 (125 ms)
buf[7] = 0x00;  // 

// VS_PROBE_CONTROL(0x01) [UVC1.5, p. 161], SET_CUR(0x87) [UVC1.5, 
p.158]
libusb_control_transfer(handle, 0x21, 0x01, 0x0100, 0x0001, buf, 48, 
TIMEOUT);
for (i=0; i<48; i++) { printf("%x ", buf[i]); } printf("\n");

// VS_PROBE_CONTROL(0x01) [UVC1.5, p. 161], GET_CUR(0x81) [UVC1.5, 
p.158]
libusb_control_transfer(handle, 0xa1, 0x81, 0x0100, 0x0001, buf, 48, 
TIMEOUT);
for (i=0; i<48; i++) { printf("%x ", buf[i]); } printf("\n");

// VS_COMMIT_CONTROL(0x02) [UVC1.5, p. 161], SET_CUR(0x01) [UVC1.5, 
p.158]
libusb_control_transfer(handle, 0x21, 0x01, 0x0200, 0x0001, buf, 48, 
TIMEOUT);
for (i=0; i<48; i++) { printf("%x ", buf[i]); } printf("\n");

// VS_COMMIT_CONTROL(0x02) [UVC1.5, p. 161], GET_CUR(0x81) [UVC1.5, 
p.158]
//libusb_control_transfer(handle, 0xa1, 0x81, 0x0200, 0x0001, buf, 48, 
TIMEOUT);
//for (i=0; i<48; i++) { printf("%x ", buf[i]); } printf("\n");


// set interface, set alt interface [USB2.0, p. 250]
// are available through synchronous, blocking function
// in the libusb, so can not use libusb_control_transfer.

/

Re: isochronous transfer for UVC camera

2012-10-29 Thread Hans Petter Selasky
On Monday 29 October 2012 13:54:34 SAITOU Toshihide wrote:
> #define PKT_LEN0x1400

Hi,

The packet length is not this value I think.

The 0x1000 is part of the packet multiplier for High-Speed USB's 
wMaxPacketSize.

It is (1+2) * 0x400. Try that and see what happens.

Also there is usbdump -i usbusX -f Y -s 65536 -vvv, which will show the actual 
traffic.

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: isochronous transfer for UVC camera

2012-10-29 Thread SAITOU Toshihide
In message: <201210291436.08940.hsela...@c2i.net>
Hans Petter Selasky  writes:
> On Monday 29 October 2012 13:54:34 SAITOU Toshihide wrote:
>> #define PKT_LEN0x1400
> 
> The packet length is not this value I think.
> 
> The 0x1000 is part of the packet multiplier for High-Speed USB's 
> wMaxPacketSize.
> 
> It is (1+2) * 0x400. Try that and see what happens.

Thank you for your quick response.

I can't use the FreeBSD now so I will try this tomorrow.  But Mac OS X 10.6.8 
with libus 1.0.9, callback is not invoked too with some combination of the 
value below:

#define PKT_LEN0x400
#define PKTS_PER_XFER  8

$ ./ex10
libusb: 0.00 info [darwin_open] device open for access
libusb: 0.285678 info [darwin_async_io_callback] an async io operation has 
completed
libusb: 0.286030 info [op_handle_events] checking fd 4 with revents = 0
libusb: 0.286187 info [op_handle_events] checking fd 6 with revents = 1
libusb: 0.286343 info [darwin_handle_callback] handling control completion with 
kernel status 0
1 0 1 1 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 
libusb: 0.287708 info [darwin_async_io_callback] an async io operation has 
completed
libusb: 0.287751 info [op_handle_events] checking fd 4 with revents = 0
libusb: 0.287761 info [op_handle_events] checking fd 6 with revents = 1
libusb: 0.287775 info [darwin_handle_callback] handling control completion with 
kernel status 0
1 0 1 1 d0 12 13 0 0 0 0 0 0 0 0 0 0 0 0 60 9 0 0 c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 
libusb: 0.288714 info [darwin_async_io_callback] an async io operation has 
completed
libusb: 0.288770 info [op_handle_events] checking fd 4 with revents = 0
libusb: 0.288781 info [op_handle_events] checking fd 6 with revents = 1
libusb: 0.288799 info [darwin_handle_callback] handling control completion with 
kernel status 0
1 0 1 1 d0 12 13 0 0 0 0 0 0 0 0 0 0 0 0 60 9 0 0 c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 
libusb: 0.289960 info [get_endpoints] building table of endpoints.
libusb: 0.290151 info [darwin_claim_interface] interface opened
libusb: 0.292436 info [get_endpoints] building table of endpoints.
libusb: 0.292459 info [get_endpoints] interface: 1 pipe 1: dir: 1 number: 2
libusb: 0.292478 info [ep_to_pipeRef] converting ep address 0x82 to pipeRef and 
interface
libusb: 0.292484 info [ep_to_pipeRef] pipe 1 on interface 1 matches
libusb: 0.297929 info [darwin_async_io_callback] an async io operation has 
completed
libusb: 30.289159 error [do_close] Device handle closed while transfer was 
still being processed, but the device is still connected as far as we know
libusb: 30.289196 error [do_close] A cancellation hasn't even been scheduled on 
the transfer for which the device is closing
libusb: 30.290970 info [event_thread_main] thread exiting

---
SAITOU Toshihide
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"