From: Karl Palsson Date: Thu, 24 Nov 2016 12:29:09 +0000 (+0000) Subject: Drop -S stack option X-Git-Tag: sigrok-cli-0.7.0~19 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c83f755098b3c5d10b3ad022c0f4e934edc94148;p=sigrok-cli.git Drop -S stack option The -P option already stacks. The -S option was only used for changing the stacking order. Simply require the correct order with -P. This reduces the confusion in stacking. Signed-off-by: Karl Palsson --- diff --git a/decode.c b/decode.c index 67d8f1e..f71ead0 100644 --- a/decode.c +++ b/decode.c @@ -261,7 +261,7 @@ void map_pd_channels(struct sr_dev_inst *sdi) } } -int setup_pd_stack(char *opt_pds, char *opt_pd_stack, char *opt_pd_annotations) +int setup_pd_stack(char *opt_pds, char *opt_pd_annotations) { struct srd_decoder_inst *di_from, *di_to; int ret, i; @@ -270,17 +270,6 @@ int setup_pd_stack(char *opt_pds, char *opt_pd_stack, char *opt_pd_annotations) /* Set up the protocol decoder stack. */ pds = g_strsplit(opt_pds, ",", 0); if (g_strv_length(pds) > 1) { - if (opt_pd_stack) { - /* A stack setup was specified, use that. */ - g_strfreev(pds); - pds = g_strsplit(opt_pd_stack, ",", 0); - if (g_strv_length(pds) < 2) { - g_strfreev(pds); - g_critical("Specify at least two protocol decoders to stack."); - return 1; - } - } - /* First PD goes at the bottom of the stack. */ ids = g_strsplit(pds[0], ":", 0); if (!(di_from = srd_inst_find_by_id(srd_sess, ids[0]))) { diff --git a/doc/sigrok-cli.1 b/doc/sigrok-cli.1 index 5e5df36..545b4d5 100644 --- a/doc/sigrok-cli.1 +++ b/doc/sigrok-cli.1 @@ -238,48 +238,6 @@ protocol decoder. Additionally, the user tells sigrok to decode the SPI protocol using channel 1 as MISO signal for SPI, channel 5 as MOSI, channel 3 as CLK, and channel 0 as CS# signal. .TP -.BR "\-S, \-\-protocol\-decoder\-stack " -This option allows the user to specify a protocol decoder stack, i.e. -the way in which one protocol decoder's output gets piped into another -protocol decoder. If not specified, the stack will be set up in the same -order in which the protocol decoders were given with the -.B \-\-protocol-decoders -option. -.sp -The decoders are specified by their ID, as shown in the -.B \-\-version -output. In addition to the -.B \-S -option, all protocol decoders that are used in a stack, must also be specified -(together with their options, if any) using the -.B \-P -parameter. -.sp -Example: -.sp - $ -.B "sigrok\-cli \-i \-P i2c:sda=4:scl=7,rtc8564" -.br -.B " \-S i2c,rtc8564" -.sp -In this example, the -.B \-S -option specifies that the output of the -.BR i2c " decoder" -is piped into the -.BR rtc8564 " decoder," -i.e., the -.BR rtc8564 " decoder" -is stacked on top of the -.BR i2c " decoder." -.sp -The respective protocol decoder options and channel name/number assignments -must be given using the -.B \-P -option (you cannot specify them in the -.B \-S -option). -.TP .BR "\-A, \-\-protocol\-decoder\-annotations " By default, only the stack's topmost protocol decoder's annotation output is shown. With this option another decoder's annotation can be selected for diff --git a/main.c b/main.c index 2bb2ef7..e699d2f 100644 --- a/main.c +++ b/main.c @@ -214,7 +214,7 @@ int main(int argc, char **argv) } if (register_pds(opt_pds, opt_pd_annotations) != 0) goto done; - if (setup_pd_stack(opt_pds, opt_pd_stack, opt_pd_annotations) != 0) + if (setup_pd_stack(opt_pds, opt_pd_annotations) != 0) goto done; /* Only one output type is ever shown. */ diff --git a/options.c b/options.c index cba1e63..49a1243 100644 --- a/options.c +++ b/options.c @@ -34,7 +34,6 @@ gchar *opt_channel_group = NULL; gchar *opt_triggers = NULL; gchar *opt_pds = NULL; #ifdef HAVE_SRD -gchar *opt_pd_stack = NULL; gchar *opt_pd_annotations = NULL; gchar *opt_pd_meta = NULL; gchar *opt_pd_binary = NULL; @@ -83,7 +82,6 @@ CHECK_ONCE(opt_channel_group) CHECK_ONCE(opt_triggers) #ifdef HAVE_SRD CHECK_ONCE(opt_pds) -CHECK_ONCE(opt_pd_stack) CHECK_ONCE(opt_pd_annotations) CHECK_ONCE(opt_pd_meta) CHECK_ONCE(opt_pd_binary) @@ -128,8 +126,6 @@ static const GOptionEntry optargs[] = { #ifdef HAVE_SRD {"protocol-decoders", 'P', 0, G_OPTION_ARG_CALLBACK, &check_opt_pds, "Protocol decoders to run", NULL}, - {"protocol-decoder-stack", 'S', 0, G_OPTION_ARG_CALLBACK, &check_opt_pd_stack, - "Protocol decoder stack", NULL}, {"protocol-decoder-annotations", 'A', 0, G_OPTION_ARG_CALLBACK, &check_opt_pd_annotations, "Protocol decoder annotation(s) to show", NULL}, {"protocol-decoder-meta", 'M', 0, G_OPTION_ARG_CALLBACK, &check_opt_pd_meta, diff --git a/sigrok-cli.h b/sigrok-cli.h index 476ee92..f5260b1 100644 --- a/sigrok-cli.h +++ b/sigrok-cli.h @@ -74,7 +74,7 @@ void load_input_file(void); /* decode.c */ #ifdef HAVE_SRD int register_pds(const char *opt_pds, char *opt_pd_annotations); -int setup_pd_stack(char *opt_pds, char *opt_pd_stack, char *opt_pd_annotations); +int setup_pd_stack(char *opt_pds, char *opt_pd_annotations); int setup_pd_annotations(char *opt_pd_annotations); int setup_pd_meta(char *opt_pd_meta); int setup_pd_binary(char *opt_pd_binary); @@ -112,7 +112,6 @@ extern gchar *opt_channel_group; extern gchar *opt_triggers; extern gchar *opt_pds; #ifdef HAVE_SRD -extern gchar *opt_pd_stack; extern gchar *opt_pd_annotations; extern gchar *opt_pd_meta; extern gchar *opt_pd_binary;