]> sigrok.org Git - sigrok-cli.git/blobdiff - show.c
show: Add support for showing PD annotation rows.
[sigrok-cli.git] / show.c
diff --git a/show.c b/show.c
index e1a5bad6cbb59981b1028953121c6046a3617c78..0b33d682724500e9906e14681a80856012d0e1b7 100644 (file)
--- a/show.c
+++ b/show.c
@@ -20,6 +20,7 @@
 #include "sigrok-cli.h"
 #include "config.h"
 #include <glib.h>
+#include <string.h>
 
 extern gint opt_loglevel;
 extern gchar *opt_pds;
@@ -436,11 +437,12 @@ void show_dev_detail(void)
 #ifdef HAVE_SRD
 void show_pd_detail(void)
 {
-       GSList *l;
+       GSList *l, *ll;
        struct srd_decoder *dec;
        struct srd_decoder_option *o;
        char **pdtokens, **pdtok, *optsep, **ann, *val, *doc;
        struct srd_probe *p;
+       struct srd_decoder_annotation_row *r;
 
        pdtokens = g_strsplit(opt_pds, ",", -1);
        for (pdtok = pdtokens; *pdtok; pdtok++) {
@@ -463,6 +465,18 @@ void show_pd_detail(void)
                } else {
                        printf("None.\n");
                }
+               printf("Annotation rows:\n");
+               if (dec->annotation_rows) {
+                       for (l = dec->annotation_rows; l; l = l->next) {
+                               r = l->data;
+                               printf("- %s (%s): ", r->desc, r->id);
+                               for (ll = r->ann_classes; ll; ll = ll->next)
+                                       printf("%d ", GPOINTER_TO_INT(ll->data));
+                               printf("\n");
+                       }
+               } else {
+                       printf("None.\n");
+               }
                printf("Required probes:\n");
                if (dec->probes) {
                        for (l = dec->probes; l; l = l->next) {
@@ -483,14 +497,16 @@ void show_pd_detail(void)
                } else {
                        printf("None.\n");
                }
+               printf("Options:\n");
                if (dec->options) {
-                       printf("Options:\n");
                        for (l = dec->options; l; l = l->next) {
                                o = l->data;
                                val = g_variant_print(o->def, FALSE);
                                printf("- %s: %s (default %s)\n", o->id, o->desc, val);
                                g_free(val);
                        }
+               } else {
+                       printf("None.\n");
                }
                if ((doc = srd_decoder_doc_get(dec))) {
                        printf("Documentation:\n%s\n",