Recommendations for programming HID in FreeBSD 9

Engineering ee at athyriogames.com
Sun Jun 3 22:29:55 UTC 2012


>>           if (id != 0)
>>                        copyin(ugd->ugd_data,&id, 1);
>>                 error = uhid_set_report(sc, ugd->ugd_report_type, id,
>>                     NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
>
>Hans is right. That code should do the trick. Last year I've fixed uhid 
>driver to handle multiple report IDs. Even user-level tools are able to 
>do it now. "id != 0" should be correct condition. According to HID spec, 
>if device has at least one non-zero report ID, report ID should be 
>included into any transfer. So now uhid driver assumes that report ID 
>should be in the first byte of request, if it found some non-zero ID in 
>descriptor.

Thanks to all for your help, I have it working, and am very happy to be up
to date in BSD.

For the record, one of my HID had different report IDs AND different report
sizes, so I had to add my hack to send the size for it to work correctly.

The bonus with that is that my touchscreen, which has badly ported HID code
from the original USB firmware, and does not correctly report its report
sizes, can also work with uhid.

Thanks again
Sam





More information about the freebsd-usb mailing list