X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=main.c;h=02f69a2ebbb5d998bf609844b01c488a525c613b;hb=eaa5c96667ae1498b184052665f4b547ab47d432;hp=701da8e1992a66d69fac8f2e8316a0196c1e6c4d;hpb=c45dd41c508bd84b3886eebfa0ca4b2230b2630b;p=sigrok-cli.git diff --git a/main.c b/main.c index 701da8e..02f69a2 100644 --- 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; @@ -242,6 +247,8 @@ int main(int argc, char **argv) if (opt_pd_binary) { if (setup_pd_binary(opt_pd_binary) != 0) goto done; + if (setup_binary_stdout() != 0) + goto done; if (srd_pd_output_callback_add(srd_sess, SRD_OUTPUT_BINARY, show_pd_binary, NULL) != SRD_OK) goto done; @@ -259,6 +266,7 @@ int main(int argc, char **argv) show_pd_annotations, NULL) != SRD_OK) goto done; } + show_pd_prepare(); } #endif @@ -268,6 +276,8 @@ int main(int argc, char **argv) show_supported(); else if (opt_list_supported_wiki) show_supported_wiki(); + else if (opt_input_file && opt_show) + load_input_file(TRUE); else if (opt_input_format && opt_show) show_input(); else if (opt_output_format && opt_show) @@ -283,17 +293,21 @@ int main(int argc, char **argv) else if (opt_show) show_dev_detail(); else if (opt_input_file) - load_input_file(); + load_input_file(FALSE); else if (opt_get) get_option(); else if (opt_set) set_options(); else if (opt_samples || opt_time || opt_frames || opt_continuous) run_session(); + else if (opt_list_serial) + show_serial_ports(); else show_help(); #ifdef HAVE_SRD + if (opt_pds) + show_pd_close(); if (opt_pds) srd_exit(); #endif