Skip to contentSkip to conversation

VIVI & S2255DRV driver problems

DISCUSSION dean 1 participant 1 message Dec 8, 2008 Media (V4L/DVB)

lore
Share & tools
lore

dean

author
#0 lore raw

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list