for (l = srd_decoder_list(); l; l = l->next) {
dec = l->data;
printf(" %-20s %s\n", dec->id, dec->longname);
+ /* Print protocol description upon "-l 3" or higher. */
+ if (opt_loglevel >= SR_LOG_INFO)
+ printf(" %-20s %s\n", "", dec->desc);
}
srd_exit();
}
printf("\n");
-
}
static void print_dev_line(const struct sr_dev *dev)
GSList *l;
struct srd_decoder *dec;
char **pdtokens, **pdtok, **ann, *doc;
+ struct srd_probe *p;
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("Annotations:\n");
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]);
}
+ } 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");
+ }
+ 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);
+ printf("Documentation:\n%s\n",
+ doc[0] == '\n' ? doc + 1 : doc);
g_free(doc);
}
}
g_strfreev(pdtokens);
-
}
static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet)
cleanup:
g_free(filter_out);
received_samples += logic->length / sample_size;
-
}
/* Register the given PDs for this session.
for (i = 0; annotations[i]; i++)
printf("\"%s\" ", annotations[i]);
printf("\n");
-
}
static int select_probes(struct sr_dev *dev)
printf("Failed to save session.\n");
}
sr_session_destroy();
-
}
static void load_input_file(void)
/* fall back on input modules */
load_input_file_format();
}
-
}
int num_real_devs(void)
printf("Failed to save session.\n");
}
sr_session_destroy();
-
}
static void logger(const gchar *log_domain, GLogLevelFlags log_level,
printf("Failed to register protocol decoder callback\n");
return 1;
}
- }
- if (opt_pd_stack) {
- pds = g_strsplit(opt_pd_stack, ",", 0);
- if (g_strv_length(pds) < 2) {
- printf("Specify at least two protocol decoders to stack.\n");
- return 1;
- }
+ 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);
+ printf("Specify at least two protocol decoders to stack.\n");
+ return 1;
+ }
+ }
- if (!(di_from = srd_inst_find_by_id(pds[0]))) {
- printf("Cannot stack protocol decoder '%s': instance not found.\n", pds[0]);
- return 1;
- }
- for (i = 1; pds[i]; i++) {
- if (!(di_to = srd_inst_find_by_id(pds[i]))) {
- printf("Cannot stack protocol decoder '%s': instance not found.\n", pds[i]);
+ if (!(di_from = srd_inst_find_by_id(pds[0]))) {
+ printf("Cannot stack protocol decoder '%s': instance not found.\n", pds[0]);
return 1;
}
- if ((ret = srd_inst_stack(di_from, di_to)) != SRD_OK)
- return ret;
+ for (i = 1; pds[i]; i++) {
+ if (!(di_to = srd_inst_find_by_id(pds[i]))) {
+ printf("Cannot stack protocol decoder '%s': instance not found.\n", pds[i]);
+ return 1;
+ }
+ if ((ret = srd_inst_stack(di_from, di_to)) != SRD_OK)
+ return ret;
- /* Don't show annotation from this PD. Only the last PD in
- * the stack will be left on the annotation list.
- */
- g_datalist_remove_data(&pd_ann_visible, di_from->inst_id);
+ /* Don't show annotation from this PD. Only the last PD in
+ * the stack will be left on the annotation list.
+ */
+ g_datalist_remove_data(&pd_ann_visible, di_from->inst_id);
- di_from = di_to;
+ di_from = di_to;
+ }
}
g_strfreev(pds);
}