On Wed, 11 Oct 2006, Iñaky Pérez-González wrote:

> On Wednesday 11 October 2006 07:22, Alan Stern wrote:
> > On Mon, 9 Oct 2006, Inaky Perez-Gonzalez wrote:
> 
> > >
> > >     pseudo allocates buffer 'maxp' bytes in size using usb_maxpacket()
> > >       [?? which gets the max packet size from the interrupt
> > >       endpoint]. That's maybe not as proper. According to the spec
> > >       (see below) the amount of data to read for the hub status is
> > >       (PORTS + 1 + 7) / 8 bytes.
> >
> > That is the amount of data the hub is _supposed_ to send.  Some hubs have
> > been known to send more.  Using the maxpacket size helps to avoid
> > EOVERFLOW errors.
> 
> Huh, so that *is* the reason -- then it'd be a good idea to document 
> it in the code, so the next guy who goes around it doesn't try to do 
> the same thing I did.

Agreed, it should be commented.

> And on the way there, check that the maxpacketsize is bigger or equal
> to (PORTS + 1 + 7) / 8 and flag a warning otherwise.

If you like, although until now I've never heard of that failing.

> > It's a static array defined near the beginning of drivers/usb/core/hcd.c.
> 
> How about I change the maxpacketsize definition to be (USB_MAXCHILDREN + 
> 1 + 7) / 8? That way we won't have to worry about it any more (and I doubt
> it'll ever go over 255 ... so we don't have to worry about endianess either.

> I am guessing you refer to changing the value in the static array, right?

Yes, that sounds good.  Would you mind adding the "maxpacket" comment as 
well?

Alan Stern


-------------------------------------------------------------------------
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