]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
V4L/DVB (10650): uvcvideo: Initialize streaming parameters with the probe control...
authorLaurent Pinchart <laurent.pinchart@skynet.be>
Sat, 14 Feb 2009 22:26:56 +0000 (19:26 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:51 +0000 (12:42 -0300)
The UVC specification requires SET_CUR requests on the streaming commit control
to use values retrieved from a successful GET_CUR request on the probe control.
Initialize streaming parameters with the probe control current value to make
sure the driver always complies.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_video.c

index 7ebb89539c363de18b2c856286311383487c145a..9139086f940afef5baeb109e05bf53234d92cf59 100644 (file)
@@ -1026,11 +1026,20 @@ int uvc_video_init(struct uvc_video_device *video)
         */
        usb_set_interface(video->dev->udev, video->streaming->intfnum, 0);
 
-       /* Some webcams don't suport GET_DEF requests on the probe control. We
-        * fall back to GET_CUR if GET_DEF fails.
+       /* Set the streaming probe control with default streaming parameters
+        * retrieved from the device. Webcams that don't suport GET_DEF
+        * requests on the probe control will just keep their current streaming
+        * parameters.
         */
-       if ((ret = uvc_get_video_ctrl(video, probe, 1, GET_DEF)) < 0 &&
-           (ret = uvc_get_video_ctrl(video, probe, 1, GET_CUR)) < 0)
+       if (uvc_get_video_ctrl(video, probe, 1, GET_DEF) == 0)
+               uvc_set_video_ctrl(video, probe, 1);
+
+       /* Initialize the streaming parameters with the probe control current
+        * value. This makes sure SET_CUR requests on the streaming commit
+        * control will always use values retrieved from a successful GET_CUR
+        * request on the probe control, as required by the UVC specification.
+        */
+       if ((ret = uvc_get_video_ctrl(video, probe, 1, GET_CUR)) < 0)
                return ret;
 
        /* Check if the default format descriptor exists. Use the first