Skip to contentSkip to conversation

pwc: do not block in VIDIOC_DQBUF

PATCH In review [email protected] 1 participant 2 messages Jul 5, 2008 – Jul 7, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwc: do not block in VIDIOC_DQBUF

I think the ioctl VIDIOC_DQBUF in pwc does not follow the API spec. It should not block if there are no buffers and the device has been opened with O_NONBLOCK.

I am not sure the patch is 100% correct, since I do not understand it completely.

Andrea

_________________________________________________________________
Tiscali Family: Adsl e Telefono senza limiti e senza scatto alla risposta. PER TE CON LO SCONTO DEL 25% FINO AL 2010. In più il software parental control Magic Desktop Basic è GRATIS! Attiva entro il 03/07/08. http://abbonati.tiscali.it/promo/tuttoincluso/

linux/drivers/media/video/pwc/pwc-v4l.c +7 -0
diff -r 87aa6048e718 linux/drivers/media/video/pwc/pwc-v4l.c
@@ -1134,6 +1134,13 @@
 				     frameq is safe now.
 			 */
 			add_wait_queue(&pdev->frameq, &wait);
+
+			if ((pdev->full_frames == NULL) && (file->f_flags & O_NONBLOCK)) {
+				remove_wait_queue(&pdev->frameq, &wait);
+				set_current_state(TASK_RUNNING);
+				return -EAGAIN;
+			}
+
 			while (pdev->full_frames == NULL) {
 				if (pdev->error_status) {
 					remove_wait_queue(&pdev->frameq, &wait);

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

author
#1 lore raw
Quoted 6 lines · [email protected] wrote:

I think the ioctl VIDIOC_DQBUF in pwc does not follow the API spec.
It should not block if there are no buffers and the device has been opened with O_NONBLOCK.

I am not sure the patch is 100% correct, since I do not understand it completely.

Andrea

Anybody to review this patch?

The documentation of VIDIOC_DQBUF is at

http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec/r8849.htm

linux/drivers/media/video/pwc/pwc-v4l.c Mon Jul 07 21:17:49 2008 +0100 renamed from linux/drivers/media/video/pwc/pwc-v4l.c Wed Jul 02 08:59:38 2008 -0300 +7 -0
diff -r 87aa6048e718 linux/drivers/media/video/pwc/pwc-v4l.c
@@ -1134,6 +1136,13 @@
                                     frameq is safe now.
                         */
                        add_wait_queue(&pdev->frameq, &wait);
+
+                       if ((pdev->full_frames == NULL) && (file->f_flags & O_NONBLOCK)) {
+                               remove_wait_queue(&pdev->frameq, &wait);
+                               set_current_state(TASK_RUNNING);
+                               return -EAGAIN;
+                       }
+
                        while (pdev->full_frames == NULL) {
                                if (pdev->error_status) {
                                        remove_wait_queue(&pdev->frameq, &wait);

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list