X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flecroy-logicstudio%2Fapi.c;h=6425e0f5fcedaeb95cdbbcedb545b165dcf952fd;hb=aad0c777088b7a4571272fa168a81ff9a2df05dc;hp=f61d69ae5c5a954f528b4a4c88de90be2e32827c;hpb=53012da658ae94b245240c8a3e115723eede4c7d;p=libsigrok.git diff --git a/src/hardware/lecroy-logicstudio/api.c b/src/hardware/lecroy-logicstudio/api.c index f61d69ae..6425e0f5 100644 --- a/src/hardware/lecroy-logicstudio/api.c +++ b/src/hardware/lecroy-logicstudio/api.c @@ -35,6 +35,8 @@ #define UNKNOWN_ADDRESS 0xff #define MAX_RENUM_DELAY_MS 3000 +#define NUM_CHANNELS 16 + static const uint32_t drvopts[] = { SR_CONF_LOGIC_ANALYZER, }; @@ -89,7 +91,7 @@ static struct sr_dev_inst *create_device(struct sr_usb_dev_inst *usb, sdi->inst_type = SR_INST_USB; sdi->conn = usb; - for (i = 0; i < 16; i++) { + for (i = 0; i < NUM_CHANNELS; i++) { snprintf(channel_name, sizeof(channel_name), "D%i", i); sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_name); } @@ -132,7 +134,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) if (des.idVendor != LOGICSTUDIO16_VID) continue; - usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); + if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0) + continue; usb = NULL; @@ -208,7 +211,8 @@ static int open_device(struct sr_dev_inst *sdi) des.idProduct != LOGICSTUDIO16_PID_HAVE_FIRMWARE) continue; - usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); + if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0) + continue; /* * Check if this device is the same one that we associated @@ -393,8 +397,6 @@ static int config_set(uint32_t key, GVariant *data, return lls_set_samplerate(sdi, g_variant_get_uint64(data)); case SR_CONF_CAPTURE_RATIO: devc->capture_ratio = g_variant_get_uint64(data); - if (devc->capture_ratio > 100) - return SR_ERR; break; default: return SR_ERR_NA; @@ -408,7 +410,7 @@ static int config_list(uint32_t key, GVariant **data, { switch (key) { case SR_CONF_DEVICE_OPTIONS: - return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts); + return STD_CONFIG_LIST(key, data, sdi, cg, NO_OPTS, drvopts, devopts); case SR_CONF_SAMPLERATE: *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates)); break;