Open phuclv90 opened 1 year ago
I have this issue with a device. Would be good to get it merged in. I'm using homebrew to install. I've run a test on it, and it seems to be good. Let me know if I can provide some sort of test data.
This is the default homebrew install's output:
2023-08-28T10:31:35+00:00 ~/o/lsusb> lsusb -V
lsusb for Mac OS X 007
2023-08-28T10:23:10+00:00 ~/o/lsusb> lsusb
Bus 001 Device 001: ID 05ac:1018 Apple Inc. USB3.1 Hub Serial: <redacted>
Bus 001 Device 002: ID 05ac:1017 Apple Inc. USB2.0 Hub Serial: <redacted>
Bus 001 Device 004: ID 16d0:0aec 16d0 EDTracker Pro Wireless
Bus 001 Device 003: ID 05ac:1463 Apple Inc. USB-C Digital AV Multiport Adapter Serial: <redacted>
/opt/homebrew/bin/lsusb: line 89: 16#: invalid integer constant (error token is "16#")
Bus 000 Device 000: ID 05ac:1018 Apple Inc. USB 3.1 Bus
I cloned @phuclv90's repo and branch, and tested - this is the output:
2023-08-28T10:19:06+00:00 ~> mkdir ./opt; cd ./opt; git clone https://github.com/phuclv90/lsusb.git; cd
./lsusb
2023-08-28T10:20:01+00:00 ~/o/lsusb> git switch fix_broken_lsusb
Switched to branch 'fix_broken_lsusb'
Your branch is up to date with 'origin/fix_broken_lsusb'.
2023-08-28T10:21:21+00:00 ~/o/lsusb> ./lsusb -V
lsusb for Mac OS X 008
i343999 2023-08-28T10:22:18+00:00 ~/o/lsusb> ./lsusb
Bus 000 Device 001: ID 05ac: Apple Inc. USB
Bus 000 Device 001: ID 05ac:8007 Apple Inc. XHCI Root Hub USB 2.0 Simulation
Bus 000 Device 001: ID 05ac:8007 Apple Inc. XHCI Root Hub USB 2.0 Simulation
Bus 000 Device 001: ID 05ac:8007 Apple Inc. XHCI Root Hub USB 2.0 Simulation
Bus 001 Device 001: ID 05ac:1018 Apple Inc. USB3.1 Hub Serial: <redacted>
Bus 001 Device 002: ID 05ac:1017 Apple Inc. USB2.0 Hub Serial: <redacted>
Bus 001 Device 004: ID 16d0:0aec 16d0 EDTracker Pro Wireless
Bus 001 Device 003: ID 05ac:1463 Apple Inc. USB-C Digital AV Multiport Adapter Serial: <redacted>
Buses:
Bus 000 Device 001: ID 05ac:8007 Apple Inc. XHCI Root Hub USB 2.0 Simulation
Bus 000 Device 001: ID 05ac:8007 Apple Inc. XHCI Root Hub USB 2.0 Simulation
Bus 000 Device 001: ID 05ac:8007 Apple Inc. XHCI Root Hub USB 2.0 Simulation
This script assumes that all device entries have 6 lines following
Product ID
which is absolutely not true. Just with a single line changeyou'll get it mostly work
However it also have many other wrong assumptions like there are 7 lines after the bus name and there are always
Location ID
orBus Number
. Therefore the tree feature is completely broken. It also prints buses as devices although I don't know why and that makes buses printed twice along with the missing product ID. This can't fix all those issues but will make the tree feature less crippled