Closed mic-e closed 3 years ago
I have ensured that this works nicely for all combinations of flags.
For -U
where no hubs are displayed, the devices are rendered at the root level:
1-1.5.3 17ef:6044 00 1IF [USB 2.00, 1.5 Mbps, 50mA] (Lenovo)
│ (EP) 00: Control attr 00 len 07 max 008
└─ 1-1.5.3:1.0 (IF) 03:01:02 1EP (Mouse) usbhid hidraw0 (hid-generic) input2 (hid-generic)
(EP) 81: Interrupt (10ms) attr 03 len 07 max 006
1-1.5.4 04d9:0295 00 3IFs [USB 2.00, 12 Mbps, 100mA] (Holtek Semiconductor, Inc.)
│ (EP) 00: Control attr 00 len 07 max 040
├─ 1-1.5.4:1.0 (IF) 03:01:01 1EP (Keyboard) usbhid hidraw1 (hid-generic) input23 (hid-generic)
│ (EP) 81: Interrupt (1ms) attr 03 len 07 max 008
├─ 1-1.5.4:1.1 (IF) 03:00:00 2EPs (None) usbhid hidraw2 (hid-generic)
│ (EP) 04: Interrupt (1ms) attr 03 len 07 max 040
│ (EP) 83: Interrupt (1ms) attr 03 len 07 max 040
└─ 1-1.5.4:1.2 (IF) 03:00:00 1EP (None) usbhid hidraw3 (hid-generic) input24 input27 input25 input26 (hid-generic)
(EP) 82: Interrupt (1ms) attr 03 len 07 max 040
3-1 0bda:8156 00 1IF [USB 3.20, 5000 Mbps, 512mA] (Realtek USB 10/100/1G/2.5G LAN 000000001)
│ (EP) 00: Control attr 00 len 07 max 200
└─ 3-1:1.0 (IF) ff:ff:00 3EPs (Vendor Specific Class) r8152 net/disklink
(EP) 02: Bulk attr 02 len 07 max 400
(EP) 83: Interrupt (11ms) attr 03 len 07 max 002
(EP) 81: Bulk attr 02 len 07 max 400
4-1.1 0951:1666 00 1IF [USB 2.10, 480 Mbps, 300mA] (Kingston DataTraveler 3.0 60A44C3FAE22F35189560BF1)
│ (EP) 00: Control attr 00 len 07 max 040
└─ 4-1.1:1.0 (IF) 08:06:50 2EPs (Bulk-Only) usb-storage host4 (sda)
(EP) 02: Bulk (31875us) attr 02 len 07 max 200
(EP) 81: Bulk (0ms) attr 02 len 07 max 200
4-1.2 1d50:6018 ef 6IFs [USB 2.00, 12 Mbps, 100mA] (SFT Technologies Black Magic Probe 7EB85BCB)
│ (EP) 00: Control attr 00 len 07 max 040
├─ 4-1.2:1.0 (IF) 02:02:01 1EP (AT-commands (v.25ter)) cdc_acm tty/ttyACM0
│ (EP) 82: Interrupt (255ms) attr 03 len 07 max 010
├─ 4-1.2:1.1 (IF) 0a:00:00 2EPs (CDC Data) cdc_acm
│ (EP) 81: Bulk (0ms) attr 02 len 07 max 040
│ (EP) 01: Bulk (0ms) attr 02 len 07 max 040
├─ 4-1.2:1.2 (IF) 02:02:01 1EP (AT-commands (v.25ter)) cdc_acm tty/ttyACM1
│ (EP) 84: Interrupt (255ms) attr 03 len 07 max 010
├─ 4-1.2:1.3 (IF) 0a:00:00 2EPs (CDC Data) cdc_acm
│ (EP) 83: Bulk (0ms) attr 02 len 07 max 040
│ (EP) 03: Bulk (0ms) attr 02 len 07 max 040
├─ 4-1.2:1.4 (IF) fe:01:01 0EPs (Application Specific Interface)
└─ 4-1.2:1.5 (IF) ff:ff:ff 1EP (Vendor Specific)
(EP) 85: Bulk attr 02 len 07 max 040
4-1.3 058f:6362 00 1IF [USB 2.00, 480 Mbps, 250mA] (Alcor Micro Corp. Flash Card Reader/Writer 058F63626476)
│ (EP) 00: Control attr 00 len 07 max 040
└─ 4-1.3:1.0 (IF) 08:06:50 2EPs (Bulk-Only) usb-storage host5 (sdd sdb sde sdc)
(EP) 01: Bulk attr 02 len 07 max 200
(EP) 82: Bulk attr 02 len 07 max 200
I like this, but it fails for me with the following error when doing lsusb -u
:
$ ./lsusb.py -u
WARNING: Failure to read usb.ids
Traceback (most recent call last):
File "./lsusb.py", line 649, in <module>
main(sys.argv)
File "./lsusb.py", line 645, in main
read_usb()
File "./lsusb.py", line 579, in read_usb
forest.add(usbdev.get_tree())
File "./lsusb.py", line 475, in get_tree
tree.add(child.get_tree())
File "./lsusb.py", line 475, in get_tree
tree.add(child.get_tree())
File "./lsusb.py", line 475, in get_tree
tree.add(child.get_tree())
File "./lsusb.py", line 513, in add
if child.name:
AttributeError: 'Forest' object has no attribute 'name'
lsusb.py -U
works for me though:
3-1.3.3 1050:0200 00 1IF [USB 2.00, 12 Mbps, 30mA] (Yubico Yubico Gnubby (gnubby1))
3-2.2.2 04d8:eed2 00 3IFs [USB 2.00, 12 Mbps, 500mA] (Massdrop Inc. CTRL Keyboard 1595126560)
4-1.3.1 05e3:0749 00 1IF [USB 3.00, 5000 Mbps, 896mA] (Generic USB3.0 Card Reader 000000001531)
7-2.2 30be:0101 ef 4IFs [USB 2.00, 480 Mbps, 0mA] (Schiit Audio Schiit Hel)
7-5 0db0:0d64 ef 8IFs [USB 2.00, 480 Mbps, 100mA] (Generic USB Audio)
7-6 1462:7c59 00 1IF [USB 1.10, 12 Mbps, 500mA] (MSI MYSTIC LIGHT A02019082203)
8-3 0781:558c 00 1IF [USB 3.10, 10000 Mbps, 896mA] (SanDisk Extreme SSD 313934393053343031303234)
9-5 8087:0029 e0 2IFs [USB 2.01, 12 Mbps, 100mA] ()
But, it's missing the name of the last device, here is the output of the existing lsusb.py -U
3-1.3.3 1050:0200 00 1IF [USB 2.00, 12 Mbps, 30mA] (Yubico Yubico Gnubby (gnubby1))
3-2.2.2 04d8:eed2 00 3IFs [USB 2.00, 12 Mbps, 500mA] (Massdrop Inc. CTRL Keyboard 1595126560)
4-1.3.1 05e3:0749 00 1IF [USB 3.00, 5000 Mbps, 896mA] (Genesys Logic, Inc. SD Card Reader and Writer 000000001531)
7-2.2 30be:0101 ef 4IFs [USB 2.00, 480 Mbps, 0mA] (Schiit Audio Schiit Hel)
7-5 0db0:0d64 ef 8IFs [USB 2.00, 480 Mbps, 100mA] (Micro Star International)
7-6 1462:7c59 00 1IF [USB 1.10, 12 Mbps, 500mA] (MSI MYSTIC LIGHT A02019082203)
8-3 0781:558c 00 1IF [USB 3.10, 10000 Mbps, 896mA] (SanDisk Extreme SSD 313934393053343031303234)
9-5 8087:0029 e0 2IFs [USB 2.01, 12 Mbps, 100mA] (Intel Corp. AX200 Bluetooth)
name of the last device is due to usb.ids issue, not due to these changes, sorry for the noise.
Closing this out now due to lack of response. If you get this fixed up, please reopen and I will be glad to review it!
before:
after: