All of lore.kernel.org
 help / color / mirror / Atom feed
From: dean <dean@sensoray.com>
To: video4linux-list@redhat.com
Cc: Greg KH <greg@kroah.com>, dean <dean@sensoray.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: VIVI & S2255DRV driver problems
Date: Mon, 08 Dec 2008 10:23:40 -0800	[thread overview]
Message-ID: <493D662C.3030401@sensoray.com> (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:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

                 reply	other threads:[~2008-12-08 18:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=493D662C.3030401@sensoray.com \
    --to=dean@sensoray.com \
    --cc=greg@kroah.com \
    --cc=mchehab@infradead.org \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.