From: David Schleef Date: Tue, 13 Mar 2001 09:25:45 +0000 (+0000) Subject: added comedi_poll() X-Git-Tag: r0_7_58~62 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9953b1e1ac35d0bd23e090371c4bce2c2a2398fb;p=comedi.git added comedi_poll() --- 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); +} +