From: Bert Vermeulen Date: Sun, 10 Nov 2013 11:50:52 +0000 (+0100) Subject: Show only one output type at the same time. X-Git-Tag: sigrok-cli-0.5.0~64 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b4584f8dc3b0e7209b7ff819de2991cb09f5a4af;p=sigrok-cli.git Show only one output type at the same time. OUTPUT_BINARY takes precedence if specified, and is always output 'raw', without extra information, so it can be piped into other programs. Otherwise, if specified, OUTPUT_META is shown. If none of these is specified, the default is to show OUTPUT_ANN (all classes) of the top PD in the stack. --- diff --git a/sigrok-cli.c b/sigrok-cli.c index ac860e4..ac84e1d 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -2015,20 +2015,29 @@ int main(int argc, char **argv) } if (register_pds(NULL, opt_pds) != 0) goto done; - if (srd_pd_output_callback_add(srd_sess, SRD_OUTPUT_ANN, - show_pd_annotations, NULL) != SRD_OK) - goto done; if (setup_pd_stack() != 0) goto done; - if (opt_pd_annotations) - if (setup_pd_annotations() != 0) + + /* Only one output type is ever shown. */ + if (opt_pd_binary) { + if (setup_pd_binary() != 0) + goto done; + if (srd_pd_output_callback_add(srd_sess, SRD_OUTPUT_BINARY, + show_pd_binary, NULL) != SRD_OK) goto done; - if (opt_pd_meta) { + } else if (opt_pd_meta) { if (setup_pd_meta() != 0) goto done; if (srd_pd_output_callback_add(srd_sess, SRD_OUTPUT_META, show_pd_meta, NULL) != SRD_OK) goto done; + } else { + if (opt_pd_annotations) + if (setup_pd_annotations() != 0) + goto done; + if (srd_pd_output_callback_add(srd_sess, SRD_OUTPUT_ANN, + show_pd_annotations, NULL) != SRD_OK) + goto done; } } #endif