[libhid-discuss] NetBSD and reports

Charles Lepple clepple at ghz.cc
Tue Mar 11 00:00:00 UTC 2008


On Mar 10, 2008, at 8:42 AM, Adrian wrote:

> Hello,
>
> I'm trying to interface the minibox USB LCD 20x2 to a small PC (it  
> was a WinCE thin client). I'm doing my development on a McBook with  
> Parallels running NetBSD 3.1. I know the LCD unit works as I've  
> tried the WinXP utility and it does what it should.

I can't speak for NetBSD, but my experience with FreeBSD 6.2 has been  
that it does things fairly differently than Windows or Linux when it  
comes to USB interrupt transfers. (Just something to think about, if  
the USB stack still shares a common heritage.)

> I suppose I have 2 issues about "hid_set_output_report()". First,  
> I'm not really sure how to use the path values. I don't understand  
> the comments in the test_libhid.c file!

Well, the instructions are a bit vague since HID devices vary greatly  
in how they structure their report descriptors.

Can you post the debug output of the test_libhid program? (Please  
gzip and attach - most of the lines will get folded if you insert the  
debug log into your mail message.)

> Also by messing with these it seems to alter the report code being  
> sent. That's good, as I need a dozen or so reports to control the  
> LCD. How does the path relate to report codes?

I'll take a stab at this, but it will be easier to point to specifics  
in your debug log.

Basically, a report can contain many HID elements. In a complex HID  
descriptor, a single HID usage code is not unique across the whole  
device, the same way that you can have many foo.c files on a single  
filesystem.

Therefore, we use the notion of a path to say "this element is in  
this collection, which is nested in this top-level collection". (It  
turns out that nobody really has multiple top-level collections, but  
we were trying not to box ourselves in when this library was first  
written.)

> The second question regards the report message. The UHID  
> documentation seems to suggest that a report message starts with  
> the report id byte and then the desired length of bytes. Should I  
> be including the report code in my message to send or does the  
> libhid stuff it in?

This isn't a yes-or-no answer, but maybe this will match up with  
something in the LCD documentation.

When you use hid_set_output_report(), libhid fires off a control  
transfer:

    http://libhid.alioth.debian.org/doc/hid__exchange_8c- 
source.html#l00079

If you trace through the code, the report ID is sent "out-of-band";  
that is, it is a parameter to usb_control_msg(), and is not inserted  
into the buffer.

I think you are referring to an interrupt transfer, where there is no  
out-of-band data, and the first byte is the report ID (unless there  
are no report IDs defined, in which case the report ID byte is skipped).

> Incidentally lsusb doesn't seem to exist in NetBSD so I have to use  
> the trace-dump.


Does NetBSD have "usbdevs"?

-- 
Charles Lepple






More information about the libhid-discuss mailing list