fix for trig emulation by cmd
authorFrank Mori Hess <fmhess@speakeasy.net>
Thu, 5 Jul 2001 15:55:09 +0000 (15:55 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Thu, 5 Jul 2001 15:55:09 +0000 (15:55 +0000)
comedi/trig.c

index 5781ca1bee2febde98f204b9c99445c529a0689b..50421bc02ed4bee403dd2f0bf6de771d6b9a42d5 100644 (file)
@@ -258,10 +258,19 @@ int command_trig(comedi_device *dev,comedi_subdevice *s,comedi_trig *it)
        if(ret)return ret;
 
        ret=s->do_cmdtest(dev,s,&async->cmd);
-       if(ret)return -EINVAL;
+       // let it fix up arguments if necessary
+       if(ret == 3)
+               ret=s->do_cmdtest(dev,s,&async->cmd);
+       if(ret == 4)
+               ret=s->do_cmdtest(dev,s,&async->cmd);
+       if(ret)
+               return -EINVAL;
 
        ret=s->do_cmd(dev,s);
-       if(ret>0)return -EINVAL;
+       if(ret)return -EINVAL;
+
+       // XXX write back changes to trig struct?
+
        return ret;
 }
 
@@ -285,7 +294,7 @@ int mode_to_command(comedi_cmd *cmd,comedi_trig *it)
                cmd->scan_end_arg=it->n_chan;
                cmd->stop_src=TRIG_COUNT;
                cmd->stop_arg=it->n;
-               
+
                break;
        case 2:
                cmd->scan_begin_src=TRIG_TIMER;