X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fchronovu-la%2Fapi.c;h=694bd54ac84fb91f0f864cefa67d9d31eb2a641c;hb=deb7615262ac4f9cc0750a08351afa7cbf9c34d5;hp=a20697a347d070e65d2cde834b448d787f030bc9;hpb=50ccb36f201bd6b2326822f585c01498fe6fd86a;p=libsigrok.git diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index a20697a3..694bd54a 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -192,18 +192,17 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) continue; } - usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); - libusb_close(hdl); - if (!strcmp(product, "ChronoVu LA8")) { + if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0) + continue; + + if (!strcmp(product, "ChronoVu LA8")) model = 0; - } else if (!strcmp(product, "ChronoVu LA16")) { + else if (!strcmp(product, "ChronoVu LA16")) model = 1; - } else { - sr_spew("Unknown iProduct string '%s'.", product); - continue; - } + else + continue; /* Unknown iProduct string, ignore. */ sr_dbg("Found %s (%04x:%04x, %d.%d, %s).", product, des.idVendor, des.idProduct, @@ -353,12 +352,12 @@ static int config_list(uint32_t key, GVariant **data, *data = std_gvar_samplerates(ARRAY_AND_SIZE(devc->samplerates)); break; case SR_CONF_LIMIT_SAMPLES: - if (!devc->prof) + if (!devc || !devc->prof) return SR_ERR_BUG; *data = std_gvar_tuple_u64(0, (devc->prof->model == CHRONOVU_LA8) ? MAX_NUM_SAMPLES : MAX_NUM_SAMPLES / 2); break; case SR_CONF_TRIGGER_MATCH: - if (!devc->prof) + if (!devc || !devc->prof) return SR_ERR_BUG; *data = std_gvar_array_i32(trigger_matches, devc->prof->num_trigger_matches); break;