From: Uwe Hermann Date: Sun, 29 Dec 2013 13:09:34 +0000 (+0100) Subject: fx2lafw: Minor cleanups. X-Git-Tag: libsigrok-0.3.0~371 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=87b545fba4d537a255dffcf2d8053908e3847480;p=libsigrok.git fx2lafw: Minor cleanups. --- diff --git a/hardware/fx2lafw/api.c b/hardware/fx2lafw/api.c index 0c591428..29c1887e 100644 --- a/hardware/fx2lafw/api.c +++ b/hardware/fx2lafw/api.c @@ -230,7 +230,7 @@ static GSList *scan(GSList *options) sr_err("Firmware upload failed for " "device %d.", devcnt); sdi->inst_type = SR_INST_USB; - sdi->conn = sr_usb_dev_inst_new (libusb_get_bus_number(devlist[i]), + sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]), 0xff, NULL); } } @@ -291,7 +291,7 @@ static int dev_open(struct sr_dev_inst *sdi) ret = libusb_claim_interface(usb->devhdl, USB_INTERFACE); if (ret != 0) { - switch(ret) { + switch (ret) { case LIBUSB_ERROR_BUSY: sr_err("Unable to claim USB interface. Another " "program or driver has already claimed it."); diff --git a/hardware/fx2lafw/protocol.c b/hardware/fx2lafw/protocol.c index 303118d7..62be7f6d 100644 --- a/hardware/fx2lafw/protocol.c +++ b/hardware/fx2lafw/protocol.c @@ -355,7 +355,7 @@ SR_PRIV struct dev_context *fx2lafw_dev_new(void) devc->fw_updated = 0; devc->cur_samplerate = 0; devc->limit_samples = 0; - devc->sample_wide = 0; + devc->sample_wide = FALSE; return devc; } @@ -432,6 +432,7 @@ SR_PRIV void fx2lafw_receive_transfer(struct libusb_transfer *transfer) int trigger_offset, i, sample_width, cur_sample_count; int trigger_offset_bytes; uint8_t *cur_buf; + uint16_t cur_sample; devc = transfer->user_data; @@ -486,9 +487,9 @@ SR_PRIV void fx2lafw_receive_transfer(struct libusb_transfer *transfer) if (devc->trigger_stage >= 0) { for (i = 0; i < cur_sample_count; i++) { - const uint16_t cur_sample = devc->sample_wide ? - *((const uint16_t*)cur_buf + i) : - *((const uint8_t*)cur_buf + i); + cur_sample = devc->sample_wide ? + *((uint16_t *)cur_buf + i) : + *((uint8_t *)cur_buf + i); if ((cur_sample & devc->trigger_mask[devc->trigger_stage]) == devc->trigger_value[devc->trigger_stage]) {