Date: Sat, 02 Jun 2012 09:55:05 +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: <4FC9B8C9.9060103@FreeBSD.org> In-Reply-To: <028301cd4019$69eafba0$3dc0f2e0$@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>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi. On 06/01/12 20:10, Engineering wrote: > -----Original Message----- >> From: Hans Petter Selasky [mailto:hselasky@c2i.net] >> >> I think mav @ did some work in that area? >> >> Are you sure you cannot use: >> ... >> 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)); >> break; > > That's definitely cleaner, using the ugd fields to denote a special case. > I'm not sure about the (id != 0) - I'll need to check my specific devices, > but something like: 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. -- Alexander Motin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FC9B8C9.9060103>