X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flecroy-logicstudio%2Fapi.c;h=6425e0f5fcedaeb95cdbbcedb545b165dcf952fd;hb=e434f624ba0c6ebde3c08eca8de241c035283703;hp=6f7eec94ae59c64053b965438ce74d07d9dd6eae;hpb=463160cbca37367ef94dfead0c64531d82b83ab8;p=libsigrok.git diff --git a/src/hardware/lecroy-logicstudio/api.c b/src/hardware/lecroy-logicstudio/api.c index 6f7eec94..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,14 +410,12 @@ 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(samplerates, ARRAY_SIZE(samplerates)); + *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates)); break; case SR_CONF_TRIGGER_MATCH: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - trigger_matches, ARRAY_SIZE(trigger_matches), - sizeof(int32_t)); + *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches)); break; default: return SR_ERR_NA;