2 * This file is part of the sigrok-cli project.
4 * Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "sigrok-cli.h"
24 static gint sort_inputs(gconstpointer a, gconstpointer b)
26 return strcmp(sr_input_id_get((struct sr_input_module *)a),
27 sr_input_id_get((struct sr_input_module *)b));
30 static gint sort_outputs(gconstpointer a, gconstpointer b)
32 return strcmp(sr_output_id_get((struct sr_output_module *)a),
33 sr_output_id_get((struct sr_output_module *)b));
36 static gint sort_transforms(gconstpointer a, gconstpointer b)
38 return strcmp(sr_transform_id_get((struct sr_transform_module *)a),
39 sr_transform_id_get((struct sr_transform_module *)b));
42 static gint sort_drivers(gconstpointer a, gconstpointer b)
44 const struct sr_dev_driver *sdda = a, *sddb = b;
46 return strcmp(sdda->name, sddb->name);
50 static gint sort_pds(gconstpointer a, gconstpointer b)
52 const struct srd_decoder *sda = a, *sdb = b;
54 return strcmp(sda->id, sdb->id);
58 void show_version(void)
60 struct sr_dev_driver **drivers, *driver;
61 const struct sr_input_module **inputs, *input;
62 const struct sr_output_module **outputs, *output;
63 const struct sr_transform_module **transforms, *transform;
68 struct srd_decoder *dec;
71 printf("sigrok-cli %s\n\n", VERSION);
73 printf("Using libsigrok %s (lib version %s).\n",
74 sr_package_version_string_get(), sr_lib_version_string_get());
76 printf("Using libsigrokdecode %s (lib version %s).\n\n",
77 srd_package_version_string_get(), srd_lib_version_string_get());
80 printf("Supported hardware drivers:\n");
81 drivers = sr_driver_list(sr_ctx);
82 for (sl = NULL, i = 0; drivers[i]; i++)
83 sl = g_slist_append(sl, drivers[i]);
84 sl = g_slist_sort(sl, sort_drivers);
85 for (l = sl; l; l = l->next) {
87 printf(" %-20s %s\n", driver->name, driver->longname);
92 printf("Supported input formats:\n");
93 inputs = sr_input_list();
94 for (sl = NULL, i = 0; inputs[i]; i++)
95 sl = g_slist_append(sl, (gpointer)inputs[i]);
96 sl = g_slist_sort(sl, sort_inputs);
97 for (l = sl; l; l = l->next) {
99 printf(" %-20s %s\n", sr_input_id_get(input),
100 sr_input_description_get(input));
105 printf("Supported output formats:\n");
106 outputs = sr_output_list();
107 for (sl = NULL, i = 0; outputs[i]; i++)
108 sl = g_slist_append(sl, (gpointer)outputs[i]);
109 sl = g_slist_sort(sl, sort_outputs);
110 for (l = sl; l; l = l->next) {
112 printf(" %-20s %s\n", sr_output_id_get(output),
113 sr_output_description_get(output));
118 printf("Supported transform modules:\n");
119 transforms = sr_transform_list();
120 for (sl = NULL, i = 0; transforms[i]; i++)
121 sl = g_slist_append(sl, (gpointer)transforms[i]);
122 sl = g_slist_sort(sl, sort_transforms);
123 for (l = sl; l; l = l->next) {
125 printf(" %-20s %s\n", sr_transform_id_get(transform),
126 sr_transform_description_get(transform));
132 if (srd_init(NULL) == SRD_OK) {
133 printf("Supported protocol decoders:\n");
134 srd_decoder_load_all();
135 sl = g_slist_copy((GSList *)srd_decoder_list());
136 sl = g_slist_sort(sl, sort_pds);
137 for (l = sl; l; l = l->next) {
139 printf(" %-20s %s\n", dec->id, dec->longname);
140 /* Print protocol description upon "-l 3" or higher. */
141 if (opt_loglevel >= SR_LOG_INFO)
142 printf(" %-20s %s\n", "", dec->desc);
151 static gint sort_channels(gconstpointer a, gconstpointer b)
153 const struct sr_channel *pa = a, *pb = b;
155 return pa->index - pb->index;
158 static void print_dev_line(const struct sr_dev_inst *sdi)
160 struct sr_channel *ch;
161 GSList *sl, *l, *channels;
164 struct sr_dev_driver *driver;
165 const char *vendor, *model, *version;
167 driver = sr_dev_inst_driver_get(sdi);
168 vendor = sr_dev_inst_vendor_get(sdi);
169 model = sr_dev_inst_model_get(sdi);
170 version = sr_dev_inst_version_get(sdi);
171 channels = sr_dev_inst_channels_get(sdi);
173 s = g_string_sized_new(128);
174 g_string_assign(s, driver->name);
175 if (maybe_config_get(driver, sdi, NULL, SR_CONF_CONN, &gvar) == SR_OK) {
176 g_string_append(s, ":conn=");
177 g_string_append(s, g_variant_get_string(gvar, NULL));
178 g_variant_unref(gvar);
180 g_string_append(s, " - ");
181 if (vendor && vendor[0])
182 g_string_append_printf(s, "%s ", vendor);
183 if (model && model[0])
184 g_string_append_printf(s, "%s ", model);
185 if (version && version[0])
186 g_string_append_printf(s, "%s ", version);
188 if (g_slist_length(channels) == 1) {
190 g_string_append_printf(s, "with 1 channel: %s", ch->name);
192 sl = g_slist_sort(g_slist_copy(channels), sort_channels);
193 g_string_append_printf(s, "with %d channels:", g_slist_length(sl));
194 for (l = sl; l; l = l->next) {
196 g_string_append_printf(s, " %s", ch->name);
201 g_string_append_printf(s, "\n");
202 printf("%s", s->str);
203 g_string_free(s, TRUE);
207 void show_dev_list(void)
209 struct sr_dev_inst *sdi;
212 if (!(devices = device_scan()))
215 printf("The following devices were found:\n");
216 for (l = devices; l; l = l->next) {
220 g_slist_free(devices);
224 void show_drv_detail(struct sr_dev_driver *driver)
226 const struct sr_key_info *srci;
228 const uint32_t *opts;
229 gsize num_elements, i;
231 if (sr_config_list(driver, NULL, NULL, SR_CONF_DEVICE_OPTIONS,
232 &gvar_opts) == SR_OK) {
233 opts = g_variant_get_fixed_array(gvar_opts, &num_elements,
236 printf("Driver functions:\n");
237 for (i = 0; i < num_elements; i++) {
238 if (!(srci = sr_key_info_get(SR_KEY_CONFIG, opts[i] & SR_CONF_MASK)))
240 printf(" %s\n", srci->name);
243 g_variant_unref(gvar_opts);
246 if (sr_config_list(driver, NULL, NULL, SR_CONF_SCAN_OPTIONS,
247 &gvar_opts) == SR_OK) {
248 opts = g_variant_get_fixed_array(gvar_opts, &num_elements,
251 printf("Scan options:\n");
252 for (i = 0; i < num_elements; i++) {
253 if (!(srci = sr_key_info_get(SR_KEY_CONFIG, opts[i] & SR_CONF_MASK)))
255 printf(" %s\n", srci->id);
258 g_variant_unref(gvar_opts);
262 void show_dev_detail(void)
264 struct sr_dev_driver *driver_from_opt, *driver;
265 struct sr_dev_inst *sdi;
266 const struct sr_key_info *srci, *srmqi, *srmqfi;
267 struct sr_channel *ch;
268 struct sr_channel_group *channel_group, *cg;
269 GSList *devices, *cgl, *chl, *channel_groups;
270 GVariant *gvar_opts, *gvar_dict, *gvar_list, *gvar;
271 gsize num_opts, num_elements;
272 double dlow, dhigh, dcur_low, dcur_high;
273 const uint64_t *uint64, p, q, low, high;
274 uint64_t tmp_uint64, mask, cur_low, cur_high, cur_p, cur_q;
275 const uint32_t *opts;
276 const int32_t *int32;
277 uint32_t key, o, cur_mq, mq;
278 uint64_t cur_mqflags, mqflags;
279 unsigned int num_devices, i, j;
280 char *tmp_str, *s, c;
281 const char **stropts;
283 if (parse_driver(opt_drv, &driver_from_opt, NULL)) {
284 /* A driver was specified, report driver-wide options now. */
285 show_drv_detail(driver_from_opt);
288 if (!(devices = device_scan())) {
289 g_critical("No devices found.");
293 num_devices = g_slist_length(devices);
294 if (num_devices > 1) {
295 g_critical("%d devices found. Use --scan to show them, "
296 "and select one to show.", num_devices);
301 g_slist_free(devices);
304 driver = sr_dev_inst_driver_get(sdi);
305 channel_groups = sr_dev_inst_channel_groups_get(sdi);
307 if (sr_dev_open(sdi) != SR_OK) {
308 g_critical("Failed to open device.");
313 * Selected channels and channel group may affect which options are
314 * returned, or which values for them.
316 select_channels(sdi);
317 channel_group = select_channel_group(sdi);
319 if (sr_config_list(driver, sdi, channel_group, SR_CONF_DEVICE_OPTIONS,
320 &gvar_opts) != SR_OK)
321 /* Driver supports no device instance options. */
324 if (channel_groups) {
325 printf("Channel groups:\n");
326 for (cgl = channel_groups; cgl; cgl = cgl->next) {
328 printf(" %s: channel%s", cg->name,
329 g_slist_length(cg->channels) > 1 ? "s" : "");
330 for (chl = cg->channels; chl; chl = chl->next) {
332 printf(" %s", ch->name);
338 printf("Supported configuration options");
339 if (channel_groups) {
341 printf(" across all channel groups");
343 printf(" on channel group %s", channel_group->name);
346 opts = g_variant_get_fixed_array(gvar_opts, &num_opts, sizeof(uint32_t));
347 for (o = 0; o < num_opts; o++) {
348 key = opts[o] & SR_CONF_MASK;
349 if (!(srci = sr_key_info_get(SR_KEY_CONFIG, key)))
352 if (key == SR_CONF_TRIGGER_MATCH) {
353 if (maybe_config_list(driver, sdi, channel_group, key,
354 &gvar_list) != SR_OK) {
358 int32 = g_variant_get_fixed_array(gvar_list,
359 &num_elements, sizeof(int32_t));
360 printf(" Supported triggers: ");
361 for (i = 0; i < num_elements; i++) {
363 case SR_TRIGGER_ZERO:
369 case SR_TRIGGER_RISING:
372 case SR_TRIGGER_FALLING:
375 case SR_TRIGGER_EDGE:
378 case SR_TRIGGER_OVER:
381 case SR_TRIGGER_UNDER:
392 g_variant_unref(gvar_list);
394 } else if (key == SR_CONF_LIMIT_SAMPLES
395 && config_key_has_cap(driver, sdi, NULL, key, SR_CONF_LIST)) {
397 * If implemented in config_list(), this denotes the
398 * maximum number of samples a device can send. This
399 * really applies only to logic analyzers, and then
400 * only to those that don't support compression, or
401 * have it turned off by default. The values returned
402 * are the low/high limits.
404 if (sr_config_list(driver, sdi, channel_group, key,
406 g_variant_get(gvar, "(tt)", &low, &high);
407 g_variant_unref(gvar);
408 printf(" Maximum number of samples: %"PRIu64"\n", high);
411 } else if (key == SR_CONF_SAMPLERATE) {
412 /* Supported samplerates */
413 printf(" %s", srci->id);
414 if (maybe_config_list(driver, sdi, channel_group, SR_CONF_SAMPLERATE,
415 &gvar_dict) != SR_OK) {
419 if ((gvar_list = g_variant_lookup_value(gvar_dict,
420 "samplerates", G_VARIANT_TYPE("at")))) {
421 uint64 = g_variant_get_fixed_array(gvar_list,
422 &num_elements, sizeof(uint64_t));
423 printf(" - supported samplerates:\n");
424 for (i = 0; i < num_elements; i++) {
425 if (!(s = sr_samplerate_string(uint64[i])))
430 g_variant_unref(gvar_list);
431 } else if ((gvar_list = g_variant_lookup_value(gvar_dict,
432 "samplerate-steps", G_VARIANT_TYPE("at")))) {
433 uint64 = g_variant_get_fixed_array(gvar_list,
434 &num_elements, sizeof(uint64_t));
436 if (!(s = sr_samplerate_string(uint64[0])))
441 if (!(s = sr_samplerate_string(uint64[1])))
446 if (!(s = sr_samplerate_string(uint64[2])))
448 printf(" in steps of %s)\n", s);
450 g_variant_unref(gvar_list);
452 g_variant_unref(gvar_dict);
454 } else if (srci->datatype == SR_T_UINT64) {
455 printf(" %s: ", srci->id);
457 if (maybe_config_get(driver, sdi, channel_group, key,
459 tmp_uint64 = g_variant_get_uint64(gvar);
460 g_variant_unref(gvar);
463 if (maybe_config_list(driver, sdi, channel_group,
464 key, &gvar_list) != SR_OK) {
466 /* Can't list it, but we have a value to show. */
467 printf("%"PRIu64" (current)", tmp_uint64);
472 uint64 = g_variant_get_fixed_array(gvar_list,
473 &num_elements, sizeof(uint64_t));
474 printf(" - supported values:\n");
475 for (i = 0; i < num_elements; i++) {
476 printf(" %"PRIu64, uint64[i]);
477 if (gvar && tmp_uint64 == uint64[i])
478 printf(" (current)");
481 g_variant_unref(gvar_list);
483 } else if (srci->datatype == SR_T_STRING) {
484 printf(" %s: ", srci->id);
485 if (maybe_config_get(driver, sdi, channel_group, key,
487 tmp_str = g_strdup(g_variant_get_string(gvar, NULL));
488 g_variant_unref(gvar);
492 if (maybe_config_list(driver, sdi, channel_group, key,
495 /* Can't list it, but we have a value to show. */
496 printf("%s (current)", tmp_str);
503 stropts = g_variant_get_strv(gvar, &num_elements);
504 for (i = 0; i < num_elements; i++) {
507 printf("%s", stropts[i]);
508 if (tmp_str && !strcmp(tmp_str, stropts[i]))
509 printf(" (current)");
514 g_variant_unref(gvar);
516 } else if (srci->datatype == SR_T_UINT64_RANGE) {
517 printf(" %s: ", srci->id);
518 if (maybe_config_list(driver, sdi, channel_group, key,
519 &gvar_list) != SR_OK) {
524 if (maybe_config_get(driver, sdi, channel_group, key, &gvar) == SR_OK) {
525 g_variant_get(gvar, "(tt)", &cur_low, &cur_high);
526 g_variant_unref(gvar);
532 num_elements = g_variant_n_children(gvar_list);
533 for (i = 0; i < num_elements; i++) {
534 gvar = g_variant_get_child_value(gvar_list, i);
535 g_variant_get(gvar, "(tt)", &low, &high);
536 g_variant_unref(gvar);
539 printf("%"PRIu64"-%"PRIu64, low, high);
540 if (low == cur_low && high == cur_high)
541 printf(" (current)");
544 g_variant_unref(gvar_list);
546 } else if (srci->datatype == SR_T_BOOL) {
547 printf(" %s: ", srci->id);
548 if (maybe_config_get(driver, sdi, channel_group, key,
550 if (g_variant_get_boolean(gvar))
551 printf("on (current), off\n");
553 printf("on, off (current)\n");
554 g_variant_unref(gvar);
558 } else if (srci->datatype == SR_T_DOUBLE_RANGE) {
559 printf(" %s: ", srci->id);
560 if (maybe_config_list(driver, sdi, channel_group, key,
561 &gvar_list) != SR_OK) {
566 if (maybe_config_get(driver, sdi, channel_group, key, &gvar) == SR_OK) {
567 g_variant_get(gvar, "(dd)", &dcur_low, &dcur_high);
568 g_variant_unref(gvar);
574 num_elements = g_variant_n_children(gvar_list);
575 for (i = 0; i < num_elements; i++) {
576 gvar = g_variant_get_child_value(gvar_list, i);
577 g_variant_get(gvar, "(dd)", &dlow, &dhigh);
578 g_variant_unref(gvar);
581 printf("%.1f-%.1f", dlow, dhigh);
582 if (dlow == dcur_low && dhigh == dcur_high)
583 printf(" (current)");
586 g_variant_unref(gvar_list);
588 } else if (srci->datatype == SR_T_FLOAT) {
589 printf(" %s: ", srci->id);
590 if (maybe_config_get(driver, sdi, channel_group, key,
592 printf("%f\n", g_variant_get_double(gvar));
593 g_variant_unref(gvar);
597 } else if (srci->datatype == SR_T_RATIONAL_PERIOD
598 || srci->datatype == SR_T_RATIONAL_VOLT) {
599 printf(" %s", srci->id);
600 if (maybe_config_get(driver, sdi, channel_group, key,
602 g_variant_get(gvar, "(tt)", &cur_p, &cur_q);
603 g_variant_unref(gvar);
607 if (maybe_config_list(driver, sdi, channel_group,
608 key, &gvar_list) != SR_OK) {
612 printf(" - supported values:\n");
613 num_elements = g_variant_n_children(gvar_list);
614 for (i = 0; i < num_elements; i++) {
615 gvar = g_variant_get_child_value(gvar_list, i);
616 g_variant_get(gvar, "(tt)", &p, &q);
617 if (srci->datatype == SR_T_RATIONAL_PERIOD)
618 s = sr_period_string(p * q);
620 s = sr_voltage_string(p, q);
623 if (p == cur_p && q == cur_q)
624 printf(" (current)");
627 g_variant_unref(gvar_list);
629 } else if (srci->datatype == SR_T_MQ) {
630 printf(" %s: ", srci->id);
631 if (maybe_config_get(driver, sdi, channel_group, key,
633 && g_variant_is_of_type(gvar, G_VARIANT_TYPE_TUPLE)
634 && g_variant_n_children(gvar) == 2) {
635 g_variant_get(gvar, "(ut)", &cur_mq, &cur_mqflags);
636 g_variant_unref(gvar);
638 cur_mq = cur_mqflags = 0;
640 if (maybe_config_list(driver, sdi, channel_group,
641 key, &gvar_list) != SR_OK) {
645 printf(" - supported measurements:\n");
646 num_elements = g_variant_n_children(gvar_list);
647 for (i = 0; i < num_elements; i++) {
649 gvar = g_variant_get_child_value(gvar_list, i);
650 g_variant_get(gvar, "(ut)", &mq, &mqflags);
651 if ((srmqi = sr_key_info_get(SR_KEY_MQ, mq)))
652 printf("%s", srmqi->id);
655 for (j = 0, mask = 1; j < 32; j++, mask <<= 1) {
656 if (!(mqflags & mask))
658 if ((srmqfi = sr_key_info_get(SR_KEY_MQFLAGS, mqflags & mask)))
659 printf("/%s", srmqfi->id);
661 printf("/%ld", mqflags & mask);
663 if (mq == cur_mq && mqflags == cur_mqflags)
664 printf(" (current)");
667 g_variant_unref(gvar_list);
671 /* Everything else */
672 printf(" %s\n", srci->id);
675 g_variant_unref(gvar_opts);
682 void show_pd_detail(void)
684 struct srd_decoder *dec;
685 struct srd_decoder_option *o;
686 struct srd_channel *pdch;
687 struct srd_decoder_annotation_row *r;
690 char **pdtokens, **pdtok, *optsep, **ann, *val, *doc;
692 pdtokens = g_strsplit(opt_pds, ",", -1);
693 for (pdtok = pdtokens; *pdtok; pdtok++) {
695 if ((optsep = strchr(*pdtok, ':')))
697 if (!(dec = srd_decoder_get_by_id(*pdtok))) {
698 g_critical("Protocol decoder %s not found.", *pdtok);
701 printf("ID: %s\nName: %s\nLong name: %s\nDescription: %s\n",
702 dec->id, dec->name, dec->longname, dec->desc);
703 printf("License: %s\n", dec->license);
704 printf("Annotation classes:\n");
705 if (dec->annotations) {
706 for (l = dec->annotations; l; l = l->next) {
708 printf("- %s: %s\n", ann[0], ann[1]);
713 printf("Annotation rows:\n");
714 if (dec->annotation_rows) {
715 for (l = dec->annotation_rows; l; l = l->next) {
717 printf("- %s (%s): ", r->id, r->desc);
718 for (ll = r->ann_classes; ll; ll = ll->next) {
719 idx = GPOINTER_TO_INT(ll->data);
720 ann = g_slist_nth_data(dec->annotations, idx);
721 printf("%s", ann[0]);
730 printf("Required channels:\n");
732 for (l = dec->channels; l; l = l->next) {
734 printf("- %s (%s): %s\n",
735 pdch->id, pdch->name, pdch->desc);
740 printf("Optional channels:\n");
741 if (dec->opt_channels) {
742 for (l = dec->opt_channels; l; l = l->next) {
744 printf("- %s (%s): %s\n",
745 pdch->id, pdch->name, pdch->desc);
750 printf("Options:\n");
752 for (l = dec->options; l; l = l->next) {
754 printf("- %s: %s (", o->id, o->desc);
755 for (ol = o->values; ol; ol = ol->next) {
756 val = g_variant_print(ol->data, FALSE);
760 val = g_variant_print(o->def, FALSE);
761 printf("default %s)\n", val);
767 if ((doc = srd_decoder_doc_get(dec))) {
768 printf("Documentation:\n%s\n",
769 doc[0] == '\n' ? doc + 1 : doc);
774 g_strfreev(pdtokens);
778 void show_input(void)
780 const struct sr_input_module *imod;
781 const struct sr_option **opts;
786 tok = g_strsplit(opt_input_format, ":", 0);
787 if (!tok[0] || !(imod = sr_input_find(tok[0])))
788 g_critical("Input module '%s' not found.", opt_input_format);
790 printf("ID: %s\nName: %s\n", sr_input_id_get(imod),
791 sr_input_name_get(imod));
792 printf("Description: %s\n", sr_input_description_get(imod));
793 if ((opts = sr_input_options_get(imod))) {
794 printf("Options:\n");
795 for (i = 0; opts[i]; i++) {
796 printf(" %s: %s", opts[i]->id, opts[i]->desc);
798 s = g_variant_print(opts[i]->def, FALSE);
799 printf(" (default %s", s);
801 if (opts[i]->values) {
802 printf(", possible values ");
803 for (l = opts[i]->values; l; l = l->next) {
804 s = g_variant_print((GVariant *)l->data, FALSE);
805 printf("%s%s", s, l->next ? ", " : "");
813 sr_input_options_free(opts);
818 void show_output(void)
820 const struct sr_output_module *omod;
821 const struct sr_option **opts;
826 tok = g_strsplit(opt_output_format, ":", 0);
827 if (!tok[0] || !(omod = sr_output_find(tok[0])))
828 g_critical("Output module '%s' not found.", opt_output_format);
830 printf("ID: %s\nName: %s\n", sr_output_id_get(omod),
831 sr_output_name_get(omod));
832 printf("Description: %s\n", sr_output_description_get(omod));
833 if ((opts = sr_output_options_get(omod))) {
834 printf("Options:\n");
835 for (i = 0; opts[i]; i++) {
836 printf(" %s: %s", opts[i]->id, opts[i]->desc);
838 s = g_variant_print(opts[i]->def, FALSE);
839 printf(" (default %s", s);
841 if (opts[i]->values) {
842 printf(", possible values ");
843 for (l = opts[i]->values; l; l = l->next) {
844 s = g_variant_print((GVariant *)l->data, FALSE);
845 printf("%s%s", s, l->next ? ", " : "");
853 sr_output_options_free(opts);
858 void show_transform(void)
860 const struct sr_transform_module *tmod;
861 const struct sr_option **opts;
866 tok = g_strsplit(opt_transform_module, ":", 0);
867 if (!tok[0] || !(tmod = sr_transform_find(tok[0])))
868 g_critical("Transform module '%s' not found.", opt_transform_module);
870 printf("ID: %s\nName: %s\n", sr_transform_id_get(tmod),
871 sr_transform_name_get(tmod));
872 printf("Description: %s\n", sr_transform_description_get(tmod));
873 if ((opts = sr_transform_options_get(tmod))) {
874 printf("Options:\n");
875 for (i = 0; opts[i]; i++) {
876 printf(" %s: %s", opts[i]->id, opts[i]->desc);
878 s = g_variant_print(opts[i]->def, FALSE);
879 printf(" (default %s", s);
881 if (opts[i]->values) {
882 printf(", possible values ");
883 for (l = opts[i]->values; l; l = l->next) {
884 s = g_variant_print((GVariant *)l->data, FALSE);
885 printf("%s%s", s, l->next ? ", " : "");
893 sr_transform_options_free(opts);