summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/uvc/uvc_video.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@skynet.be>2009-02-14 23:26:56 +0100
committerLaurent Pinchart <laurent.pinchart@skynet.be>2009-02-14 23:26:56 +0100
commitbdff40c8e0a3b0971c67f28db1b0f9b2fe581313 (patch)
tree5751fa34f99d0a03197b7583f46bd9d1ef7b22a3 /linux/drivers/media/video/uvc/uvc_video.c
parentc76982cfa049632e8def745d7e01cd6fd200db70 (diff)
downloadmediapointer-dvb-s2-bdff40c8e0a3b0971c67f28db1b0f9b2fe581313.tar.gz
mediapointer-dvb-s2-bdff40c8e0a3b0971c67f28db1b0f9b2fe581313.tar.bz2
uvcvideo: Initialize streaming parameters with the probe control value
From: Laurent Pinchart <laurent.pinchart@skynet.be> 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. Priority: normal Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Diffstat (limited to 'linux/drivers/media/video/uvc/uvc_video.c')
-rw-r--r--linux/drivers/media/video/uvc/uvc_video.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/linux/drivers/media/video/uvc/uvc_video.c b/linux/drivers/media/video/uvc/uvc_video.c
index 04c791213..a4034ccb2 100644
--- a/linux/drivers/media/video/uvc/uvc_video.c
+++ b/linux/drivers/media/video/uvc/uvc_video.c
@@ -1030,11 +1030,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