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.
This commit is contained in:
parent
c2523f2213
commit
50c604f50b
|
@ -431,8 +431,6 @@ static GSList *hw_scan(GSList *options)
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
|
|
||||||
clear_instances();
|
|
||||||
|
|
||||||
if (!(devc = g_try_malloc(sizeof(struct dev_context)))) {
|
if (!(devc = g_try_malloc(sizeof(struct dev_context)))) {
|
||||||
sr_err("%s: devc malloc failed", __func__);
|
sr_err("%s: devc malloc failed", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -371,9 +371,6 @@ static GSList *hw_scan(GSList *options)
|
||||||
|
|
||||||
drvc = di->priv;
|
drvc = di->priv;
|
||||||
|
|
||||||
/* This scan always invalidates any previous scans. */
|
|
||||||
clear_instances();
|
|
||||||
|
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
|
|
|
@ -269,13 +269,10 @@ static GSList *hw_scan(GSList *options)
|
||||||
const char *conn;
|
const char *conn;
|
||||||
|
|
||||||
drvc = di->priv;
|
drvc = di->priv;
|
||||||
drvc->instances = NULL;
|
|
||||||
|
|
||||||
devcnt = 0;
|
devcnt = 0;
|
||||||
devices = 0;
|
devices = 0;
|
||||||
|
|
||||||
clear_instances();
|
|
||||||
|
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
|
|
|
@ -85,9 +85,6 @@ static GSList *hw_scan(GSList *options)
|
||||||
|
|
||||||
drvc = di->priv;
|
drvc = di->priv;
|
||||||
|
|
||||||
/* USB scan is always authoritative. */
|
|
||||||
clear_instances();
|
|
||||||
|
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
|
|
|
@ -157,9 +157,6 @@ static GSList *hw_scan(GSList *options)
|
||||||
|
|
||||||
drvc = di->priv;
|
drvc = di->priv;
|
||||||
|
|
||||||
/* USB scan is always authoritative. */
|
|
||||||
clear_instances();
|
|
||||||
|
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
|
|
|
@ -86,9 +86,6 @@ static GSList *hw_scan(GSList *options, int dmm)
|
||||||
|
|
||||||
drvc = udmms[dmm].di->priv;
|
drvc = udmms[dmm].di->priv;
|
||||||
|
|
||||||
/* USB scan is always authoritative. */
|
|
||||||
clear_instances(dmm);
|
|
||||||
|
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
|
|
|
@ -95,9 +95,6 @@ static GSList *hw_scan(GSList *options)
|
||||||
|
|
||||||
drvc = di->priv;
|
drvc = di->priv;
|
||||||
|
|
||||||
/* USB scan is always authoritative. */
|
|
||||||
clear_instances();
|
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
||||||
for (i = 0; devlist[i]; i++) {
|
for (i = 0; devlist[i]; i++) {
|
||||||
|
|
|
@ -290,8 +290,6 @@ static GSList *hw_scan(GSList *options)
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
|
|
||||||
clear_instances();
|
|
||||||
|
|
||||||
/* Find all ZEROPLUS analyzers and add them to device list. */
|
/* Find all ZEROPLUS analyzers and add them to device list. */
|
||||||
devcnt = 0;
|
devcnt = 0;
|
||||||
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); /* TODO: Errors. */
|
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); /* TODO: Errors. */
|
||||||
|
|
Loading…
Reference in New Issue