libusbhid type bias

Chuck Robey chuckr at telenix.org
Sun Jun 8 16:55:14 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've been very slowly reading (and trying to run thru gdb) the item parsing and
fetching/scaling code in libusbhid.  I have to admit I have not yet fully
figured out what's happening, but what I have seen, so far, are a couple of
different comments that the spec isn't clear about the type (signed or unsigned)
of the data.

reading from /usr/src/lib/libusbhid/parse.c:209, "The spec is unclear if the
data is signed or unsigned."  That's only one of the comments I found, all
saying about the same thing.  Least I remember 2 of them.

Well, let  me first admit, right away, this is the spec from hell, and anyone
saying this is a good spec (and I have seen such on the web) are just declaring
themselves as not having enough experience reading specs.  This IS the spec from
hell.  Nevertheless, it IS pretty clear about the type of data.  I refer you to
page 38 of the spec, top paragraph on the page:

_HID spec excerpt, page 38 top:

"Main items are used to either define or group certain types of data fields
within a Report descriptor. There are two types of Main items: data and
non-data. Data-type Main items are used to create a field within a report and
include Input, Output, and Feature. Other items do not create fields and are
subsequently referred to as non-data Main items."

(end spec excerpt)
At least for my data, all the data is definitely unsigned, and it's very
important that this be followed.  I don't think libusbhid is doing this
(although I haven't yet been able to get hid_get_data() to return anything
except 0 so far).  However, realize (like I said) this is a horrible spec, and
one could not blame anyone at all for misreading it.  Even me.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFITAzNz62J6PPcoOkRAljKAJ9dWxTRN1EgKaTR4bEe48cG01UkiQCZAVCv
j8bYvjYWGuvQ92TCMH5XM0o=
=g59X
-----END PGP SIGNATURE-----


More information about the freebsd-usb mailing list