On Fri, 1 Apr 2005, Johannes Berg wrote:

> Hi,
> 
> I have this little driver for the new PowerBook's trackpad (all on
> http://johannes.sipsolutions.net/PowerBook/touchpad/driver)
> 
> Currently, it does nothing much but submit URBs and push the received
> data into userspace, I built it based on usb-skeleton.c. Once userspace
> reads the data, it resubmits the URB as the trackpad sends data all the
> time.
> 
> It uses
>   le16_to_cpu(endpoint->wMaxPacketSize);
> to know the buffer size for a specific endpoint. I don't know if that is
> correct, but that's what I currently do.
> 
> Now, on 2.6.10 that returns 8192. Obviously not a good buffer size for
> an interrupt transfer which can according to the docs only have 64
> bytes. OTOH, on 2.6.10, my driver receives 81 bytes in the interrupt
> transfer.
> 
> On 2.6.11 (.5 and .6) however, it receives one 64 byte in interrupt
> transfer, and one 17 byte transfer.
> 
> Now, this is entirely manageable, but I'm wondering which behaviour is
> correct and why I'm seeing this discrepancy.

There's a very simple explanation.  In 2.6.10 and earlier the 
wMaxPacketSize value is stored in native byte order, whereas in 2.6.11 and 
later it's stored in little-endian byte order.  So your code is getting 
the correct value under 2.6.11 and a byte-reversed value under 2.6.10.

Alan Stern



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to