]> sigrok.org Git - sigrok-cli.git/commitdiff
sr: No need for dynamic hardware driver registration.
authorUwe Hermann <redacted>
Wed, 22 Feb 2012 20:48:30 +0000 (21:48 +0100)
committerUwe Hermann <redacted>
Wed, 22 Feb 2012 23:28:20 +0000 (00:28 +0100)
We don't need or allow run-time registration of hardware
drivers/plugins, they're added at compile-time.

parsers.c
sigrok-cli.c

index 80015f58a8291d9e2cb337aecbce386bf196967d..cd0a15fe36be42d3e165bba8c2e13a92683bbacb 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -127,9 +127,9 @@ GHashTable *parse_generic_arg(const char *arg)
 struct sr_dev *parse_devstring(const char *devstring)
 {
        struct sr_dev *dev, *d;
-       struct sr_dev_plugin *plugin;
-       GSList *devs, *plugins, *l, *p;
-       int num_devs, dev_num, dev_cnt;
+       struct sr_dev_plugin **plugins;
+       GSList *devs, *l;
+       int i, num_devs, dev_num, dev_cnt;
        char *tmp;
 
        if (!devstring)
@@ -165,11 +165,10 @@ struct sr_dev *parse_devstring(const char *devstring)
                 */
                dev = NULL;
                plugins = sr_hw_list();
-               for (p = plugins; p; p = p->next) {
-                       plugin = p->data;
-                       if (strcmp(plugin->name, devstring))
+               for (i = 0; plugins[i]; i++) {
+                       if (strcmp(plugins[i]->name, devstring))
                                continue;
-                       num_devs = sr_hw_init(plugin);
+                       num_devs = sr_hw_init(plugins[i]);
                        if (num_devs == 1) {
                                devs = sr_dev_list();
                                dev = devs->data;
index b9ed262c214ece6b0d77f7a144b42d3b11b2d708..1b34bf5c9701ccd772ce2b696cca02e207cc9fb2 100644 (file)
@@ -85,8 +85,8 @@ static GOptionEntry optargs[] = {
 
 static void show_version(void)
 {
-       GSList *plugins, *p, *l;
-       struct sr_dev_plugin *plugin;
+       GSList *l;
+       struct sr_dev_plugin **plugins;
        struct sr_input_format **inputs;
        struct sr_output_format **outputs;
        struct srd_decoder *dec;
@@ -96,9 +96,8 @@ static void show_version(void)
 
        printf("Supported hardware drivers:\n");
        plugins = sr_hw_list();
-       for (p = plugins; p; p = p->next) {
-               plugin = p->data;
-               printf("  %-20s %s\n", plugin->name, plugin->longname);
+       for (i = 0; plugins[i]; i++) {
+               printf("  %-20s %s\n", plugins[i]->name, plugins[i]->longname);
        }
        printf("\n");