Skip to content

Commit

Permalink
staging: comedi: vmk80xx: initialize K8055 outputs to known state
Browse files Browse the repository at this point in the history
vmk8055_reset_device() is called during initialization of a Velleman
K8055 (aka VM110) to send a reset command to the hardware.  I don't know
what this does, but I know that it doesn't reset the digital outputs as
I've tried it.  Since the hardware does not have any way to query the
current output values and there is only the one command to update all
the analog and digital outputs simultaneously (VMK8055_CMD_WRT_AD), send
this command during initialization to set all the analog and digital
outputs to a known state.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Feb 15, 2013
1 parent e8f311a commit f06a23c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/staging/comedi/drivers/vmk80xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,15 @@ static int vmk80xx_write_packet(struct vmk80xx_private *devpriv, int cmd)
static int vmk80xx_reset_device(struct vmk80xx_private *devpriv)
{
size_t size;
int retval;

size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize);
memset(devpriv->usb_tx_buf, 0, size);
return vmk80xx_write_packet(devpriv, VMK8055_CMD_RST);
retval = vmk80xx_write_packet(devpriv, VMK8055_CMD_RST);
if (retval)
return retval;
/* set outputs to known state as we cannot read them */
return vmk80xx_write_packet(devpriv, VMK8055_CMD_WRT_AD);
}

#define DIR_IN 1
Expand Down

0 comments on commit f06a23c

Please sign in to comment.