From 9953b1e1ac35d0bd23e090371c4bce2c2a2398fb Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 13 Mar 2001 09:25:45 +0000 Subject: [PATCH] added comedi_poll() --- comedi/kcomedilib/kcomedilib_main.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/comedi/kcomedilib/kcomedilib_main.c b/comedi/kcomedilib/kcomedilib_main.c index fd694ec9..6fa22948 100644 --- a/comedi/kcomedilib/kcomedilib_main.c +++ b/comedi/kcomedilib/kcomedilib_main.c @@ -908,3 +908,32 @@ int comedi_register_callback(unsigned int minor,unsigned int subdev, } +int comedi_poll(unsigned int minor, unsigned int subdev) +{ + comedi_device *dev; + comedi_subdevice *s; + comedi_async *async; + int ret; + + if((ret=minor_to_dev(minor,&dev))<0) + return ret; + + if(subdev>=dev->n_subdevices) + return -ENODEV; + + s=dev->subdevices+subdev; + async = s->async; + if(s->type==COMEDI_SUBD_UNUSED || !async) + return -EIO; + + /* are we locked? (ioctl lock) */ + if(s->lock && s->lock!=&rtcomedi_lock_semaphore) + return -EACCES; + + /* are we running? XXX wrong? */ + if(!s->busy) + return -EIO; + + return s->poll(dev,s); +} + -- 2.26.2