-1

I'm looking for some guidance on how to send a USB HID Gadget's Feature Report.

This looks like a solution for me, but I can't figure out how to make it work:

How to send feature-report to the HOST_PC via Linux USB_GADGET

How is this patch implemented/used? Can someone more familiar with kernel driver/configfs stuff point me in the right direction?

I have the exact same scenario as the linked question, and need a HID gadget device to reply to a host's feature report request. Third party app polls the firmware version info using the report, so I need to reply to make it happy and think it's the original hardware.

I've already recompiled my kernel with the patched f_hid.c driver file from the link, however I don't see how/where I can populate the reports data. I'm a code novice, but it looks like I should see configfs files/attributes. I don't get any new configfs files under the gadget's instance though.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
ninthbit
  • 1
  • 3

1 Answers1

0

Figured it out. I had two problems. First was that kernel rebuild didn't fully clean and the module didn't actually recompile to include the patch. Found that out using strings on the usb_f_hid.ko file and I didn't see the new functions listed. After a good recompile, config_fs did show the "feature_report" file under the gadget's HID function.

That led me to find a second problem that would be important for anyone using the the linked post's patch. If the HID device your creating requires multiple feature report under different IDs, this implementation requires each report to be written on top of the feature_report file separately and it adds each entry to a list. In my case I had two reports (ID 5, and ID 7) one was for the firmware version, and the other was a repeat of the device's SN. The third party software needed to get responses on both to recognize the device.

Huge thanks to narek-aydinyan for sharing his original solution. I never would have gotten this working without that patch.

ninthbit
  • 1
  • 3