Bug 198915 - libusb libusb_get_device_list() list not all devices
Summary: libusb libusb_get_device_list() list not all devices
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 10.1-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-26 01:02 UTC by Ivan Rozhuk
Modified: 2015-05-01 15:28 UTC (History)
1 user (show)

See Also:


Attachments
libusb_get_device_list() example program (1.83 KB, text/x-csrc)
2015-03-26 01:02 UTC, Ivan Rozhuk
no flags Details
lsusb -vvv (145.40 KB, text/plain)
2015-03-26 13:47 UTC, Ivan Rozhuk
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2015-03-26 01:02:38 UTC
Created attachment 154811 [details]
libusb_get_device_list() example program

FreeBSD rimwks 10.1-STABLE FreeBSD 10.1-STABLE #11: Mon Feb  9 04:52:35 MSK 2015     root@wks:/usr/obj/usr/src/sys/RIMWKSx64  amd64

# lsusb
Bus /dev/usb Device /dev/ugen5.3: ID 8644:8003  
Bus /dev/usb Device /dev/ugen3.3: ID 046d:082d Logitech, Inc. 
Bus /dev/usb Device /dev/ugen8.3: ID 09da:9090 A4 Tech Co., Ltd 
Bus /dev/usb Device /dev/ugen8.2: ID 04f2:0833 Chicony Electronics Co., Ltd 
Bus /dev/usb Device /dev/ugen3.2: ID 1058:1042 Western Digital Technologies, Inc. 
Bus /dev/usb Device /dev/ugen5.2: ID 05e3:0732 Genesys Logic, Inc. 
Bus /dev/usb Device /dev/ugen9.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen8.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen7.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen6.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen5.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen4.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen3.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen2.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen1.1: ID 0000:0000  
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000
(16 devs)


# usbconfig list
ugen0.1: <UHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen1.1: <UHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen2.1: <UHCI root HUB Intel> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen3.1: <EHCI root HUB Intel> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen4.1: <XHCI root HUB 0x1033> at usbus4, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen5.1: <XHCI root HUB 0x1912> at usbus5, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen6.1: <UHCI root HUB Intel> at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen7.1: <UHCI root HUB Intel> at usbus7, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen8.1: <UHCI root HUB Intel> at usbus8, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen9.1: <EHCI root HUB Intel> at usbus9, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen5.2: <product 0x0732 vendor 0x05e3> at usbus5, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)
ugen3.2: <Elements 1042 Western Digital> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen8.2: <USB Keyboard CHICONY> at usbus8, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen8.3: <USB Device A4TECH> at usbus8, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen3.3: <HD Pro Webcam C920 vendor 0x046d> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen5.3: <product 0x8003 vendor 0x8644> at usbus5, cfg=255 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)
(16 devs)


# ./lsusb-libusb
Bus 000 Device 001 0000:0000
Bus 001 Device 001 0000:0000
Bus 002 Device 001 0000:0000
Bus 003 Device 001 0000:0000
Bus 004 Device 001 0000:0000
Bus 005 Device 001 0000:0000
Bus 006 Device 001 0000:0000
Bus 007 Device 001 0000:0000
Bus 008 Device 001 0000:0000
Bus 009 Device 001 0000:0000
Bus 005 Device 002 05e3:0732
Bus 003 Device 002 1058:1042
Bus 008 Device 002 04f2:0833
Bus 008 Device 003 09da:9090
(14 devs)
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2015-03-26 08:14:21 UTC
Can you do "lsusb -vvv" ?
Comment 2 Ivan Rozhuk 2015-03-26 13:46:55 UTC
# lsusb -vvv > ./lsusbvvv.txt
can't get debug descriptor: Input/output error
can't get debug descriptor: Input/output error
can't get device qualifier: Input/output error
can't get debug descriptor: Input/output error
can't get debug descriptor: Input/output error
can't get debug descriptor: Input/output error
can't get debug descriptor: Input/output error
can't get device qualifier: Input/output error
can't get debug descriptor: Input/output error
can't get device qualifier: Input/output error
can't get debug descriptor: Input/output error
can't get debug descriptor: Input/output error
Comment 3 Ivan Rozhuk 2015-03-26 13:47:57 UTC
Created attachment 154824 [details]
lsusb -vvv
Comment 4 Hans Petter Selasky freebsd_committer freebsd_triage 2015-03-26 13:58:52 UTC
Hi,

I see that one of your devices has an error (cfg=255). Maybe it is a bit flaky:

ugen5.3: <product 0x8003 vendor 0x8644> at usbus5, cfg=255 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)

Can you check dmesg that none of your devices are repeatedly attaching and detaching?

The test software you attached should return identical device lists like usbconfig does, except when device/target mode USB devices are present. These are not shown by libusb 0.1 or 1.0. See md=DEVICE (you only have md=HOST).

--HPS
Comment 5 Ivan Rozhuk 2015-03-26 14:40:53 UTC
Bus /dev/usb Device /dev/ugen5.3: ID 8644:8003 - was connected later, after
Bus /dev/usb Device /dev/ugen3.3: ID 046d:082d.
problems start from 046d:082d.

dmesg show only connect/disconnect that i do by hands.

Devices list was identical until i move 046d:082d Logitech, Inc. from usb3 to usb2 port.
Now i try move back, but problem still exist.

PS: also i install new kernel but does not reboot now.
Comment 6 Hans Petter Selasky freebsd_committer freebsd_triage 2015-03-26 16:03:40 UTC
Can you ktrace both applications and see if you find any clues what is going on. Look for IOCTL errors.

--HPS
Comment 7 Ivan Rozhuk 2015-03-26 23:47:03 UTC
...
open("/dev/ugen3.4",O_RDWR,01)			 ERR#13 'Permission denied'
ioctl(5,USB_READ_DIR,0xffffe4b8)		 = 0 (0x0)
open("/dev/ugen3.3",O_RDWR,01)			 ERR#13 'Permission denied'
open("/dev/ugen8.3",O_RDWR,01)			 ERR#13 'Permission denied'
...

chmod -R 0777 /dev/usb
fix problem.

usbconfig and lsusb i am start as root, but test app as non root.

sorry for noise.