On Thursday 18 June 2009, Alan Stern wrote: > On Thu, 18 Jun 2009, Frans Pop wrote: > Can you add in the Parent and Port fields to the T: line? They can be > derived from the device's directory name as follows: I've added level, parent, port and count. > If the name is "A-B" or "A-B.C" or "A-B.C.D" etc. then the > port number is B or C or D etc. Turns out the script did not yet support levels greater than 2. I've fixed that as well. > (although the real /proc/bus/usb/devices file displays the > port number - 1, for unknown reasons). I've kept that for compatibility. > I've never found much use for the Level or Count fields. Well, the level is an indication of how deep a device is nested. I suppose that in itself can be a clue to mysterious failures. IMO it also makes it a bit easier to "see" the tree structure in the output. I've also added count, even if just for compatibility. > I also don't > see any reason to include the E: line for endpoint 0; the only useful > information it contains is the maxpacket size, and that is already > present on the D: line. Well, on my system I have a device (docking station USB hub) that shows different max packet size for the device and endpoint 0: T: Bus=1 Lev=1 Prnt=1 Port=1 Dev#=48 Spd=480 MxCh=4 D: Ver=2.00 Cls=09(hub ) Sub=00 Prot=02 MxPS=64 #Cfgs=1 P: Vendor=0424 ProdID=2504 Rev=0.1 C: #Ifs=1 Cfg#=1 Atr=e0 MxPwr=2mA E: Ad=00(both) Atr=00(Control) MxPS=0040 Ivl=0ms I: If#=00 Alt=1 #EPs=01 Cls=09(hub ) Sub=00 Prot=02 Driver=hub E: Ad=81(in) Atr=03(Interrupt) MxPS=0001 Ivl=256ms Anyway, I've kept it for now. Other changes; - preserve spaces in classname - make class names for vendor/application specific and unknown same as /proc/bus/usb/devices - added copyright and licence note (GPLv2+), assuming Greg and Randy will be OK with that Updated version attached. Cheers, FJP
Attachment:
usb-devices.sh
Description: application/shellscript