Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 078a10df authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

Staging: comedi: ni_65xx.c: fix output inversion problem.



When reading DO subdevice with inverted outputs invert the values read
back from the ports to match the inversion of values written.

Signed-off-by: default avatarFrank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2b49d7c4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -457,6 +457,12 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev,
		port_read_bits =
		    readb(private(dev)->mite->daq_io_addr + Port_Data(port));
/* 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 {