]> sigrok.org Git - sigrok-cli.git/commitdiff
cli: Better debug messages for setting PD probes.
authorUwe Hermann <redacted>
Sat, 7 Jan 2012 13:46:24 +0000 (14:46 +0100)
committerUwe Hermann <redacted>
Sat, 7 Jan 2012 13:46:24 +0000 (14:46 +0100)
sigrok-cli.c

index 2856bc9f6afe7f5c51c848693a00fdd0a3615983..86fc6851d24e980c7f71ebd49a974866502f3c28 100644 (file)
@@ -461,9 +461,15 @@ static int register_pds(struct sr_device *device, const char *pdstring)
                for (optok = optokens+1; *optok; optok++) {
                        char probe[strlen(*optok)];
                        int num;
-                       if(sscanf(*optok, "%[^=]=%d", probe, &num) == 2)
+                       if (sscanf(*optok, "%[^=]=%d", probe, &num) == 2) {
+                               printf("Setting probe '%s' to %d\n", probe, num);
                                srd_instance_set_probe(di, probe, num);
-                               /* TODO: else fail somehow */
+                       } else {
+                               fprintf(stderr, "Error: Couldn't parse decoder "
+                                       "options correctly! Aborting.\n");
+                               /* FIXME: Better error handling. */
+                               exit(EXIT_FAILURE);
+                       }
                }
                g_strfreev(optokens);