Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Aug 2009 05:58:45 +0400
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        gavin@FreeBSD.org
Cc:        freebsd-usb@FreeBSD.org
Subject:   Re: usb/101761: [usb67] [patch] [request] usb.h: increase maximal size of report descriptor
Message-ID:  <20090825015845.GB26981@hades.panopticon>
In-Reply-To: <200908241557.n7OFvuT1052755@freefall.freebsd.org>
References:  <200908241557.n7OFvuT1052755@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* gavin@FreeBSD.org (gavin@FreeBSD.org) wrote:

> To submitter:  I'm not sure what the state is of this PR.  It looks like the
> problem has not yet been fixed in FreeBSD 6 or 7, but I don't know if it is
> still an issue with the new USB stack in 8.x.  Do you happen to know if this
> PR is still valid against the new USB stack?  Thanks!

...after some digging....

First of all, my joystick seem to have at least two reports. Report #0
is empty, report #1 has actual axis/button/... data.

With regard to that, usbhidctl is buggy. First of all, static int
reportid variable is never written to but is read in 3 places. It
seems like it's initialized with zero, and thus the utility tries to
work with report #0, giving no data. It seems like reportid should be
initialized to -1 which I suppose reports all report secrs. Also, there
should be a way to select specific report id with command line flags
(likely that was intended usege for this variable).

After initializing reportid to -1 I can get report descriptor, and yes,
answering original question, it is not truncated. Judging from code
rc/lib/libusbhid/descr.c:hid_get_report_desc, the upper limit is now
65535 bytes, which is enough for my device with 1343 byte report descr.

However, after using -1 as reportid, usbhidctl still reports wrong
sizes:

Total   input size 0 bytes
Total  output size 0 bytes
Total feature size 0 bytes

likely that's because hid_report_size() is called with id=0 (not even
reportid). Seems like it doesn't work with id=-1 as well, so the correct
way is likely to get sizes from hid_item structs. In either case,
libusbhid seems to lack a way to get a number of reports to be able to
parse them one by one.

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090825015845.GB26981>