[media] uvcvideo: Fix alternate setting selection
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 21 Jun 2012 09:35:04 +0000 (06:35 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 6 Jul 2012 18:26:47 +0000 (15:26 -0300)
The alternate setting number is not equal to the alternate setting index
in the interface alternate settings table. Use the alternate setting
number from the interface descriptor when calling usb_set_interface().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_video.c

index 39f5c85dd4b4e5c5e5c8a5c00805411a991c276e..7ac4347ca09e72dc4bb2abb751779f3053a338c7 100644 (file)
@@ -1598,7 +1598,7 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags)
                        psize = le16_to_cpu(ep->desc.wMaxPacketSize);
                        psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
                        if (psize >= bandwidth && psize <= best_psize) {
-                               altsetting = i;
+                               altsetting = alts->desc.bAlternateSetting;
                                best_psize = psize;
                                best_ep = ep;
                        }