4

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?

2
  • What continuous reports? Are you wanting plug/unplug events? Data capture? Commented 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. Commented Aug 25, 2015 at 3:24

3 Answers 3

9

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

Sign up to request clarification or add additional context in comments.

Comments

4

There is a device file for that:

cat /dev/usb/hiddev0

Also read the documentation.

5 Comments

it gives the information in some junk characters interlaced with some ascii characters.Is there a way to show ascii text of these reports.
HID reports are not ASCII text but binary data. If you want to format them for display, you have to do this yourself.
yes but how can binary data be formatted to get Ascii data?
Add " | hexdump -C" or " | xxd -g1" to get a hex dump.
@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).
3

Following can be helpful in viewing the input reports:

cat /sys/kernel/debug/<dev>/events

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.