Is there a way to get HID Usage ID for a USB device in Linux ?
I can use lsusb
to get PID and VID but in device driver development we cannot use PID as it is different in different devices which are run in a particularly same mode. When thinking from windows developments point of view HID Usage ID is unique for this level.
0
votes
1 Answers
1
votes
The usage pages supported by a device must be parsed out of the device's report descriptor. Windows does this for you when you call HidD_GetPreparsedData
. There are two ways to get the report descriptor from the device:
- Open the
/dev/hidrawN
device node and use theHIDIOCGRDESCSIZE
andHIDIOCGRDESC
ioctls to get the report descriptor. - Read the report descriptor out of sysfs by opening the
report_descriptor
file in the device's sysfs directory. This property is also available through the udev library.
Once you have the raw report descriptor you can use a library like hidrd to parse it.