]> sigrok.org Git - sigrok-cli.git/commitdiff
cli: don't try to set device options before opening it
authorBert Vermeulen <redacted>
Sun, 5 Aug 2012 01:33:58 +0000 (03:33 +0200)
committerBert Vermeulen <redacted>
Sun, 5 Aug 2012 01:33:58 +0000 (03:33 +0200)
sigrok-cli.c

index e96c67a463fac51fc119001b769f6bb15112fa48..ccfc5e0cfcd548b872fe58cf025a28dd571a2b89 100644 (file)
@@ -1348,6 +1348,12 @@ static void run_session(void)
        sr_session_new();
        sr_session_datafeed_callback_add(datafeed_in);
 
+       if (sr_session_dev_add(sdi) != SR_OK) {
+               g_critical("Failed to use device.");
+               sr_session_destroy();
+               return;
+       }
+
        if (opt_dev) {
                if ((devargs = parse_generic_arg(opt_dev, FALSE))) {
                        if (set_dev_options(sdi, devargs) != SR_OK)
@@ -1356,12 +1362,6 @@ static void run_session(void)
                }
        }
 
-       if (sr_session_dev_add(sdi) != SR_OK) {
-               g_critical("Failed to use device.");
-               sr_session_destroy();
-               return;
-       }
-
        if (select_probes(sdi) != SR_OK) {
                g_critical("Failed to set probes.");
                sr_session_destroy();