- From: <rhk_at_newimage.com>
- Date: Wed, 09 Oct 2002 17:09:35 -0700
Message-Id: <20021010000933.D2E2EE034_at_newimage.com>
Date: Wed, 9 Oct 2002 20:09:33 -0400 (EDT)
From: rhk_at_newimage.com (Apache User)
I found a problem with long-term analog input and output streaming
when using select() or poll() to determine when to send data.
When sampling at 1Mhz, the counters used to determine buffer space
wrap around every 35 minutes. At some point, buf_write_count wraps
and becomes less than buf_read_count, so select() never indicates
that data is available, and eventually the buffer will fill up with
data from the card, and an overflow will occur.
The problem is in the comedi_poll_v22() function. I've sent a patch
which I seems to have fixed the problem for me. Further testing would
be a good idea.
This bug will probably affect all drivers, since it's in the base
comedi file operations code.
-Ray
--SNIP--
diff -ru2 comedi_fops.c.orig comedi_fops.c
--- comedi_fops.c.orig 2002-07-25 19:45:33.000000000 -0400
+++ comedi_fops.c 2002-10-09 19:52:56.000000000 -0400
_at__at_ -1279,5 +1279,5 _at__at_
async = s->async;
if(!s->busy ||
- (async->buf_read_count < async->buf_write_count) ||
+ (async->buf_read_count != async->buf_write_count) ||
!(s->subdev_flags&SDF_RUNNING)){
mask |= POLLIN | POLLRDNORM;
_at__at_ -1289,6 +1289,5 _at__at_
if(!s->busy ||
!(s->subdev_flags&SDF_RUNNING) ||
- (async->buf_write_count < async->buf_read_count +
- async->prealloc_bufsz)){
+ (async->buf_read_count != async->buf_free_count)){
mask |= POLLOUT | POLLWRNORM;
}
--SNIP--
Received on 2002-10-09Z23:09:35