X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=sigrok-cli.c;h=73f0a13f8f575ef0ffd52fd1fb0ea7a6a5d28ca4;hp=2cfc471f00e7508592a60de1840b50eabf30aae0;hb=838285aa2e112b526f944b81070d5525de9b634a;hpb=60ca1ad65dac60ad90089391875488e53f16114f diff --git a/sigrok-cli.c b/sigrok-cli.c index 2cfc471..73f0a13 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -258,6 +258,38 @@ static void show_device_detail(void) } } +static void show_pd_detail(void) +{ + GSList *l; + struct srd_decoder *dec; + char **pdtokens, **pdtok, **ann, *doc; + + pdtokens = g_strsplit(opt_pds, ",", -1); + for (pdtok = pdtokens; *pdtok; pdtok++) { + if (!(dec = srd_get_decoder_by_id(*pdtok))) { + printf("Protocol decoder %s not found.", *pdtok); + return; + } + printf("ID: %s\nName: %s\nLong name: %s\nDescription: %s\n", + dec->id, dec->name, dec->longname, dec->desc); + printf("License: %s\n", dec->license); + if (dec->annotations) { + printf("Annotations:\n"); + for (l = dec->annotations; l; l = l->next) { + ann = l->data; + printf("- %s\n %s\n", ann[0], ann[1]); + } + } + if ((doc = srd_decoder_doc(dec))) { + printf("Documentation:\n%s\n", doc[0] == '\n' ? doc+1 : doc); + g_free(doc); + } + } + + g_strfreev(pdtokens); + +} + static void datafeed_in(struct sr_device *device, struct sr_datafeed_packet *packet) { static struct sr_output *o = NULL; @@ -412,8 +444,8 @@ static void datafeed_in(struct sr_device *device, struct sr_datafeed_packet *pac goto cleanup; if (opt_pds) { - if (srd_session_feed(packet->timeoffset, packet->duration, - (uint8_t*)filter_out, filter_out_len) != SRD_OK) + if (srd_session_feed(received_samples, (uint8_t*)filter_out, + filter_out_len) != SRD_OK) abort(); } else { output_len = 0; @@ -1063,6 +1095,8 @@ int main(int argc, char **argv) run_session(); else if (opt_device) show_device_detail(); + else if (opt_pds) + show_pd_detail(); else printf("%s", g_option_context_get_help(context, TRUE, NULL));