make select work when there is no cmd running
authorDavid Schleef <ds@schleef.org>
Thu, 30 Nov 2000 20:29:33 +0000 (20:29 +0000)
committerDavid Schleef <ds@schleef.org>
Thu, 30 Nov 2000 20:29:33 +0000 (20:29 +0000)
comedi/comedi_fops.c

index 15d6a4f1b7f60847f7a1ef02f5f86cab1589aec3..de4ebbca8d8092b0bd9515d5af23c9c1dd90e66e 100644 (file)
@@ -1171,12 +1171,14 @@ static unsigned int comedi_poll_v22(struct file *file, poll_table * wait)
        mask = 0;
        if(dev->read_subdev>=0){
                s=dev->subdevices+dev->read_subdev;
-               if(s->buf_user_count < s->buf_int_count)
+               if(!(s->subdev_flags&SDF_RUNNING) ||
+                  (s->buf_user_count < s->buf_int_count))
                        mask |= POLLIN | POLLRDNORM;
        }
        if(dev->write_subdev>=0){
                s=dev->subdevices+dev->write_subdev;
-               if(s->buf_user_count < s->buf_int_count + s->prealloc_bufsz)
+               if((!s->subdev_flags&SDF_RUNNING) ||
+                  (s->buf_user_count < s->buf_int_count + s->prealloc_bufsz))
                        mask |= POLLOUT | POLLWRNORM;
        }