]> sigrok.org Git - sigrok-cli.git/commitdiff
show: print binary classes as well in protocol decoder details
authorGerhard Sittig <redacted>
Sun, 16 Oct 2016 16:25:30 +0000 (18:25 +0200)
committerUwe Hermann <redacted>
Sun, 16 Oct 2016 22:24:14 +0000 (00:24 +0200)
The output of `sigrok -P <decoder> --show` omitted the binary classes,
users could not learn which specs are available for the -B option.  Add
a "Binary classes:" section after the list of annotations.

Signed-off-by: Gerhard Sittig <redacted>
show.c

diff --git a/show.c b/show.c
index 54b367c909a98046d11d25b8dc34cb53e6bf73ed..7d02326e86bad5860b698c38a9d4106fcd88d61f 100644 (file)
--- a/show.c
+++ b/show.c
@@ -682,7 +682,7 @@ void show_pd_detail(void)
        struct srd_decoder_annotation_row *r;
        GSList *l, *ll, *ol;
        int idx;
-       char **pdtokens, **pdtok, *optsep, **ann, *val, *doc;
+       char **pdtokens, **pdtok, *optsep, **ann, **bin, *val, *doc;
 
        pdtokens = g_strsplit(opt_pds, ",", -1);
        for (pdtok = pdtokens; *pdtok; pdtok++) {
@@ -722,6 +722,15 @@ void show_pd_detail(void)
                } else {
                        printf("None.\n");
                }
+               printf("Binary classes:\n");
+               if (dec->binary) {
+                       for (l = dec->binary; l; l = l->next) {
+                               bin = l->data;
+                               printf("- %s: %s\n", bin[0], bin[1]);
+                       }
+               } else {
+                       printf("None.\n");
+               }
                printf("Required channels:\n");
                if (dec->channels) {
                        for (l = dec->channels; l; l = l->next) {