Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 04 Jun 2012 11:21:14 +0300
From:      Alexander Motin <mav@FreeBSD.org>
To:        Engineering <ee@athyriogames.com>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: Recommendations for programming HID in FreeBSD 9
Message-ID:  <4FCC6FFA.3010904@FreeBSD.org>
In-Reply-To: <03ae01cd41d8$47569390$d603bab0$@com>
References:  <201205280640.q4S6e6L0035127@freefall.freebsd.org> <201206011730.31081.hselasky@c2i.net> <027901cd4011$53ec4ff0$fbc4efd0$@com> <201206011823.30527.hselasky@c2i.net> <028301cd4019$69eafba0$3dc0f2e0$@com> <4FC9B8C9.9060103@FreeBSD.org> <03ae01cd41d8$47569390$d603bab0$@com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 06/04/12 01:29, Engineering wrote:
>>>            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.

That should also work fine now. uhid driver only enforces maximal 
transfer sizes calculated from the descriptor. User can request smaller 
transfers, specifying size in ugd.ugd_maxlen field. Look at 
hid_(get|set)_report() functions in lib/libusbhid sources.

> 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.

-- 
Alexander Motin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FCC6FFA.3010904>