]> sigrok.org Git - sigrok-cli.git/blobdiff - main.c
main: terminate with error when -B was specified but -P is missing
[sigrok-cli.git] / main.c
diff --git a/main.c b/main.c
index c2f39d84ff601fec51236cf261f723016bd2e552..02f69a2ebbb5d998bf609844b01c488a525c613b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -136,7 +136,7 @@ static void get_option(void)
                return;
        }
 
-       cg = select_channel_group(sdi);
+       cg = lookup_channel_group(sdi);
        if (!(ci = sr_key_info_name_get(SR_KEY_CONFIG, opt_get)))
                g_critical("Unknown option '%s'", opt_get);
 
@@ -224,6 +224,11 @@ int main(int argc, char **argv)
                goto done;
 
 #ifdef HAVE_SRD
+       if (opt_pd_binary && !opt_pds) {
+               g_critical("Option -B will not take effect in the absence of -P.");
+               goto done;
+       }
+
        /* Set the loglevel (amount of messages to output) for libsigrokdecode. */
        if (srd_log_loglevel_set(opt_loglevel) != SRD_OK)
                goto done;
@@ -261,6 +266,7 @@ int main(int argc, char **argv)
                                        show_pd_annotations, NULL) != SRD_OK)
                                goto done;
                }
+               show_pd_prepare();
        }
 #endif
 
@@ -300,6 +306,8 @@ int main(int argc, char **argv)
                show_help();
 
 #ifdef HAVE_SRD
+       if (opt_pds)
+               show_pd_close();
        if (opt_pds)
                srd_exit();
 #endif