From: Sergey Spivak Date: Fri, 12 Aug 2022 11:53:43 +0000 (+0400) Subject: decode: Optionally print annotation class with PD annotations X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=commitdiff_plain;h=625606db65d118c9a246057297633d4c5f0c1571 decode: Optionally print annotation class with PD annotations Introduce the "--protocol-decoder-ann-class" command line option (no short form available), which emits annotation class names with textual output from protocol decoder annotations, regardless of a log level value. Based on commit 08e9378bf68a by Gerhard Sittig --- diff --git a/decode.c b/decode.c index 4ddf34a..ac0e3e1 100644 --- a/decode.c +++ b/decode.c @@ -684,6 +684,8 @@ void show_pd_annotations(struct srd_proto_data *pdata, void *cb_data) show_class = TRUE; show_abbrev = TRUE; } + if (opt_pd_ann_class) + show_class = TRUE; /* * Display the annotation's fields after the layout was diff --git a/doc/sigrok-cli.1 b/doc/sigrok-cli.1 index b333bee..b489928 100644 --- a/doc/sigrok-cli.1 +++ b/doc/sigrok-cli.1 @@ -426,6 +426,9 @@ Not every decoder generates binary output. When given, decoder annotations will include sample numbers, too. This allows consumers to receive machine readable timing information. .TP +.BR "\-\-protocol\-decoder\-ann\-class +When given, decoder annotations will include annotation class names. +.TP .BR "\-l, \-\-loglevel " Set the libsigrok and libsigrokdecode loglevel. At the moment \fBsigrok\-cli\fP doesn't support setting the two loglevels independently. The higher the diff --git a/options.c b/options.c index 2573bd4..e47b680 100644 --- a/options.c +++ b/options.c @@ -40,6 +40,7 @@ gchar **opt_pds = NULL; gchar *opt_pd_annotations = NULL; gchar *opt_pd_meta = NULL; gchar *opt_pd_binary = NULL; +gboolean opt_pd_ann_class = FALSE; gboolean opt_pd_samplenum = FALSE; gboolean opt_pd_jsontrace = FALSE; #endif @@ -139,6 +140,8 @@ static const GOptionEntry optargs[] = { "Protocol decoder meta output to show", NULL}, {"protocol-decoder-binary", 'B', 0, G_OPTION_ARG_CALLBACK, &check_opt_pd_binary, "Protocol decoder binary output to show", NULL}, + {"protocol-decoder-ann-class", 0, 0, G_OPTION_ARG_NONE, &opt_pd_ann_class, + "Show annotation class in decoder output", NULL}, {"protocol-decoder-samplenum", 0, 0, G_OPTION_ARG_NONE, &opt_pd_samplenum, "Show sample numbers in decoder output", NULL}, {"protocol-decoder-jsontrace", 0, 0, G_OPTION_ARG_NONE, &opt_pd_jsontrace, diff --git a/sigrok-cli.h b/sigrok-cli.h index 2c0fbdc..684aed9 100644 --- a/sigrok-cli.h +++ b/sigrok-cli.h @@ -140,6 +140,7 @@ extern gchar **opt_pds; extern gchar *opt_pd_annotations; extern gchar *opt_pd_meta; extern gchar *opt_pd_binary; +extern gboolean opt_pd_ann_class; extern gboolean opt_pd_samplenum; extern gboolean opt_pd_jsontrace; #endif