From c2f35321b343e936400e8059c1f2112177d25b9c Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Thu, 8 Jun 2017 16:47:57 -0600 Subject: [PATCH] fx2lafw/dslogic: Fixed dslogic_set_vth package structure --- src/hardware/fx2lafw/dslogic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hardware/fx2lafw/dslogic.c b/src/hardware/fx2lafw/dslogic.c index 80c0986f..9c74ff1a 100644 --- a/src/hardware/fx2lafw/dslogic.c +++ b/src/hardware/fx2lafw/dslogic.c @@ -40,15 +40,15 @@ SR_PRIV int dslogic_set_vth(const struct sr_dev_inst *sdi, double vth) { struct sr_usb_dev_inst *usb; int ret; - uint8_t cmd; + const uint8_t value = (vth / 5.0) * 255; + const uint16_t cmd = value | (DS_ADDR_VTH << 8); usb = sdi->conn; - cmd = (vth / 5.0) * 255; - /* Send the control command. */ - ret = libusb_control_transfer(usb->devhdl, LIBUSB_REQUEST_TYPE_VENDOR | - LIBUSB_ENDPOINT_OUT, DS_CMD_WR_REG, 0x0000, 0x0000, + ret = libusb_control_transfer(usb->devhdl, + LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT, + DS_CMD_WR_REG, 0x0000, 0x0000, (unsigned char *)&cmd, sizeof(cmd), 3000); if (ret < 0) { sr_err("Unable to send VTH command: %s.",