From: Ian Abbott Date: Thu, 15 Dec 2011 20:08:16 +0000 (+0000) Subject: dt2801: do INSN_CONFIG properly for DIO subdevice X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a18dbb356c974c1a9d84ccc69d3c0a3e80209664;p=comedi.git dt2801: do INSN_CONFIG properly for DIO subdevice Handle INSN_CONFIG_DIO_INPUT, INSN_CONFIG_DIO_OUTPUT and INSN_CONFIG_DIO_QUERY in data[0]. Signed-off-by: Ian Abbott --- diff --git a/comedi/drivers/dt2801.c b/comedi/drivers/dt2801.c index b39550e0..c74c5438 100644 --- a/comedi/drivers/dt2801.c +++ b/comedi/drivers/dt2801.c @@ -686,12 +686,20 @@ static int dt2801_dio_insn_config(comedi_device * dev, comedi_subdevice * s, which = 1; /* configure */ - if (data[0]) { + switch (data[0]) { + case INSN_CONFIG_DIO_OUTPUT: s->io_bits = 0xff; dt2801_writecmd(dev, DT_C_SET_DIGOUT); - } else { + break; + case INSN_CONFIG_DIO_INPUT: s->io_bits = 0; dt2801_writecmd(dev, DT_C_SET_DIGIN); + break; + case INSN_CONFIG_DIO_QUERY: + data[1] = s->io_bits ? COMEDI_OUTPUT : COMEDI_INPUT; + return insn->n; + default: + return -EINVAL; } dt2801_writedata(dev, which);