static GOptionEntry optargs[] = {
{"version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, "Show version and support list", NULL},
static GOptionEntry optargs[] = {
{"version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, "Show version and support list", NULL},
- {"loglevel", 'l', 0, G_OPTION_ARG_INT, &opt_loglevel, "Select libsigrok loglevel", NULL},
- {"list-devices", 'D', 0, G_OPTION_ARG_NONE, &opt_list_devs, "List devices", NULL},
+ {"loglevel", 'l', 0, G_OPTION_ARG_INT, &opt_loglevel, "Select libsigrok/libsigrokdecode loglevel", NULL},
+ {"list-devices", 'D', 0, G_OPTION_ARG_NONE, &opt_list_devs, "Scan for devices", NULL},
+ {"device", 'd', 0, G_OPTION_ARG_STRING, &opt_dev, "Use specified device", NULL},
{"input-file", 'i', 0, G_OPTION_ARG_FILENAME, &opt_input_file, "Load input from file", NULL},
{"input-format", 'I', 0, G_OPTION_ARG_STRING, &opt_input_format, "Input format", NULL},
{"output-file", 'o', 0, G_OPTION_ARG_FILENAME, &opt_output_file, "Save output to file", NULL},
{"output-format", 'O', 0, G_OPTION_ARG_STRING, &opt_output_format, "Output format", NULL},
{"input-file", 'i', 0, G_OPTION_ARG_FILENAME, &opt_input_file, "Load input from file", NULL},
{"input-format", 'I', 0, G_OPTION_ARG_STRING, &opt_input_format, "Input format", NULL},
{"output-file", 'o', 0, G_OPTION_ARG_FILENAME, &opt_output_file, "Save output to file", NULL},
{"output-format", 'O', 0, G_OPTION_ARG_STRING, &opt_output_format, "Output format", NULL},
{"probes", 'p', 0, G_OPTION_ARG_STRING, &opt_probes, "Probes to use", NULL},
{"triggers", 't', 0, G_OPTION_ARG_STRING, &opt_triggers, "Trigger configuration", NULL},
{"wait-trigger", 'w', 0, G_OPTION_ARG_NONE, &opt_wait_trigger, "Wait for trigger", NULL},
{"probes", 'p', 0, G_OPTION_ARG_STRING, &opt_probes, "Probes to use", NULL},
{"triggers", 't', 0, G_OPTION_ARG_STRING, &opt_triggers, "Trigger configuration", NULL},
{"wait-trigger", 'w', 0, G_OPTION_ARG_NONE, &opt_wait_trigger, "Wait for trigger", NULL},
- {"protocol-decoders", 'a', 0, G_OPTION_ARG_STRING, &opt_pds, "Protocol decoder sequence", NULL},
+ {"protocol-decoders", 'a', 0, G_OPTION_ARG_STRING, &opt_pds, "Protocol decoders to run", NULL},
{"protocol-decoder-stack", 's', 0, G_OPTION_ARG_STRING, &opt_pd_stack, "Protocol decoder stack", NULL},
{"time", 0, 0, G_OPTION_ARG_STRING, &opt_time, "How long to sample (ms)", NULL},
{"samples", 0, 0, G_OPTION_ARG_STRING, &opt_samples, "Number of samples to acquire", NULL},
{"protocol-decoder-stack", 's', 0, G_OPTION_ARG_STRING, &opt_pd_stack, "Protocol decoder stack", NULL},
{"time", 0, 0, G_OPTION_ARG_STRING, &opt_time, "How long to sample (ms)", NULL},
{"samples", 0, 0, G_OPTION_ARG_STRING, &opt_samples, "Number of samples to acquire", NULL},
+ printf("Using libsigrok %s (lib version %s).\n",
+ sr_package_version_string_get(), sr_lib_version_string_get());
+ printf("Using libsigrokdecode %s (lib version %s).\n\n",
+ srd_package_version_string_get(), srd_lib_version_string_get());
+
printf("Supported hardware drivers:\n");
drivers = sr_driver_list();
for (i = 0; drivers[i]; i++) {
printf("Supported hardware drivers:\n");
drivers = sr_driver_list();
for (i = 0; drivers[i]; i++) {
for (l = srd_decoder_list(); l; l = l->next) {
dec = l->data;
printf(" %-20s %s\n", dec->id, dec->longname);
for (l = srd_decoder_list(); l; l = l->next) {
dec = l->data;
printf(" %-20s %s\n", dec->id, dec->longname);
if (hwo->hwcap == SR_HWCAP_PATTERN_MODE) {
printf(" %s", hwo->shortname);
if (hwo->hwcap == SR_HWCAP_PATTERN_MODE) {
printf(" %s", hwo->shortname);
for (i = 0; stropts[i]; i++)
printf(" %s\n", stropts[i]);
} else {
for (i = 0; stropts[i]; i++)
printf(" %s\n", stropts[i]);
} else {
GSList *l;
struct srd_decoder *dec;
char **pdtokens, **pdtok, **ann, *doc;
GSList *l;
struct srd_decoder *dec;
char **pdtokens, **pdtok, **ann, *doc;
pdtokens = g_strsplit(opt_pds, ",", -1);
for (pdtok = pdtokens; *pdtok; pdtok++) {
pdtokens = g_strsplit(opt_pds, ",", -1);
for (pdtok = pdtokens; *pdtok; pdtok++) {
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);
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);
for (l = dec->annotations; l; l = l->next) {
ann = l->data;
printf("- %s\n %s\n", ann[0], ann[1]);
}
for (l = dec->annotations; l; l = l->next) {
ann = l->data;
printf("- %s\n %s\n", ann[0], ann[1]);
}
+ } else {
+ printf("None.\n");
+ }
+ /* TODO: Print supported decoder options. */
+ printf("Required probes:\n");
+ if (dec->probes) {
+ for (l = dec->probes; l; l = l->next) {
+ p = l->data;
+ printf("- %s (%s): %s\n",
+ p->name, p->id, p->desc);
+ }
+ } else {
+ printf("None.\n");
- if ((doc = srd_decoder_doc(dec))) {
- printf("Documentation:\n%s\n", doc[0] == '\n' ? doc+1 : doc);
+ printf("Optional probes:\n");
+ if (dec->opt_probes) {
+ for (l = dec->opt_probes; l; l = l->next) {
+ p = l->data;
+ printf("- %s (%s): %s\n",
+ p->name, p->id, p->desc);
+ }
+ } else {
+ printf("None.\n");
+ }
+ if ((doc = srd_decoder_doc_get(dec))) {
+ printf("Documentation:\n%s\n",
+ doc[0] == '\n' ? doc + 1 : doc);
}
static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet)
{
static struct sr_output *o = NULL;
}
static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet)
{
static struct sr_output *o = NULL;
struct sr_datafeed_logic *logic;
int num_enabled_probes, sample_size, ret, i;
uint64_t output_len, filter_out_len;
struct sr_datafeed_logic *logic;
int num_enabled_probes, sample_size, ret, i;
uint64_t output_len, filter_out_len;
/* If the first packet to come in isn't a header, don't even try. */
if (packet->type != SR_DF_HEADER && o == NULL)
/* If the first packet to come in isn't a header, don't even try. */
if (packet->type != SR_DF_HEADER && o == NULL)
* is the probe name as specified in the decoder class, and the
* value is the probe number i.e. the order in which the PD's
* incoming samples are arranged. */
* is the probe name as specified in the decoder class, and the
* value is the probe number i.e. the order in which the PD's
* incoming samples are arranged. */
for (i = 0; annotations[i]; i++)
printf("\"%s\" ", annotations[i]);
printf("\n");
for (i = 0; annotations[i]; i++)
printf("\"%s\" ", annotations[i]);
printf("\n");
show_pd_annotation, NULL) != SRD_OK) {
printf("Failed to register protocol decoder callback\n");
return 1;
show_pd_annotation, NULL) != SRD_OK) {
printf("Failed to register protocol decoder callback\n");
return 1;