lsusb -v gives the information of the device descriptor of a USB device.
Is there any command/tool which can give us the continuous HID input reports from a USB HID device in Linux?
-
What continuous reports? Are you wanting plug/unplug events? Data capture?chrylis -cautiouslyoptimistic-– chrylis -cautiouslyoptimistic-2015-03-02 05:58:13 +00:00Commented Mar 2, 2015 at 5:58
-
No.Just like getevent for input susbsystem drivers is there any command for getting the hid input reports for HID USB input subsystem.Raulp– Raulp2015-08-25 03:24:33 +00:00Commented Aug 25, 2015 at 3:24
Add a comment
|
3 Answers
When lsusb shows your device is 60 on a bus 1:
usbhid-dump -s 1:60 -f -e stream
Example output:
001:060:000:STREAM 1479575666.731004
02 1F
.001:060:000:STREAM 1479575666.859017
01 1E
.001:060:000:STREAM 1479575666.987019
02 1F
First line is path, type, timestamp. Second line is raw report, so if you use several report ids, then first byte is report id. If you don't use report ids, then it's your message straight from the beginning
Comments
5 Comments
Raulp
it gives the information in some junk characters interlaced with some ascii characters.Is there a way to show ascii text of these reports.
CL.
HID reports are not ASCII text but binary data. If you want to format them for display, you have to do this yourself.
Raulp
yes but how can binary data be formatted to get Ascii data?
CL.
Add " | hexdump -C" or " | xxd -g1" to get a hex dump.
Alexis Wilke
@Raulp In Linux you have a header (
/usr/include/linux/hiddev.h) describing the structures you get with the ioctl() function. That describes the data you get when you read() from the character device. (i.e. the "report" which is composed of "fields"). More info can be found in the USB document here (see download link to PDF).