public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwc: do not block in VIDIOC_DQBUF
@ 2008-07-05 13:23 audetto
  2008-07-07 20:21 ` Andrea
  0 siblings, 1 reply; 2+ messages in thread
From: audetto @ 2008-07-05 13:23 UTC (permalink / raw)
  To: video4linux-list

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

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/ 

[-- Attachment #2: pwc.diff --]
[-- Type: application/octet-stream, Size: 622 bytes --]

diff -r 87aa6048e718 linux/drivers/media/video/pwc/pwc-v4l.c
--- a/linux/drivers/media/video/pwc/pwc-v4l.c	Wed Jul 02 08:59:38 2008 -0300
+++ b/linux/drivers/media/video/pwc/pwc-v4l.c	Sat Jul 05 14:14:03 2008 +0100
@@ -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);

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] pwc: do not block in VIDIOC_DQBUF
  2008-07-05 13:23 [PATCH] pwc: do not block in VIDIOC_DQBUF audetto
@ 2008-07-07 20:21 ` Andrea
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea @ 2008-07-07 20:21 UTC (permalink / raw)
  To: video4linux-list

audetto@tiscali.it 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

diff -r 87aa6048e718 linux/drivers/media/video/pwc/pwc-v4l.c
--- a/linux/drivers/media/video/pwc/pwc-v4l.c   Wed Jul 02 08:59:38 2008 -0300
+++ b/linux/drivers/media/video/pwc/pwc-v4l.c   Mon Jul 07 21:17:49 2008 +0100
@@ -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:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-07 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-05 13:23 [PATCH] pwc: do not block in VIDIOC_DQBUF audetto
2008-07-07 20:21 ` Andrea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox