lsusb omits some devices and (apparently) cannot be fixed
"Karl O. Pinc" <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <1189721076l.13173l.4l@mofo> |
Hello, lsusb silently ignores at least some permission errors, resulting in no output for the device to which there are no permissions. I have it on the authority of the Debian lsusb maintainter that this cannot be fixed in the application. Therefore there is a problem in the kernel or the USB code that needs fixing so I'm reporting it here. Please let me know if I should report somewhere else. Something somewhere is silently ignoring permission violations and the result is that lsusb must always be run as root or the results cannot be trusted because there is no way to know when all devices are shown and when not. (In an SELinux environment the problem may well be worse and lsusb can _never_ be trusted.) Of course lsusb should not show details about devices to which the user has no permissions, but it should show a permission violation. Silently ignoring permission errors and pretending these these devices do not exist is not unix-like. lsusb is violating the principal of least suprise. If lsusb can detect that a device exists, and it should because the device is visible in the /dev hierarchy, it should be able to tell that it can't get any information about the device and issue an error, just like cat does when it tries to read a file without permission or ls does when it tries to read a directory or follow a symlink and there's no permission. Please let me know if there is more information I can supply. Details: Debian 4.0r1 $ cat /etc/debian_version 4.0 Stock kernel $ uname -a Linux mofo 2.6.18-5-686 #1 SMP Thu Aug 30 02:19:07 UTC 2007 i686 GNU/Linux Usbutils version $ lsusb --version lsusb (usbutils) 0.72 $ aptitude show usbutils Package: usbutils State: installed Automatically installed: no Version: 0.72-7 $ aptitude show libusb-0.1-4 Package: libusb-0.1-4 State: installed Automatically installed: yes Version: 2:0.1.12-5 The root user, and users in the plugdev group, get: # lsusb Bus 001 Device 007: ID 04fc:ffff Sunplus Technology Co., Ltd Bus 001 Device 001: ID 0000:0000 Other users get: $ lsusb Bus 001 Device 001: ID 0000:0000 Permissions are: $ ls -lR /dev/bus/usb/ /dev/bus/usb/: total 0 drwxr-xr-x 2 root root 80 2007-09-03 23:40 001 /dev/bus/usb/001: total 0 crw-rw-r-- 1 root root 189, 0 2007-09-03 17:05 001 crw-rw---- 1 root plugdev 189, 6 2007-09-03 23:40 007 $ (lsusb ; lspci ; cat /proc/bus/usb/devices) > /tmp/foo ;# produces: Bus 001 Device 007: ID 04fc:ffff Sunplus Technology Co., Ltd Bus 001 Device 001: ID 0000:0000 00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 03) 00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03) 00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 02) 00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) 00:07.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB (rev 01) 00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 02) 00:0f.0 VGA compatible controller: nVidia Corporation NV4 [RIVA TNT] (rev 04) 00:10.0 SCSI storage controller: Adaptec AIC-7892B U160/m (rev 02) 00:12.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 07) 00:14.0 Ethernet controller: Intel Corporation 82557/8/9 [Ethernet Pro 100] (rev 08) 01:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G400/G450 (rev 04) T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 2.06 S: Manufacturer=Linux 2.6.18-5-686 uhci_hcd S: Product=UHCI Host Controller S: SerialNumber=0000:00:07.2 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 7 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=04fc ProdID=ffff Rev= 1.00 C:* #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=81(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 0 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=81(I) Atr=01(Isoc) MxPS= 128 Ivl=1ms I: If#= 0 Alt= 2 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=81(I) Atr=01(Isoc) MxPS= 384 Ivl=1ms I: If#= 0 Alt= 3 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=81(I) Atr=01(Isoc) MxPS= 512 Ivl=1ms I: If#= 0 Alt= 4 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=81(I) Atr=01(Isoc) MxPS= 640 Ivl=1ms I: If#= 0 Alt= 5 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=81(I) Atr=01(Isoc) MxPS= 768 Ivl=1ms I: If#= 0 Alt= 6 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=81(I) Atr=01(Isoc) MxPS= 896 Ivl=1ms I: If#= 0 Alt= 7 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=81(I) Atr=01(Isoc) MxPS=1023 Ivl=1ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 1 Ivl=1ms See also Debian Bug #440763 (Formerly titled "usbutils: lsusb silently ignores permission errors" http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=440763 Thanks, Karl <[email protected]> Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel