From: Frank Mori Hess Date: Fri, 30 Mar 2001 20:18:14 +0000 (+0000) Subject: fixed bug that was preventing read insn from being emulated by insn_emulate_bits() X-Git-Tag: r0_7_58~29 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fb8f05da9881d26eda228fc2017576ae65271853;p=comedi.git fixed bug that was preventing read insn from being emulated by insn_emulate_bits() --- diff --git a/comedi/drivers.c b/comedi/drivers.c index f4b7d980..aa82e91b 100644 --- a/comedi/drivers.c +++ b/comedi/drivers.c @@ -468,7 +468,11 @@ static int insn_emulate_bits(comedi_device *dev,comedi_subdevice *s, return -EINVAL; new_data[0] = 1<insn == INSN_READ){ + if(!(s->subdev_flags & SDF_READABLE)) + return -EINVAL; + data[0] = (new_data[1]>>chan)&1; + }else { new_data[0] = 0; new_data[1] = 0; } @@ -476,12 +480,6 @@ static int insn_emulate_bits(comedi_device *dev,comedi_subdevice *s, ret = s->insn_bits(dev,s,&new_insn,new_data); if(ret<0)return ret; - if(insn->insn == INSN_READ){ - if(!(s->subdev_flags & SDF_WRITEABLE)) - return -EINVAL; - data[0] = (new_data[1]>>chan)&1; - } - return 1; }