Open apprehensions opened 1 year ago
In theory support's been built in to toybox since January? See mailing list thread http://lists.landley.net/pipermail/toybox-landley.net/2022-February/012782.html and commit 66471ddcec21 and so on.
The descriptor files come from https://pci-ids.ucw.cz/v2.2/pci.ids.gz and http://www.linux-usb.org/usb.ids respectively, wget should pull them just fine. You can stick them (with or without .gz extension, in which case it'll run it through zcat) anywhere in the search path /etc:/vendor:/usr/share/misc
why not simply retrieve them from the manufacterer and vendor files as seen in the busybox patch?
on another note, http://www.linux-usb.org/usb.ids
doesn't change the output of lsusb
.
0 $ ~/.local/src/toybox/toybox lsusb -i usb.ids
Bus 001 Device 007: ID 1038:12b3
Bus 001 Device 010: ID 8087:0aaa
Bus 001 Device 006: ID 0b05:18a3
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 008: ID 2ea8:2203
Bus 001 Device 002: ID 1532:008a
Bus 001 Device 005: ID 0781:5591
Bus 002 Device 001: ID 1d6b:0003
Bus 001 Device 004: ID 05e3:0610
Bus 001 Device 009: ID 1e71:2007
Bus 001 Device 003: ID 6964:0075
0 $
sorta.
When you send me GPLv2 code copied from busybox, I'm not gonna look closely at it.
heres a little shell script i made that prints the usb stuff and everything.
#!/bin/sh
for usb in /sys/bus/usb/devices/*; do
[ -f $usb/uevent ] && [ -f $usb/idVendor ] && {
eval $(cat $usb/uevent)
read -r idproduct < $usb/idProduct
[ -f $usb/product ] && read -r product < $usb/product
read -r idvendor < $usb/idVendor
[ -f $usb/manufacturer ] && read -r vendor < $usb/manufacturer
printf 'Bus %s Device %s: ID %s:%s %s %s\n' \
$BUSNUM $DEVNUM $idvendor $idproduct "$vendor" "$product"
unset idproduct product idvendor vendor BUSNUM DEVNUM
}
done
this should sort of explain it.
i have been trying to convert this into toybox for lsusb as a patch for my personal use, but never figured it out.