X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=device.c;h=eb2e2b4cb2c02b392c8f02f31095ca027128a9de;hb=d261dbbfcc73;hp=228727f8e0a782188cbf1d60e08d202963972bbd;hpb=ffedd0bf5d3abb1eae86db68e336285eddf41778;p=libsigrok.git diff --git a/device.c b/device.c index 228727f8..eb2e2b4c 100644 --- a/device.c +++ b/device.c @@ -59,10 +59,11 @@ static GSList *devs = NULL; */ SR_API int sr_dev_scan(void) { - GSList *plugins, *l; - struct sr_dev_plugin *plugin; + int i; + struct sr_dev_plugin **plugins; - if (!(plugins = sr_hw_list())) { + plugins = sr_hw_list(); + if (!plugins[0]) { sr_err("dev: %s: no supported devices/hwplugins", __func__); return SR_ERR; /* TODO: More specific error? */ } @@ -72,11 +73,8 @@ SR_API int sr_dev_scan(void) * a firmware upload and associated delay, we may as well get all * of these out of the way first. */ - for (l = plugins; l; l = l->next) { - plugin = l->data; - /* TODO: Handle 'plugin' being NULL. */ - sr_hw_init(plugin); - } + for (i = 0; plugins[i]; i++) + sr_hw_init(plugins[i]); return SR_OK; } @@ -424,7 +422,7 @@ SR_API int sr_dev_info_get(const struct sr_dev *dev, int id, const void **data) if (data == NULL) return SR_ERR_ARG; - *data = dev->plugin->get_dev_info(dev->plugin_index, id); + *data = dev->plugin->dev_info_get(dev->plugin_index, id); if (*data == NULL) return SR_ERR;