Recommendations for programming HID in FreeBSD 9

Engineering ee at athyriogames.com
Fri Jun 1 16:13:29 UTC 2012


From: Hans Petter Selasky [mailto:hselasky at c2i.net] 
>> uhid is not going to get obsoleted, though using libraries from
user-space is sometimes more convenient.

Thanks HPS (and Xiaofan)

I definitely agree with that, but I've got legacy code...

Last question - I've updated my code to convert the old 'usb_ctl_report' and
such to the new generic descriptors at runtime, and I've got two HIDs up and
running.

As I read uhid.c, it seems to assume only one feature report ID and size. I
have devices that have multiple feature report sizes. And one device which
I'm pretty sure has bad device descriptors, so the size is wrong.

In the BSD7, I added the following fakery to uhid.c:

	case USB_SET_REPORTZ: // report id and size are in first two bytes
		re = (struct usb_ctl_report *)addr;
		id = re->ucr_data[0];
		size = re->ucr_data[1];
		err = usbd_set_report(sc->sc_iface, re->ucr_report, id,
&re->ucr_data[2],size);
		if (err)
		{
			return (EIO);
		}
		break;

Do you think it would make sense to do this again with the BSD9 uhid.c?

If so, is there a way to recompile the kernel so it only updates the uhid
part? Pardon my ignorance on that.

Sam





More information about the freebsd-usb mailing list