fx2lafw: Minor cleanups.

This commit is contained in:
Uwe Hermann 2013-12-29 14:09:34 +01:00
parent 0709197deb
commit 87b545fba4
2 changed files with 7 additions and 6 deletions

View File

@ -230,7 +230,7 @@ static GSList *scan(GSList *options)
sr_err("Firmware upload failed for " sr_err("Firmware upload failed for "
"device %d.", devcnt); "device %d.", devcnt);
sdi->inst_type = SR_INST_USB; 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); 0xff, NULL);
} }
} }
@ -291,7 +291,7 @@ static int dev_open(struct sr_dev_inst *sdi)
ret = libusb_claim_interface(usb->devhdl, USB_INTERFACE); ret = libusb_claim_interface(usb->devhdl, USB_INTERFACE);
if (ret != 0) { if (ret != 0) {
switch(ret) { switch (ret) {
case LIBUSB_ERROR_BUSY: case LIBUSB_ERROR_BUSY:
sr_err("Unable to claim USB interface. Another " sr_err("Unable to claim USB interface. Another "
"program or driver has already claimed it."); "program or driver has already claimed it.");

View File

@ -355,7 +355,7 @@ SR_PRIV struct dev_context *fx2lafw_dev_new(void)
devc->fw_updated = 0; devc->fw_updated = 0;
devc->cur_samplerate = 0; devc->cur_samplerate = 0;
devc->limit_samples = 0; devc->limit_samples = 0;
devc->sample_wide = 0; devc->sample_wide = FALSE;
return devc; 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, i, sample_width, cur_sample_count;
int trigger_offset_bytes; int trigger_offset_bytes;
uint8_t *cur_buf; uint8_t *cur_buf;
uint16_t cur_sample;
devc = transfer->user_data; devc = transfer->user_data;
@ -486,9 +487,9 @@ SR_PRIV void fx2lafw_receive_transfer(struct libusb_transfer *transfer)
if (devc->trigger_stage >= 0) { if (devc->trigger_stage >= 0) {
for (i = 0; i < cur_sample_count; i++) { for (i = 0; i < cur_sample_count; i++) {
const uint16_t cur_sample = devc->sample_wide ? cur_sample = devc->sample_wide ?
*((const uint16_t*)cur_buf + i) : *((uint16_t *)cur_buf + i) :
*((const uint8_t*)cur_buf + i); *((uint8_t *)cur_buf + i);
if ((cur_sample & devc->trigger_mask[devc->trigger_stage]) == if ((cur_sample & devc->trigger_mask[devc->trigger_stage]) ==
devc->trigger_value[devc->trigger_stage]) { devc->trigger_value[devc->trigger_stage]) {