Re: Certain cameras no longer working with uvcvideo on recent (openSUSE) kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alan,

On Fri, Jan 03, 2020 at 10:13:29AM -0500, Alan Stern wrote:
> On Fri, 3 Jan 2020, Laurent Pinchart wrote:
> 
> > I've investigated this a bit further.
> > 
> > UVC defines class-specific interface descriptors that are usually
> > located right after the standard interface descriptor in altsetting 0.
> > The uvcvideo driver accesses those descriptor through
> > intf->altsetting[0].extra. However, some devices insert an isochronous
> > endpoint descriptor with wMaxPAcketSize set to 0 between the standard
> > interface descriptor and the UVC class-specific interface descriptors.
> > 
> > Before your patch, these descriptors were recorded in the extra field of
> > the endpoint, as they're located right after it:
> > 
> > static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
> >     int asnum, struct usb_host_interface *ifp, int num_ep,
> >     unsigned char *buffer, int size)
> > {
> > ...
> >         /* Skip over any Class Specific or Vendor Specific descriptors;
> >          * find the next endpoint or interface descriptor */
> >         endpoint->extra = buffer;
> >         i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT,
> >                         USB_DT_INTERFACE, &n);
> >         endpoint->extralen = i;
> > ...
> > }
> > 
> > The uvcvideo driver looks at endpoint->extra when altsetting[0] has no
> > extra data.
> > 
> > With your patch, the endpoint is skipped, and the class-specific
> > interface descriptors are dropped with it. The uvcvideo driver can't
> > access them and fails.
> 
> Ah, a very tricky and unexpected interaction!
> 
> > One solution may be to add to altsetting[0].extra all the extra
> > class-specific descriptors, regardless of whether they're located before
> > or after endpoints. I however fear we may not always be able to identify
> > those descriptors properly, especially with the CS_INTERFACE descriptor
> > type being defined in class specifications, not in the USB core
> > specification. There's also a risk of breaking working devices if we do
> > so (the uvcvideo driver should be able to cope, but other drivers may
> > always look for descriptors in the endpoint).
> 
> With the patch I posted yesterday, everything should go back to working 
> the way it used to.  Have you had a chance to test it?

I don't have any camera affected by this issue, so I can't test it I'm
afraid. Roger, would you be able to give it a try ?

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux