Recommendations for programming HID in FreeBSD 9

Hans Petter Selasky hselasky at c2i.net
Fri Jun 1 07:16:18 UTC 2012


On Thursday 31 May 2012 18:30:56 Engineering wrote:
> Hi all, I hope this is the right place to ask this
> 
> I am in process of migrating an embedded system from BSD 7.0 to 9.0, as we
> need upgraded video card drivers which will not compile on the old system.
> To confuse matters a bit, I believe it was 7.0 with some of HPS updated USB
> stack worked in.
> 
> The system has 4 HID devices attached, and I need to read data and set
> feature reports to talk to them.
> 
> I had been using read() and ioctl() - with the evolution of BSD, is there a
> different recommended way to do this?
> 
> I also need open() and to be able to get the usage page, to tell one device
> from another.
> 
> If I recall, at the time the uhid driver had problems with devices that had
> feature reports of varying sizes - I see I hacked it a bit to allow the
> application to specify the size of the report. Is this still the case?
> 
> I of course will be looking into this myself, but initial compile gives me
> the following errors - does this ring a bell to anyone?
> 
> Thanks,
> Sam
> 
> Compiling usbhid.cpp...
> usbhid.cpp:35: error: 'usb_ctl_report_desc' does not name a type
> usbhid.cpp: In function 'int hid_set_feature(int, unsigned char*, int)':
> usbhid.cpp:157: error: 'usb_ctl_report' was not declared in this scope
> usbhid.cpp:157: error: expected `;' before 'ucr'
> usbhid.cpp:161: error: 'ucr' was not declared in this scope
> usbhid.cpp:169: error: invalid application of 'sizeof' to incomplete type
> 'usb_ctl_report'
> usbhid.cpp:174: error: 'USB_SET_REPORT' was not declared in this scope
> usbhid.cpp: In function 'void usbhid_populate_list()':
> usbhid.cpp:331: error: 'USB_GET_REPORT_DESC' was not declared in this scope
> usbhid.cpp:331: error: 'struct hid_t' has no member named 'ucrd'
> usbhid.cpp:334: error: 'struct hid_t' has no member named 'ucrd'
> usbhid.cpp:336: error: 'struct hid_t' has no member named 'ucrd'
> usbhid.cpp:337: error: 'struct hid_t' has no member named 'ucrd'
> *** Error code 1
> 

See:
man usbhid

Else use LibUSB to access the device.

--HPS


More information about the freebsd-usb mailing list