]> sigrok.org Git - sigrok-cli.git/commitdiff
Show only one output type at the same time.
authorBert Vermeulen <redacted>
Sun, 10 Nov 2013 11:50:52 +0000 (12:50 +0100)
committerBert Vermeulen <redacted>
Fri, 15 Nov 2013 21:27:17 +0000 (22:27 +0100)
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.

sigrok-cli.c

index ac860e4dae93922cdfa7713a8323a9b3a7003c04..ac84e1d2144fb5e211f687629e336140b83250df 100644 (file)
@@ -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