aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@skynet.be>2008-11-12 09:46:43 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:36 -0500
commit23867b2511140ae5693587d2b15badbcc632e3cc (patch)
treee49a03ae6392882708c59aac447998fc18c059c1 /drivers/media/video
parent9bc6218dc1dc7bd421f3d141241c8e0e70c4e92b (diff)
V4L/DVB (9661): uvcvideo: Commit streaming parameters when enabling the video stream
Sonix-based cameras seem to require the host to commit video streaming parameters before selecting the alternate endpoint. While most applications issue a VIDIOC_S_FMT ioctl before starting streaming, this is not required by the V4L2 specification. The problem has been noticed on Ubuntu 8.10 with applications using libv4l. The library blocks VIDIOC_S_FMT calls when the requested format is identical to the currently selected format. As the driver commits video streaming parameters when initialising the device, only the first run of a libv4l-enabled application would succeed. For the sake of completeness, experiment showed that the camera keeps sending 12 bytes isochronous packets (header only, no data) without toggling the FID bit if video streaming parameters haven't been committed before selecting the alternate endpoint. Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/uvc/uvc_v4l2.c7
-rw-r--r--drivers/media/video/uvc/uvc_video.c9
2 files changed, 5 insertions, 11 deletions
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index 624bf74de67..01b48a87a9b 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -252,9 +252,6 @@ static int uvc_v4l2_set_format(struct uvc_video_device *video,
252 if (ret < 0) 252 if (ret < 0)
253 return ret; 253 return ret;
254 254
255 if ((ret = uvc_commit_video(video, &probe)) < 0)
256 return ret;
257
258 memcpy(&video->streaming->ctrl, &probe, sizeof probe); 255 memcpy(&video->streaming->ctrl, &probe, sizeof probe);
259 video->streaming->cur_format = format; 256 video->streaming->cur_format = format;
260 video->streaming->cur_frame = frame; 257 video->streaming->cur_frame = frame;
@@ -315,10 +312,6 @@ static int uvc_v4l2_set_streamparm(struct uvc_video_device *video,
315 if ((ret = uvc_probe_video(video, &probe)) < 0) 312 if ((ret = uvc_probe_video(video, &probe)) < 0)
316 return ret; 313 return ret;
317 314
318 /* Commit the new settings. */
319 if ((ret = uvc_commit_video(video, &probe)) < 0)
320 return ret;
321
322 memcpy(&video->streaming->ctrl, &probe, sizeof probe); 315 memcpy(&video->streaming->ctrl, &probe, sizeof probe);
323 316
324 /* Return the actual frame period. */ 317 /* Return the actual frame period. */
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index e07bee98a00..186ef9fad80 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -889,7 +889,7 @@ int uvc_video_resume(struct uvc_video_device *video)
889 889
890 video->frozen = 0; 890 video->frozen = 0;
891 891
892 if ((ret = uvc_set_video_ctrl(video, &video->streaming->ctrl, 0)) < 0) { 892 if ((ret = uvc_commit_video(video, &video->streaming->ctrl)) < 0) {
893 uvc_queue_enable(&video->queue, 0); 893 uvc_queue_enable(&video->queue, 0);
894 return ret; 894 return ret;
895 } 895 }
@@ -970,11 +970,8 @@ int uvc_video_init(struct uvc_video_device *video)
970 break; 970 break;
971 } 971 }
972 972
973 /* Commit the default settings. */
974 probe->bFormatIndex = format->index; 973 probe->bFormatIndex = format->index;
975 probe->bFrameIndex = frame->bFrameIndex; 974 probe->bFrameIndex = frame->bFrameIndex;
976 if ((ret = uvc_set_video_ctrl(video, probe, 0)) < 0)
977 return ret;
978 975
979 video->streaming->cur_format = format; 976 video->streaming->cur_format = format;
980 video->streaming->cur_frame = frame; 977 video->streaming->cur_frame = frame;
@@ -1014,6 +1011,10 @@ int uvc_video_enable(struct uvc_video_device *video, int enable)
1014 if ((ret = uvc_queue_enable(&video->queue, 1)) < 0) 1011 if ((ret = uvc_queue_enable(&video->queue, 1)) < 0)
1015 return ret; 1012 return ret;
1016 1013
1014 /* Commit the streaming parameters. */
1015 if ((ret = uvc_commit_video(video, &video->streaming->ctrl)) < 0)
1016 return ret;
1017
1017 return uvc_init_video(video, GFP_KERNEL); 1018 return uvc_init_video(video, GFP_KERNEL);
1018} 1019}
1019 1020