Added implementation of comedi_poll(). This function may be useful
authorDavid Schleef <ds@schleef.org>
Tue, 6 Nov 2001 22:16:09 +0000 (22:16 +0000)
committerDavid Schleef <ds@schleef.org>
Tue, 6 Nov 2001 22:16:09 +0000 (22:16 +0000)
in the core, although presumably the behavior should be different
if the driver doesn't implement poll.

comedi/drivers/comedi_rt_timer.c

index 2d94bf1249cc62e63aff422598ec39ab0197da1b..bf2dcb577b57bb6748df1d3087110a1af7886042 100644 (file)
@@ -567,6 +567,13 @@ static int timer_start_cmd(comedi_device *dev, comedi_subdevice *s)
        return 0;
 }
 
+static int timer_poll(comedi_device *dev,comedi_subdevice *s)
+{
+       /* This it pretty generic code, perhaps it should be the
+        * default for any subdevice that doesn't implement poll. */
+       return s->async->buf_int_count - s->async->buf_user_count;
+}
+
 static int timer_attach(comedi_device *dev,comedi_devconfig *it)
 {
        int ret;
@@ -603,6 +610,7 @@ static int timer_attach(comedi_device *dev,comedi_devconfig *it)
 
        // input or output subdevice
        s=dev->subdevices+0;
+       s->poll=timer_poll;
        if(emul_s->type == COMEDI_SUBD_AI)
        {
                s->type=emul_s->type;