trivia: dumping USB HID report descriptors
Werner Almesberger
werner at almesberger.net
Sat Nov 12 21:18:30 EST 2011
The USB HID protocol has a descriptor that defines the layout of
the reports the HID device sends. If you're ever in a situation
where you need this sort of information, here's how you can decode
it:
Download:
get usbhid-dump-1.2.tar.gz from
http://sourceforge.net/projects/digimend/files/usbhid-dump/
get hidrd-0.2.tar.gz from
http://sourceforge.net/projects/digimend/files/hidrd/0.2/
Build and install:
tar xfz usbhid-dump-1.2.tar.gz
cd usbhid-dump-1.2
./configure
make
make install
cd ..
tar xfz hidrd-0.2.tar.gz
cd hidrd-0.2
./configure
make
make install
ldconfig
Find the VID:PID of your device with lsusb or whatever you prefer.
usbhid-dump -d VID:PID | grep -v : | tr -d ' \n' | xxd -r -p |
hidrd-convert -o spec
And all the pesky little details will be revealed before your very
eyes.
If you forget to specify the VID:HID, it seems that this will grab
your USB keyboard, etc. Just waiting for one minute supposedly
returns it to you. I didn't test this :-)
Further reading:
http://kerneltrap.org/mailarchive/linux-usb/2010/2/27/6258315
http://digimend.sourceforge.net/
- Werner
More information about the discussion
mailing list