Greg:

Here's a policy question for you.

Apparently some devices put extra garbage at the end of their
configuration information.  For the particular device considered here,
there's a device descriptor followed by an illegal length-1 descriptor.  
(Note that configuration information should never include a device
descriptor -- or a configuration descriptor anywhere but at the start, for
that matter.)

If we encounter this sort of thing, should we reject the entire device?  
Or should we simply stop parsing the configuration information at that 
point?  Doing that is fairly safe, because if we end up ignoring something 
important (like more interface descriptors) the error will be caught later 
on.

My feeling is that nothing would go wrong if we did this, and it would
allow us to work with some not-entirely-up-to-spec devices.  That holds
regardless of the descriptor type in the garbage bytes.  But of course
it's your decision.

Alan Stern


On Sun, 28 Dec 2003, Ashley Reed wrote:

> On Sun, 2003-12-28 at 10:38, Alan Stern wrote:
> > It certainly sounds like your device puts some extra garbage in its 
> > descriptors.
> 
> I think you're right.  After the USB_DT_DEVICE descriptor is the
> descriptor of length 1.  Then there is nothing else.
> 
> > Try this patch.  Instead of returning an error when it encounters one of 
> > these unexpected descriptor types, it will merely log a warning and skip 
> > any remaining descriptors (that's if I didn't make any mistakes -- I 
> > haven't tested it myself).  Maybe this will be enough to get your device 
> > to work again.
> 
> Your patch works great, and I think it is a little safer than the hack I
> was using.  I changed it just a little to only break when there is an
> extra USB_DT_DEVICE descriptor.  Here's the patch if you care.
> 
> I wonder how many other devices don't work b/c of the reason my game pad
> doesn't work?  Maybe something like this should go into an FAQ or a
> /proc option for relaxed descriptor checking.
> 
> Thanks,
> Ashley
> 
> 
> --- linux-2.6.0-3/drivers/usb/core/config.c.orig      2003-12-28
> 12:37:52.594663600 -0600
> +++ linux-2.6.0-3/drivers/usb/core/config.c   2003-12-28
> 13:06:54.428864552 -0600
> @@ -271,6 +271,12 @@
>               } else if ((header->bDescriptorType == USB_DT_DEVICE ||
>                   header->bDescriptorType == USB_DT_CONFIG) && j) {
>                       warn("unexpected descriptor type 0x%X", 
> header->bDescriptorType);
> +                     if(header->bDescriptorType == USB_DT_DEVICE) {
> +                             warn("skipping rest of the device descriptor");
> +                             size = buffer2 - buffer;
> +                             break;
> +                     }
> +
>                       return -EINVAL;
>               }
>  
> 
> 
> 



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&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