From: Bert Vermeulen Date: Sat, 27 Apr 2013 16:27:32 +0000 (+0200) Subject: Don't automatically clear known instances from USB drivers on scan X-Git-Tag: dsupstream~35 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=50c604f50bf33e68ac67caa8ebad20b87b3aacc1 Don't automatically clear known instances from USB drivers on scan This invalidates previously returned sr_dev_inst pointers, which a frontend may be holding. It's the frontend's responsibility to clear the list of instances a driver keeps track of by calling sr_dev_clear(driver); if it wants a completely new scan done. --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index cfd95a11..125f9cd9 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -431,8 +431,6 @@ static GSList *hw_scan(GSList *options) devices = NULL; - clear_instances(); - if (!(devc = g_try_malloc(sizeof(struct dev_context)))) { sr_err("%s: devc malloc failed", __func__); return NULL; diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index dbec30b7..9647c4b0 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -371,9 +371,6 @@ static GSList *hw_scan(GSList *options) drvc = di->priv; - /* This scan always invalidates any previous scans. */ - clear_instances(); - conn = NULL; for (l = options; l; l = l->next) { src = l->data; diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index e7d9f60b..e75eec61 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -269,13 +269,10 @@ static GSList *hw_scan(GSList *options) const char *conn; drvc = di->priv; - drvc->instances = NULL; devcnt = 0; devices = 0; - clear_instances(); - conn = NULL; for (l = options; l; l = l->next) { src = l->data; diff --git a/hardware/lascar-el-usb/api.c b/hardware/lascar-el-usb/api.c index c841a132..ea2a80f7 100644 --- a/hardware/lascar-el-usb/api.c +++ b/hardware/lascar-el-usb/api.c @@ -85,9 +85,6 @@ static GSList *hw_scan(GSList *options) drvc = di->priv; - /* USB scan is always authoritative. */ - clear_instances(); - conn = NULL; for (l = options; l; l = l->next) { src = l->data; diff --git a/hardware/nexus-osciprime/api.c b/hardware/nexus-osciprime/api.c index 238cda51..4f1ae2fe 100644 --- a/hardware/nexus-osciprime/api.c +++ b/hardware/nexus-osciprime/api.c @@ -157,9 +157,6 @@ static GSList *hw_scan(GSList *options) drvc = di->priv; - /* USB scan is always authoritative. */ - clear_instances(); - conn = NULL; for (l = options; l; l = l->next) { src = l->data; diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index cf1e4df5..08a9e747 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -86,9 +86,6 @@ static GSList *hw_scan(GSList *options, int dmm) drvc = udmms[dmm].di->priv; - /* USB scan is always authoritative. */ - clear_instances(dmm); - conn = NULL; for (l = options; l; l = l->next) { src = l->data; diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index c15239ed..aa33e1f1 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -95,9 +95,6 @@ static GSList *hw_scan(GSList *options) drvc = di->priv; - /* USB scan is always authoritative. */ - clear_instances(); - devices = NULL; libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); for (i = 0; devlist[i]; i++) { diff --git a/hardware/zeroplus-logic-cube/api.c b/hardware/zeroplus-logic-cube/api.c index f9578a8b..f6478dfc 100644 --- a/hardware/zeroplus-logic-cube/api.c +++ b/hardware/zeroplus-logic-cube/api.c @@ -290,8 +290,6 @@ static GSList *hw_scan(GSList *options) devices = NULL; - clear_instances(); - /* Find all ZEROPLUS analyzers and add them to device list. */ devcnt = 0; libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); /* TODO: Errors. */