On Tue, Oct 17, 2006 at 02:51:09PM -0700, Greg KH wrote:
> From: Grant Grundler <[EMAIL PROTECTED]>
> 
> extract() and implement() have brain damaged attempts to handle 32-bit wide
> "fields".

Brain-damaged though they may be, they sure work with my devices a whole
lot better than your "new and improved" version.

> The problem is the index math in the original code didn't clear all the
> relevant bits.  (offset >> 5) only compensated for 32-bit index.  We need
> (offset >> 6) if we want to use 64-bit loads.
> 
> But it was also wrong in that it tried to use quasi-aligned loads.  Ie
> "report" was only incremented in multiples of 4 bytes and then the offset
> was masked off for values greater than 4 bytes.  The right way is to
> pretend "report" points at a byte array.  And offset is then only minor
> adjustment for < 8 bits of offset.  "n" (field width) can then be as big as
> 24 (assuming 32-bit loads) since "offset" will never be bigger than 7.
> 
> If someone needs either function to handle more than 24-bits, please
> document why - point at a specification or specific USB hid device - in
> comments in the code.

Ummm. Ok. How many pages of the HID 1.11 spec shall I paste in?

I'm not sure what makes you think there's some magic 24 bit limit. I see no
limit specified, although in practice I've never seen anything larger than 
32 bits. The size of a report field (in bits) is set by the Report Size 
global item, the data portion of which can be at most a 32 bit integer,
thus giving a maximum field width of 4 Gbits. Clearly taking it that far
would be insane, but limiting it to 24 bits arbitrarily is equally nuts.

I can send report descriptors of devices in my possession which have 32
bit wide fields. I'm the guy who patched the original extract() from 
"& ((1 << n)" to "& ((1ULL << n)" precisely because it didn't work on
such devices, a bug which you've kindly recreated.

Please, revert this patch or fix it to handle 32 bit fields.

--Adam


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to