X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decode.c;h=ac0e3e17cc283e51d16a0aa8e7c21be846faf657;hb=527dd7262e49dd051ff554401f9cb21c2c9006dd;hp=e0b27fd2938636350a4ab9b70e8b709f6ab3a8e8;hpb=118228e13f8e1807d5a21cf7b038e4cc38a5e15b;p=sigrok-cli.git diff --git a/decode.c b/decode.c index e0b27fd..ac0e3e1 100644 --- a/decode.c +++ b/decode.c @@ -139,7 +139,7 @@ static int register_pd(char *opt_pds, char *opt_pd_annotations) pdtokens = g_strsplit(opt_pds, ",", 0); for (pdtok = pdtokens; *pdtok; pdtok++) { - if (!(pd_opthash = parse_generic_arg(*pdtok, TRUE))) { + if (!(pd_opthash = parse_generic_arg(*pdtok, TRUE, NULL))) { g_critical("Invalid protocol decoder option '%s'.", *pdtok); break; } @@ -591,38 +591,32 @@ static void jsontrace_annotation(struct srd_decoder *dec, * annotation row's description. The 'ts' (timestamp) is in * microseconds. Set 'name' to the longest annotation text. * - * BEWARE of the unfortunate JSON format comma limitation. And - * some of the output formatting is motivated by the desire to - * further reduce text size, by eliminating some of the spaces. + * BEWARE of the unfortunate JSON format limitation, which + * clutters data output calls with format helper calls. * TODO Want to introduce a cJSON dependency to delegate the * construction of output text? - * - * This implementation is strictly compatible to the initial - * implementation. Which might change in the future to increase - * readability of the output to humans, by generating a layout - * which is closer to other output modes. */ jsontrace_open_close(FALSE, TRUE, FALSE); - printf("\"%s\": \"%s\"", "name", pda->ann_text[0]); - jsontrace_open_close(FALSE, FALSE, FALSE); printf("\"%s\": \"%s\"", "ph", "B"); jsontrace_open_close(FALSE, FALSE, FALSE); + printf("\"%s\": %lf", "ts", jsontrace_ts_usec(pdata->start_sample)); + jsontrace_open_close(FALSE, FALSE, FALSE); printf("\"%s\": \"%s\"", "pid", pdata->pdo->proto_id); jsontrace_open_close(FALSE, FALSE, FALSE); printf("\"%s\": \"%s\"", "tid", row_text); jsontrace_open_close(FALSE, FALSE, FALSE); - printf("\"%s\": %lf", "ts", jsontrace_ts_usec(pdata->start_sample)); + printf("\"%s\": \"%s\"", "name", pda->ann_text[0]); jsontrace_open_close(FALSE, TRUE, FALSE); - printf("\"%s\": \"%s\"", "name", pda->ann_text[0]); - jsontrace_open_close(FALSE, FALSE, FALSE); printf("\"%s\": \"%s\"", "ph", "E"); jsontrace_open_close(FALSE, FALSE, FALSE); + printf("\"%s\": %lf", "ts", jsontrace_ts_usec(pdata->end_sample)); + jsontrace_open_close(FALSE, FALSE, FALSE); printf("\"%s\": \"%s\"", "pid", pdata->pdo->proto_id); jsontrace_open_close(FALSE, FALSE, FALSE); printf("\"%s\": \"%s\"", "tid", row_text); jsontrace_open_close(FALSE, FALSE, FALSE); - printf("\"%s\": %lf", "ts", jsontrace_ts_usec(pdata->end_sample)); + printf("\"%s\": \"%s\"", "name", pda->ann_text[0]); jsontrace_open_close(FALSE, FALSE, TRUE); } @@ -690,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