X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=main.c;h=db2bdc016df58f86eef252345f02b667b6c3316d;hb=c9c30f53c4c639d73cadc7c58c28a69090b41261;hp=c038b6f02697dfc73a330460a66e180fe2a640e1;hpb=0bdb08fd3d1b0b410cb1d33b90f531c35008bd4d;p=sigrok-cli.git diff --git a/main.c b/main.c index c038b6f..db2bdc0 100644 --- a/main.c +++ b/main.c @@ -136,11 +136,11 @@ 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); - if ((devargs = parse_generic_arg(opt_config, FALSE))) + if ((devargs = parse_generic_arg(opt_config, FALSE, NULL))) set_dev_options(sdi, devargs); else devargs = NULL; @@ -186,7 +186,7 @@ static void set_options(void) return; } - if (!(devargs = parse_generic_arg(opt_config, FALSE))) + if (!(devargs = parse_generic_arg(opt_config, FALSE, NULL))) return; if (!(devices = device_scan())) { @@ -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 @@ -266,6 +274,10 @@ int main(int argc, char **argv) show_version(); else if (opt_list_supported) 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) @@ -281,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