X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=input.c;h=8cbfbc7edf17940e2093778a4def4d398fe62e59;hp=5650b9f8d1a317644c32f537f91bbf714a86a054;hb=029d73fe03db2656ceb2ca0f5a3fea57393fdfda;hpb=20fb52e08416238c60392b410f69856cc7d98650 diff --git a/input.c b/input.c index 5650b9f..8cbfbc7 100644 --- a/input.c +++ b/input.c @@ -19,6 +19,10 @@ #include "sigrok-cli.h" #include "config.h" +#include +#include +#include +#include #include extern gchar *opt_input_file; @@ -127,7 +131,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(); @@ -148,9 +152,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(); @@ -161,4 +179,3 @@ void load_input_file(void) load_input_file_format(); } } -