if(n==0){
if(!(s->subdev_flags&SDF_RUNNING)){
do_become_nonbusy(dev,s);
- retval=-EINVAL;
+ if(s->runflags & SRF_ERROR){
+ retval = -EIO;
+ }else{
+ retval = 0;
+ }
break;
}
if(file->f_flags&O_NONBLOCK){
if(async->buf_int_count - async->buf_user_count > async->data_len){
async->buf_user_count = async->buf_int_count;
async->buf_user_ptr = async->buf_int_ptr;
- retval=-EINVAL;
+ retval=-EIO;
do_cancel(dev, dev->read_subdev);
DPRINTK("buffer overrun\n");
break;
buf+=n;
break; /* makes device work like a pipe */
}
- if(!(s->subdev_flags&SDF_RUNNING) && async->buf_int_count-async->buf_user_count==0){
+ if(!(s->subdev_flags&SDF_RUNNING) &&
+ !(s->runflags & SRF_ERROR))
+ {
do_become_nonbusy(dev,s);
}
current->state=TASK_RUNNING;
if(mask&COMEDI_CB_EOA){
s->subdev_flags &= ~SDF_RUNNING;
}
+
+ /* remember if an error event has occured, so an error
+ * can be returned the next time the user does a read() */
+ if(mask & COMEDI_CB_ERROR){
+ s->runflags |= SRF_ERROR;
+ }
}
/*
void comedi_proc_init(void);
void comedi_proc_cleanup(void);
-
+// subdevice runflags
#define SRF_USER 0x00000001
#define SRF_RT 0x00000002
-
+// indicates an COMEDI_CB_ERROR event has occurred since the last command was started
+#define SRF_ERROR 0x00000004
/*
various internal comedi functions