From: Gerhard Sittig Date: Sat, 23 Apr 2022 19:28:23 +0000 (+0200) Subject: input: emit diagnostics when file import fails fatally X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a9b64d89d2509c095f7ed35fcfc78e146edde5d5;p=sigrok-cli.git input: emit diagnostics when file import fails fatally The previous implementation did terminate the file import upon fatal errors, but did so silently. Add diagnostics to the code paths where input module's .send() calls or channel selection fail. This raises awareness when an individual input module would fail and not warn. --- diff --git a/input.c b/input.c index eafbd6f..cce0d9f 100644 --- a/input.c +++ b/input.c @@ -147,14 +147,18 @@ static void load_input_file_module(struct df_arg_desc *df_arg) break; push_scan_data = FALSE; buf->len = len; - if (sr_input_send(in, buf) != SR_OK) + if (sr_input_send(in, buf) != SR_OK) { + g_critical("File import failed (read)"); break; + } sdi = sr_input_dev_inst_get(in); if (!got_sdi && sdi) { /* First time we got a valid sdi. */ - if (select_channels(sdi) != SR_OK) + if (select_channels(sdi) != SR_OK) { + g_critical("File import failed (channels)"); return; + } if (sr_session_dev_add(session, sdi) != SR_OK) { g_critical("Failed to use device."); sr_session_destroy(session);