On Wed, 15 Jun 2005, Pete Zaitcev wrote:

> On Sat, 11 Jun 2005 10:15:16 -0400 (EDT), Alan Stern <[EMAIL PROTECTED]> 
> wrote:
> 
> > There's nothing wrong with introducing the USB_DT_STRING_SIZE constant, 
> > and I have no objection to adding a new call to usb_get_string with a 
> > request size of 256.  But please don't remove the 255-byte call.  If you 
> > like, add a comment explaining why it's there.
> 
> Makes sense. I don't need an extra call, everything works as it is.
> How about this:
> 
> diff -urp -X dontdiff linux-2.6.12-rc6/drivers/usb/core/message.c 
> linux-2.6.12-rc6-lem/drivers/usb/core/message.c
> --- linux-2.6.12-rc6/drivers/usb/core/message.c       2005-06-06 
> 13:44:37.000000000 -0700
> +++ linux-2.6.12-rc6-lem/drivers/usb/core/message.c   2005-06-15 
> 12:13:52.000000000 -0700
> @@ -658,8 +658,12 @@ static int usb_string_sub(struct usb_dev
>  {
>       int rc;
>  
> -     /* Try to read the string descriptor by asking for the maximum
> -      * possible number of bytes */
> +     /*
> +      * Try to read the string descriptor by asking for the maximum
> +      * possible number of bytes.
> +      * A request for an odd number of bytes of a UTF-16 string
> +      * may seem odd, but this is what Windows does, so let's be safe.
> +      */
>       rc = usb_get_string(dev, langid, index, buf, 255);
>  
>       /* If that failed try to read the descriptor length, then
> 
> Signed-off-by: Pete Zaitcev <[EMAIL PROTECTED]>

That looks good.  Someone at Microsoft may have been thinking of the 
bLength value in the descriptor header.  Since it's a single byte, it 
can't hold anything larger than 255.

Alan Stern



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&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