0

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.

Dig The Code
  • 658
  • 2
  • 15
  • 32

1 Answers1

1

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:

  1. Open the /dev/hidrawN device node and use the HIDIOCGRDESCSIZE and HIDIOCGRDESC ioctls to get the report descriptor.
  2. 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.

Reilly Grant
  • 5,590
  • 1
  • 13
  • 23