X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=input.c;h=d2adde6998b7d4d396e314bf42dd0b5f67bc87f7;hb=41ce2cbb8ff6253bc1a223298ad93f75dfabcceb;hp=4d3f358ab1316abafee71587085de4a3e83615eb;hpb=8d52f788755a9666e7053c2d411fec069f5afc4c;p=sigrok-cli.git diff --git a/input.c b/input.c index 4d3f358..d2adde6 100644 --- a/input.c +++ b/input.c @@ -25,11 +25,6 @@ #include #include -extern gchar *opt_input_file; -extern gchar *opt_input_format; -extern gchar *opt_probes; - - /** * Return the input file format which the CLI tool should use. * @@ -131,7 +126,7 @@ static void load_input_file_format(void) } } - if (select_probes(in->sdi) > 0) + if (select_channels(in->sdi) != SR_OK) return; sr_session_new(); @@ -152,9 +147,23 @@ static void load_input_file_format(void) void load_input_file(void) { + GSList *sessions; + struct sr_dev_inst *sdi; + int ret; if (sr_session_load(opt_input_file) == SR_OK) { /* sigrok session file */ + ret = sr_session_dev_list(&sessions); + if (ret != SR_OK || !sessions->data) { + g_critical("Failed to access session device."); + sr_session_destroy(); + return; + } + sdi = sessions->data; + if (select_channels(sdi) != SR_OK) { + sr_session_destroy(); + return; + } sr_session_datafeed_callback_add(datafeed_in, NULL); sr_session_start(); sr_session_run(); @@ -165,4 +174,3 @@ void load_input_file(void) load_input_file_format(); } } -