added comedi_poll()
authorDavid Schleef <ds@schleef.org>
Tue, 13 Mar 2001 09:25:45 +0000 (09:25 +0000)
committerDavid Schleef <ds@schleef.org>
Tue, 13 Mar 2001 09:25:45 +0000 (09:25 +0000)
comedi/kcomedilib/kcomedilib_main.c

index fd694ec96610bafc56772e5024c274b89ab02b55..6fa229481dbf4d2d90b52e72b7881a6e84dacebf 100644 (file)
@@ -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);
+}
+