[media] gspca - main: Avoid clobbering all bandwidth when mic in webcam
authorHans de Goede <hdegoede@redhat.com>
Fri, 30 Dec 2011 21:26:53 +0000 (18:26 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 6 Jan 2012 11:05:01 +0000 (09:05 -0200)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c

index 338dae44878706b49f60b3f0cdd32d2577f80acb..4a3bbffafcd4c3ef004d1bc81067f82a19d5fa5b 100644 (file)
@@ -726,6 +726,23 @@ static int build_isoc_ep_tb(struct gspca_dev *gspca_dev,
                ep_tb++;
        }
 
+       /*
+        * If the camera:
+        * has a usb audio class interface (a built in usb mic); and
+        * is a usb 1 full speed device; and
+        * uses the max full speed iso bandwidth; and
+        * and has more than 1 alt setting
+        * then skip the highest alt setting to spare bandwidth for the mic
+        */
+       if (gspca_dev->audio &&
+                       gspca_dev->dev->speed == USB_SPEED_FULL &&
+                       last_bw >= 1000000 &&
+                       i > 1) {
+               PDEBUG(D_STREAM, "dev has usb audio, skipping highest alt");
+               i--;
+               ep_tb--;
+       }
+
        /* get the requested bandwidth and start at the highest atlsetting */
        bandwidth = which_bandwidth(gspca_dev);
        ep_tb--;