]> sigrok.org Git - sigrok-cli.git/commitdiff
input: emit diagnostics when file import fails fatally
authorGerhard Sittig <redacted>
Sat, 23 Apr 2022 19:28:23 +0000 (21:28 +0200)
committerGerhard Sittig <redacted>
Sat, 23 Apr 2022 19:36:34 +0000 (21:36 +0200)
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.

input.c

diff --git a/input.c b/input.c
index eafbd6fdb8b0ee286f3db7c299f4445e78b79287..cce0d9ff916b9a159f0f3400d80bd5d96df263eb 100644 (file)
--- 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);