All of lore.kernel.org
 help / color / mirror / Atom feed
* VIVI & S2255DRV driver problems
@ 2008-12-08 18:23 dean
  0 siblings, 0 replies; only message in thread
From: dean @ 2008-12-08 18:23 UTC (permalink / raw)
  To: video4linux-list; +Cc: Greg KH, dean, Mauro Carvalho Chehab

Hi,

In non-blocking mode, the vivi driver and s2255drv drivers seem to 
require a poll or select call in order for VIDIOC_DQBUF to function 
correctly.  This seems like a bug in the drivers themselves or possibly 
in the API.  The workaround is to always call poll with a zero timeout 
before a VIDIOC_DQBUF call.  However, this should not necessarily be a 
requirement for non-blocking mode.

To reproduce, please see the code below replacing the mainloop function 
from the standard capture.c file:  Tested with v4l-dvb-291a596b7f34 from 
linuxtv.org mercurial and the 2.6.27 kernel.

standard capture.c file modification:

static void
mainloop                        (void)
{
	unsigned int count;
         count = 100;
         while (count-- > 0) {
                 for (;;) {
		  /* What if we don't want to use select or poll */
#if 0
                         fd_set fds;
                         struct timeval tv;
                         int r;
                         FD_ZERO (&fds);
                         FD_SET (fd, &fds);
                         /* Timeout. */
                         tv.tv_sec = 0;
                         tv.tv_usec = 1;
                         r = select (fd + 1, &fds, NULL, NULL, &tv);
                         if (-1 == r) {
                                 if (EINTR == errno)
                                         continue;
                                 errno_exit ("select");
                         }
                         if (0 == r) {
                                 fprintf (stderr, "select timeout\n");
				//                                exit (EXIT_FAILURE);
                         }
#endif
			if (read_frame ())
                     		break;
			/* EAGAIN - continue select loop. */
			/* If we aren't using select or poll, we should
			   be able to just sleep and try again. But with
			   the VIVI driver and possibly others,
			   DQBUF will always return
			   EAGAIN and we are stuck in this infinite loop.   select or poll 
seems to be required for			   non-blocking operation.
			*/
			//printf("eagain\n");
			usleep(25*1000);
                 }
         }
}

--
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] only message in thread

only message in thread, other threads:[~2008-12-08 18:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-08 18:23 VIVI & S2255DRV driver problems dean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.