From: Ian Abbott Date: Wed, 12 Aug 2009 16:04:43 +0000 (+0000) Subject: When reading DO subdevice with inverted outputs invert the values read back X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=63a144d56188e96c2c8eddb63208e8798542e0d3;p=comedi.git When reading DO subdevice with inverted outputs invert the values read back from the ports to match the inversion of values written. --- diff --git a/comedi/drivers/ni_65xx.c b/comedi/drivers/ni_65xx.c index ebb45cfa..8abbff99 100644 --- a/comedi/drivers/ni_65xx.c +++ b/comedi/drivers/ni_65xx.c @@ -440,6 +440,12 @@ static int ni_65xx_dio_insn_bits(comedi_device * dev, comedi_subdevice * s, readb(private(dev)->mite->daq_io_addr + Port_Data(port)); // rt_printk("read 0x%x from port %i\n", port_read_bits, port); + if (s->type == COMEDI_SUBD_DO && board(dev)->invert_outputs) { + /* Outputs inverted, so invert value read back from + * DO subdevice. (Does not apply to boards with DIO + * subdevice.) */ + port_read_bits ^= 0xFF; + } if (bitshift > 0) { port_read_bits <<= bitshift; } else {