]> sigrok.org Git - sigrok-cli.git/blobdiff - parsers.c
Update due to sr_driver_list() now taking a context.
[sigrok-cli.git] / parsers.c
index 35545e02e7d59d3080fc36b98486d02491fd08a2..d788532f17097915511383851066141a999b7007 100644 (file)
--- a/parsers.c
+++ b/parsers.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "sigrok-cli.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
 #include <glib.h>
-
-extern struct sr_context *sr_ctx;
+#include "sigrok-cli.h"
 
 struct sr_channel *find_channel(GSList *channellist, const char *channelname)
 {
@@ -67,10 +65,12 @@ GSList *parse_channelstring(struct sr_dev_inst *sdi, const char *channelstring)
                        break;
                }
                if (strchr(tokens[i], '-')) {
-                       /* A range of channels in the form a-b. This will only work
+                       /*
+                        * A range of channels in the form a-b. This will only work
                         * if the channels are named as numbers -- so every channel
                         * in the range must exist as a channel name string in the
-                        * device. */
+                        * device.
+                        */
                        range = g_strsplit(tokens[i], "-", 2);
                        if (!range[0] || !range[1] || range[2]) {
                                /* Need exactly two arguments. */
@@ -413,7 +413,7 @@ int parse_driver(char *arg, struct sr_dev_driver **driver, GSList **drvopts)
        drvname = g_strdup(g_hash_table_lookup(drvargs, "sigrok_key"));
        g_hash_table_remove(drvargs, "sigrok_key");
        *driver = NULL;
-       drivers = sr_driver_list();
+       drivers = sr_driver_list(sr_ctx);
        for (i = 0; drivers[i]; i++) {
                if (strcmp(drivers[i]->name, drvname))
                        continue;
@@ -447,4 +447,3 @@ int parse_driver(char *arg, struct sr_dev_driver **driver, GSList **drvopts)
 
        return TRUE;
 }
-