On Tuesday 23 June 2009, Greg KH wrote: > We should keep it as close as possible, as the format is documented > quite well already in the Documentation/usb/ directory. And if at all > possible, it should match what /sys/kernel/debug/usb/devices shows. OK, so we go for maximum compatibility. That's fine by me. Here's a new version of the script, and a draft for a manpage. Typical example of output as diff between usb/devices file and script: T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 4 D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1d6b ProdID=0002 Rev= 2.06 S: Manufacturer=Linux 2.6.30 ehci_hcd S: Product=EHCI Host Controller S: SerialNumber=0000:00:1a.7 -C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA +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 +I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub -E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms +E: Ad=81(in) Atr=03(Interrupt) MxPS= 4*1 Ivl=256ms I think that's probably close enough for practical purposes. MxPwr and the in/out/both indicators could probably be improved, but I'm not sure if that's worth the effort? Differences from previous version: - renamed from usb-devices.sh to usb-devices - formatting made as similar as possible to devices file - support levels greater than 2 - MxPS value for endpoints shows both size and multiplicity value - line for ep_00 dropped (disabled) - basic error handling added (check if sysfs is mounted) - debug code removed (no longer needed) Please give it a try and let me know if you find any issues. Cheers, FJP
Attachment:
usb-devices
Description: application/shellscript
Attachment:
usb-devices.8.in
Description: Troff document