Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jun 2012 12:10:13 -0500
From:      "Engineering" <ee@athyriogames.com>
To:        "'Hans Petter Selasky'" <hselasky@c2i.net>, "'Alexander Motin'" <mav@freebsd.org>
Cc:        freebsd-usb@freebsd.org
Subject:   RE: Recommendations for programming HID in FreeBSD 9
Message-ID:  <028301cd4019$69eafba0$3dc0f2e0$@com>
In-Reply-To: <201206011823.30527.hselasky@c2i.net>
References:  <201205280640.q4S6e6L0035127@freefall.freebsd.org> <201206011730.31081.hselasky@c2i.net> <027901cd4011$53ec4ff0$fbc4efd0$@com> <201206011823.30527.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
-----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:

if(ugd->ugd_config_index) // abusing variables to set a flag, use passed in
id and size in lang_id and actlen
	error = uhid_set_report(sc, ugd->ugd_report_type, ugd->ugd_lang_id,
NULL, 
		ugd->ugd_data, ugd->ugd_actlen);
else
	error = uhid_set_report(sc, ugd->ugd_report_type, id, NULL, 
		ugd->ugd_data, size);

Would suit my needs well, as long as I remember to zero out ugd_config_index
on a normal one!

I suppose I need to rebuild the kernel. Thanks for your time and help!

Sam






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?028301cd4019$69eafba0$3dc0f2e0$>