Re: [PATCH] staging/comedi: Fix undefined array subscript

From: Ian Abbott
Date: Wed Feb 13 2013 - 08:47:19 EST


On 2013-02-13 11:56, Ian Abbott wrote:
For a digital output subdevice, you could either read back the current
values directly from the hardware or just use the value previously
written. The Velleman K8055 doesn't have a command to read back the
digital outputs from the hardware, so the last written value has to be
used. But what if the digital outputs have never been written (or the
analog outputs have never been written, since the same command updates
all analog and digital channels)? A "reset" command is sent to the
hardware on initialization by vmk80xx_reset_device() (only called for
the K8055), but I don't know what effect this has on the actual digital
(and analog) outputs (though I could find out easily enough as we appear
to have one of these kits (assembled) lying around in the office). If
necessary, we may have to also send a "write" command on initialization
to make the hardware outputs match the initial software state.

I've had a quick play with a K8055 and it seems the "reset" command issued during hardware initialization has no effect on the digital outputs. (I tested this by setting some digital outputs with comedi instructions - there are some handy LEDs on the board that light up or not according to the state of the digital outputs - then rmmod'ing and modprobe'ing the vmk80xx module - the LEDs remained in the same state.)

Since we can't read back the outputs on this board we should initialize them to a known state. I'll submit some patches later.

Nothing to do with the patch in this thread, which has my Ack.

Acked-by: Ian Abbott <abbotti@xxxxxxxxx>

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/