force read from channel 0 when CR_ALT_SRC is set in ai read insn.
authorFrank Mori Hess <fmhess@speakeasy.net>
Sun, 6 Feb 2005 16:06:00 +0000 (16:06 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sun, 6 Feb 2005 16:06:00 +0000 (16:06 +0000)
comedi/drivers/cb_pcidas.c

index 589a36d0270282c217dc03412afbd3997a8ab695..aec68c2b02d1d0e3c5f0d88b81507c6a2988ab2b 100644 (file)
@@ -783,17 +783,21 @@ static int cb_pcidas_ai_rinsn(comedi_device *dev, comedi_subdevice *s,
        int n,i;
        unsigned int bits;
        static const int timeout = 10000;
-
+       int channel;
        // enable calibration input if appropriate
        if( insn->chanspec & CR_ALT_SOURCE )
+       {
                outw( cal_enable_bits( dev ),
                        devpriv->control_status + CALIBRATION_REG);
-       else
+               channel = 0;
+       }else
+       {
                outw( 0, devpriv->control_status + CALIBRATION_REG);
-
+               channel = CR_CHAN(insn->chanspec);
+       }
        // set mux limits and gain
-       bits = BEGIN_SCAN(CR_CHAN(insn->chanspec)) |
-               END_SCAN(CR_CHAN(insn->chanspec)) |
+       bits = BEGIN_SCAN(channel) |
+               END_SCAN(channel) |
                GAIN_BITS(CR_RANGE(insn->chanspec));
        // set unipolar/bipolar
        if(CR_RANGE(insn->chanspec) & IS_UNIPOLAR)