From: Bert Vermeulen Date: Sun, 5 Aug 2012 01:33:58 +0000 (+0200) Subject: cli: don't try to set device options before opening it X-Git-Tag: sigrok-cli-0.4.0~84 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8ab6aafcf752f6a8b1aedebd64b267eb7b385641;p=sigrok-cli.git cli: don't try to set device options before opening it --- diff --git a/sigrok-cli.c b/sigrok-cli.c index e96c67a..ccfc5e0 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -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();