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/>.
23 #include "sigrok-cli.h"
25 static gint sort_inputs(gconstpointer a, gconstpointer b)
27 return strcmp(sr_input_id_get((struct sr_input_module *)a),
28 sr_input_id_get((struct sr_input_module *)b));
31 static gint sort_outputs(gconstpointer a, gconstpointer b)
33 return strcmp(sr_output_id_get((struct sr_output_module *)a),
34 sr_output_id_get((struct sr_output_module *)b));
37 static gint sort_transforms(gconstpointer a, gconstpointer b)
39 return strcmp(sr_transform_id_get((struct sr_transform_module *)a),
40 sr_transform_id_get((struct sr_transform_module *)b));
43 static gint sort_drivers(gconstpointer a, gconstpointer b)
45 const struct sr_dev_driver *sdda = a, *sddb = b;
47 return strcmp(sdda->name, sddb->name);
51 static gint sort_pds(gconstpointer a, gconstpointer b)
53 const struct srd_decoder *sda = a, *sdb = b;
55 return strcmp(sda->id, sdb->id);
59 void show_version(void)
61 printf("sigrok-cli %s\n\n", SC_PACKAGE_VERSION_STRING);
63 printf("Using libsigrok %s (lib version %s).\n",
64 sr_package_version_string_get(), sr_lib_version_string_get());
66 printf("Using libsigrokdecode %s (lib version %s).\n\n",
67 srd_package_version_string_get(), srd_lib_version_string_get());
71 void show_supported(void)
73 struct sr_dev_driver **drivers, *driver;
74 const struct sr_input_module **inputs, *input;
75 const struct sr_output_module **outputs, *output;
76 const struct sr_transform_module **transforms, *transform;
81 struct srd_decoder *dec;
84 printf("Supported hardware drivers:\n");
85 drivers = sr_driver_list(sr_ctx);
86 for (sl = NULL, i = 0; drivers[i]; i++)
87 sl = g_slist_append(sl, drivers[i]);
88 sl = g_slist_sort(sl, sort_drivers);
89 for (l = sl; l; l = l->next) {
91 printf(" %-20s %s\n", driver->name, driver->longname);
96 printf("Supported input formats:\n");
97 inputs = sr_input_list();
98 for (sl = NULL, i = 0; inputs[i]; i++)
99 sl = g_slist_append(sl, (gpointer)inputs[i]);
100 sl = g_slist_sort(sl, sort_inputs);
101 for (l = sl; l; l = l->next) {
103 printf(" %-20s %s\n", sr_input_id_get(input),
104 sr_input_description_get(input));
109 printf("Supported output formats:\n");
110 outputs = sr_output_list();
111 for (sl = NULL, i = 0; outputs[i]; i++)
112 sl = g_slist_append(sl, (gpointer)outputs[i]);
113 sl = g_slist_sort(sl, sort_outputs);
114 for (l = sl; l; l = l->next) {
116 printf(" %-20s %s\n", sr_output_id_get(output),
117 sr_output_description_get(output));
122 printf("Supported transform modules:\n");
123 transforms = sr_transform_list();
124 for (sl = NULL, i = 0; transforms[i]; i++)
125 sl = g_slist_append(sl, (gpointer)transforms[i]);
126 sl = g_slist_sort(sl, sort_transforms);
127 for (l = sl; l; l = l->next) {
129 printf(" %-20s %s\n", sr_transform_id_get(transform),
130 sr_transform_description_get(transform));
136 if (srd_init(NULL) == SRD_OK) {
137 printf("Supported protocol decoders:\n");
138 srd_decoder_load_all();
139 sl = g_slist_copy((GSList *)srd_decoder_list());
140 sl = g_slist_sort(sl, sort_pds);
141 for (l = sl; l; l = l->next) {
143 printf(" %-20s %s\n", dec->id, dec->longname);
144 /* Print protocol description upon "-l 3" or higher. */
145 if (opt_loglevel >= SR_LOG_INFO)
146 printf(" %-20s %s\n", "", dec->desc);
155 static gint sort_channels(gconstpointer a, gconstpointer b)
157 const struct sr_channel *pa = a, *pb = b;
159 return pa->index - pb->index;
162 static void print_dev_line(const struct sr_dev_inst *sdi)
164 struct sr_channel *ch;
165 GSList *sl, *l, *channels;
168 struct sr_dev_driver *driver;
169 const char *vendor, *model, *version;
171 driver = sr_dev_inst_driver_get(sdi);
172 vendor = sr_dev_inst_vendor_get(sdi);
173 model = sr_dev_inst_model_get(sdi);
174 version = sr_dev_inst_version_get(sdi);
175 channels = sr_dev_inst_channels_get(sdi);
177 s = g_string_sized_new(128);
178 g_string_assign(s, driver->name);
179 if (maybe_config_get(driver, sdi, NULL, SR_CONF_CONN, &gvar) == SR_OK) {
180 g_string_append(s, ":conn=");
181 g_string_append(s, g_variant_get_string(gvar, NULL));
182 g_variant_unref(gvar);
184 g_string_append(s, " - ");
185 if (vendor && vendor[0])
186 g_string_append_printf(s, "%s ", vendor);
187 if (model && model[0])
188 g_string_append_printf(s, "%s ", model);
189 if (version && version[0])
190 g_string_append_printf(s, "%s ", version);
192 if (g_slist_length(channels) == 1) {
194 g_string_append_printf(s, "with 1 channel: %s", ch->name);
196 sl = g_slist_sort(g_slist_copy(channels), sort_channels);
197 g_string_append_printf(s, "with %d channels:", g_slist_length(sl));
198 for (l = sl; l; l = l->next) {
200 g_string_append_printf(s, " %s", ch->name);
205 g_string_append_printf(s, "\n");
206 printf("%s", s->str);
207 g_string_free(s, TRUE);
211 void show_dev_list(void)
213 struct sr_dev_inst *sdi;
216 if (!(devices = device_scan()))
219 printf("The following devices were found:\n");
220 for (l = devices; l; l = l->next) {
224 g_slist_free(devices);
228 void show_drv_detail(struct sr_dev_driver *driver)
230 const struct sr_key_info *srci;
234 if ((opts = sr_dev_options(driver, NULL, NULL))) {
236 printf("Driver functions:\n");
237 for (i = 0; i < opts->len; i++) {
238 if (!(srci = sr_key_info_get(SR_KEY_CONFIG,
239 g_array_index(opts, uint32_t, i))))
241 printf(" %s\n", srci->name);
244 g_array_free(opts, TRUE);
247 if ((opts = sr_driver_scan_options_list(driver))) {
249 printf("Scan options:\n");
250 for (i = 0; i < opts->len; i++) {
251 if (!(srci = sr_key_info_get(SR_KEY_CONFIG,
252 g_array_index(opts, uint32_t, i))))
254 printf(" %s\n", srci->id);
257 g_array_free(opts, TRUE);
261 void show_dev_detail(void)
263 struct sr_dev_driver *driver_from_opt, *driver;
264 struct sr_dev_inst *sdi;
265 const struct sr_key_info *srci, *srmqi, *srmqfi;
266 struct sr_channel *ch;
267 struct sr_channel_group *channel_group, *cg;
268 GSList *devices, *cgl, *chl, *channel_groups;
269 GVariant *gvar_dict, *gvar_list, *gvar;
271 double dlow, dhigh, dcur_low, dcur_high;
272 const uint64_t *uint64, p, q, low, high;
273 uint64_t tmp_uint64, mask, cur_low, cur_high, cur_p, cur_q;
275 const int32_t *int32;
276 uint32_t key, o, cur_mq, mq;
277 uint64_t cur_mqflags, mqflags;
278 unsigned int num_devices, i, j;
279 char *tmp_str, *s, c;
280 const char **stropts;
282 if (parse_driver(opt_drv, &driver_from_opt, NULL)) {
283 /* A driver was specified, report driver-wide options now. */
284 show_drv_detail(driver_from_opt);
287 if (!(devices = device_scan())) {
288 g_critical("No devices found.");
292 num_devices = g_slist_length(devices);
293 if (num_devices > 1) {
294 g_critical("%d devices found. Use --scan to show them, "
295 "and select one to show.", num_devices);
300 g_slist_free(devices);
303 driver = sr_dev_inst_driver_get(sdi);
304 channel_groups = sr_dev_inst_channel_groups_get(sdi);
306 if (sr_dev_open(sdi) != SR_OK) {
307 g_critical("Failed to open device.");
312 * Selected channels and channel group may affect which options are
313 * returned, or which values for them.
315 select_channels(sdi);
316 channel_group = select_channel_group(sdi);
318 if (!(opts = sr_dev_options(driver, sdi, channel_group)))
319 /* Driver supports no device instance options. */
322 if (channel_groups) {
323 printf("Channel groups:\n");
324 for (cgl = channel_groups; cgl; cgl = cgl->next) {
326 printf(" %s: channel%s", cg->name,
327 g_slist_length(cg->channels) > 1 ? "s" : "");
328 for (chl = cg->channels; chl; chl = chl->next) {
330 printf(" %s", ch->name);
336 printf("Supported configuration options");
337 if (channel_groups) {
339 printf(" across all channel groups");
341 printf(" on channel group %s", channel_group->name);
344 for (o = 0; o < opts->len; o++) {
345 key = g_array_index(opts, uint32_t, o);
346 if (!(srci = sr_key_info_get(SR_KEY_CONFIG, key)))
349 if (key == SR_CONF_TRIGGER_MATCH) {
350 if (maybe_config_list(driver, sdi, channel_group, key,
351 &gvar_list) != SR_OK) {
355 int32 = g_variant_get_fixed_array(gvar_list,
356 &num_elements, sizeof(int32_t));
357 printf(" Supported triggers: ");
358 for (i = 0; i < num_elements; i++) {
360 case SR_TRIGGER_ZERO:
366 case SR_TRIGGER_RISING:
369 case SR_TRIGGER_FALLING:
372 case SR_TRIGGER_EDGE:
375 case SR_TRIGGER_OVER:
378 case SR_TRIGGER_UNDER:
389 g_variant_unref(gvar_list);
391 } else if (key == SR_CONF_LIMIT_SAMPLES
392 && (sr_dev_config_capabilities_list(sdi, NULL, key)
395 * If implemented in config_list(), this denotes the
396 * maximum number of samples a device can send. This
397 * really applies only to logic analyzers, and then
398 * only to those that don't support compression, or
399 * have it turned off by default. The values returned
400 * are the low/high limits.
402 if (sr_config_list(driver, sdi, channel_group, key,
404 g_variant_get(gvar, "(tt)", &low, &high);
405 g_variant_unref(gvar);
406 printf(" Maximum number of samples: %"PRIu64"\n", high);
409 } else if (key == SR_CONF_SAMPLERATE) {
410 /* Supported samplerates */
411 printf(" %s", srci->id);
412 if (maybe_config_list(driver, sdi, channel_group, SR_CONF_SAMPLERATE,
413 &gvar_dict) != SR_OK) {
417 if ((gvar_list = g_variant_lookup_value(gvar_dict,
418 "samplerates", G_VARIANT_TYPE("at")))) {
419 uint64 = g_variant_get_fixed_array(gvar_list,
420 &num_elements, sizeof(uint64_t));
421 printf(" - supported samplerates:\n");
422 for (i = 0; i < num_elements; i++) {
423 if (!(s = sr_samplerate_string(uint64[i])))
428 g_variant_unref(gvar_list);
429 } else if ((gvar_list = g_variant_lookup_value(gvar_dict,
430 "samplerate-steps", G_VARIANT_TYPE("at")))) {
431 uint64 = g_variant_get_fixed_array(gvar_list,
432 &num_elements, sizeof(uint64_t));
434 if (!(s = sr_samplerate_string(uint64[0])))
439 if (!(s = sr_samplerate_string(uint64[1])))
444 if (!(s = sr_samplerate_string(uint64[2])))
446 printf(" in steps of %s)\n", s);
448 g_variant_unref(gvar_list);
450 g_variant_unref(gvar_dict);
452 } else if (srci->datatype == SR_T_UINT64) {
453 printf(" %s: ", srci->id);
455 if (maybe_config_get(driver, sdi, channel_group, key,
457 tmp_uint64 = g_variant_get_uint64(gvar);
458 g_variant_unref(gvar);
461 if (maybe_config_list(driver, sdi, channel_group,
462 key, &gvar_list) != SR_OK) {
464 /* Can't list it, but we have a value to show. */
465 printf("%"PRIu64" (current)", tmp_uint64);
470 uint64 = g_variant_get_fixed_array(gvar_list,
471 &num_elements, sizeof(uint64_t));
472 printf(" - supported values:\n");
473 for (i = 0; i < num_elements; i++) {
474 printf(" %"PRIu64, uint64[i]);
475 if (gvar && tmp_uint64 == uint64[i])
476 printf(" (current)");
479 g_variant_unref(gvar_list);
481 } else if (srci->datatype == SR_T_STRING) {
482 printf(" %s: ", srci->id);
483 if (maybe_config_get(driver, sdi, channel_group, key,
485 tmp_str = g_strdup(g_variant_get_string(gvar, NULL));
486 g_variant_unref(gvar);
490 if (maybe_config_list(driver, sdi, channel_group, key,
493 /* Can't list it, but we have a value to show. */
494 printf("%s (current)", tmp_str);
501 stropts = g_variant_get_strv(gvar, &num_elements);
502 for (i = 0; i < num_elements; i++) {
505 printf("%s", stropts[i]);
506 if (tmp_str && !strcmp(tmp_str, stropts[i]))
507 printf(" (current)");
512 g_variant_unref(gvar);
514 } else if (srci->datatype == SR_T_UINT64_RANGE) {
515 printf(" %s: ", srci->id);
516 if (maybe_config_list(driver, sdi, channel_group, key,
517 &gvar_list) != SR_OK) {
522 if (maybe_config_get(driver, sdi, channel_group, key, &gvar) == SR_OK) {
523 g_variant_get(gvar, "(tt)", &cur_low, &cur_high);
524 g_variant_unref(gvar);
530 num_elements = g_variant_n_children(gvar_list);
531 for (i = 0; i < num_elements; i++) {
532 gvar = g_variant_get_child_value(gvar_list, i);
533 g_variant_get(gvar, "(tt)", &low, &high);
534 g_variant_unref(gvar);
537 printf("%"PRIu64"-%"PRIu64, low, high);
538 if (low == cur_low && high == cur_high)
539 printf(" (current)");
542 g_variant_unref(gvar_list);
544 } else if (srci->datatype == SR_T_BOOL) {
545 printf(" %s: ", srci->id);
546 if (maybe_config_get(driver, sdi, channel_group, key,
548 if (g_variant_get_boolean(gvar))
549 printf("on (current), off\n");
551 printf("on, off (current)\n");
552 g_variant_unref(gvar);
556 } else if (srci->datatype == SR_T_DOUBLE_RANGE) {
557 printf(" %s: ", srci->id);
558 if (maybe_config_list(driver, sdi, channel_group, key,
559 &gvar_list) != SR_OK) {
564 if (maybe_config_get(driver, sdi, channel_group, key, &gvar) == SR_OK) {
565 g_variant_get(gvar, "(dd)", &dcur_low, &dcur_high);
566 g_variant_unref(gvar);
572 num_elements = g_variant_n_children(gvar_list);
573 for (i = 0; i < num_elements; i++) {
574 gvar = g_variant_get_child_value(gvar_list, i);
575 g_variant_get(gvar, "(dd)", &dlow, &dhigh);
576 g_variant_unref(gvar);
579 printf("%.1f-%.1f", dlow, dhigh);
580 if (dlow == dcur_low && dhigh == dcur_high)
581 printf(" (current)");
584 g_variant_unref(gvar_list);
586 } else if (srci->datatype == SR_T_FLOAT) {
587 printf(" %s: ", srci->id);
588 if (maybe_config_get(driver, sdi, channel_group, key,
590 printf("%f\n", g_variant_get_double(gvar));
591 g_variant_unref(gvar);
595 } else if (srci->datatype == SR_T_RATIONAL_PERIOD
596 || srci->datatype == SR_T_RATIONAL_VOLT) {
597 printf(" %s", srci->id);
598 if (maybe_config_get(driver, sdi, channel_group, key,
600 g_variant_get(gvar, "(tt)", &cur_p, &cur_q);
601 g_variant_unref(gvar);
605 if (maybe_config_list(driver, sdi, channel_group,
606 key, &gvar_list) != SR_OK) {
610 printf(" - supported values:\n");
611 num_elements = g_variant_n_children(gvar_list);
612 for (i = 0; i < num_elements; i++) {
613 gvar = g_variant_get_child_value(gvar_list, i);
614 g_variant_get(gvar, "(tt)", &p, &q);
615 if (srci->datatype == SR_T_RATIONAL_PERIOD)
616 s = sr_period_string(p, q);
618 s = sr_voltage_string(p, q);
621 if (p == cur_p && q == cur_q)
622 printf(" (current)");
625 g_variant_unref(gvar_list);
627 } else if (srci->datatype == SR_T_MQ) {
628 printf(" %s: ", srci->id);
629 if (maybe_config_get(driver, sdi, channel_group, key,
631 && g_variant_is_of_type(gvar, G_VARIANT_TYPE_TUPLE)
632 && g_variant_n_children(gvar) == 2) {
633 g_variant_get(gvar, "(ut)", &cur_mq, &cur_mqflags);
634 g_variant_unref(gvar);
636 cur_mq = cur_mqflags = 0;
638 if (maybe_config_list(driver, sdi, channel_group,
639 key, &gvar_list) != SR_OK) {
643 printf(" - supported measurements:\n");
644 num_elements = g_variant_n_children(gvar_list);
645 for (i = 0; i < num_elements; i++) {
647 gvar = g_variant_get_child_value(gvar_list, i);
648 g_variant_get(gvar, "(ut)", &mq, &mqflags);
649 if ((srmqi = sr_key_info_get(SR_KEY_MQ, mq)))
650 printf("%s", srmqi->id);
653 for (j = 0, mask = 1; j < 32; j++, mask <<= 1) {
654 if (!(mqflags & mask))
656 if ((srmqfi = sr_key_info_get(SR_KEY_MQFLAGS, mqflags & mask)))
657 printf("/%s", srmqfi->id);
659 printf("/%" PRIu64, mqflags & mask);
661 if (mq == cur_mq && mqflags == cur_mqflags)
662 printf(" (current)");
665 g_variant_unref(gvar_list);
669 /* Everything else */
670 printf(" %s\n", srci->id);
673 g_array_free(opts, TRUE);
680 static void show_pd_detail_single(const char *pd)
682 struct srd_decoder *dec;
683 struct srd_decoder_option *o;
684 struct srd_channel *pdch;
685 struct srd_decoder_annotation_row *r;
688 char **pdtokens, **pdtok, *optsep, **ann, **bin, *val, *doc, *str;
690 pdtokens = g_strsplit(pd, ",", -1);
691 for (pdtok = pdtokens; *pdtok; pdtok++) {
693 if ((optsep = strchr(*pdtok, ':')))
695 if (!(dec = srd_decoder_get_by_id(*pdtok))) {
696 g_critical("Protocol decoder %s not found.", *pdtok);
699 printf("ID: %s\nName: %s\nLong name: %s\nDescription: %s\n",
700 dec->id, dec->name, dec->longname, dec->desc);
701 printf("License: %s\n", dec->license);
702 printf("Possible decoder input IDs:\n");
704 for (l = dec->inputs; l; l = l->next) {
706 printf("- %s\n", str);
711 printf("Possible decoder output IDs:\n");
713 for (l = dec->outputs; l; l = l->next) {
715 printf("- %s\n", str);
720 printf("Annotation classes:\n");
721 if (dec->annotations) {
722 for (l = dec->annotations; l; l = l->next) {
724 printf("- %s: %s\n", ann[0], ann[1]);
729 printf("Annotation rows:\n");
730 if (dec->annotation_rows) {
731 for (l = dec->annotation_rows; l; l = l->next) {
733 printf("- %s (%s): ", r->id, r->desc);
734 for (ll = r->ann_classes; ll; ll = ll->next) {
735 idx = GPOINTER_TO_INT(ll->data);
736 ann = g_slist_nth_data(dec->annotations, idx);
737 printf("%s", ann[0]);
746 printf("Binary classes:\n");
748 for (l = dec->binary; l; l = l->next) {
750 printf("- %s: %s\n", bin[0], bin[1]);
755 printf("Required channels:\n");
757 for (l = dec->channels; l; l = l->next) {
759 printf("- %s (%s): %s\n",
760 pdch->id, pdch->name, pdch->desc);
765 printf("Optional channels:\n");
766 if (dec->opt_channels) {
767 for (l = dec->opt_channels; l; l = l->next) {
769 printf("- %s (%s): %s\n",
770 pdch->id, pdch->name, pdch->desc);
775 printf("Options:\n");
777 for (l = dec->options; l; l = l->next) {
779 printf("- %s: %s (", o->id, o->desc);
780 for (ol = o->values; ol; ol = ol->next) {
781 val = g_variant_print(ol->data, FALSE);
785 val = g_variant_print(o->def, FALSE);
786 printf("default %s)\n", val);
792 if ((doc = srd_decoder_doc_get(dec))) {
793 printf("Documentation:\n%s\n",
794 doc[0] == '\n' ? doc + 1 : doc);
799 g_strfreev(pdtokens);
802 void show_pd_detail(void)
804 for (int i = 0; opt_pds[i]; i++)
805 show_pd_detail_single(opt_pds[i]);
809 void show_input(void)
811 const struct sr_input_module *imod;
812 const struct sr_option **opts;
817 tok = g_strsplit(opt_input_format, ":", 0);
818 if (!tok[0] || !(imod = sr_input_find(tok[0])))
819 g_critical("Input module '%s' not found.", opt_input_format);
821 printf("ID: %s\nName: %s\n", sr_input_id_get(imod),
822 sr_input_name_get(imod));
823 printf("Description: %s\n", sr_input_description_get(imod));
824 if ((opts = sr_input_options_get(imod))) {
825 printf("Options:\n");
826 for (i = 0; opts[i]; i++) {
827 printf(" %s: %s", opts[i]->id, opts[i]->desc);
829 s = g_variant_print(opts[i]->def, FALSE);
830 printf(" (default %s", s);
832 if (opts[i]->values) {
833 printf(", possible values ");
834 for (l = opts[i]->values; l; l = l->next) {
835 s = g_variant_print((GVariant *)l->data, FALSE);
836 printf("%s%s", s, l->next ? ", " : "");
844 sr_input_options_free(opts);
849 void show_output(void)
851 const struct sr_output_module *omod;
852 const struct sr_option **opts;
857 tok = g_strsplit(opt_output_format, ":", 0);
858 if (!tok[0] || !(omod = sr_output_find(tok[0])))
859 g_critical("Output module '%s' not found.", opt_output_format);
861 printf("ID: %s\nName: %s\n", sr_output_id_get(omod),
862 sr_output_name_get(omod));
863 printf("Description: %s\n", sr_output_description_get(omod));
864 if ((opts = sr_output_options_get(omod))) {
865 printf("Options:\n");
866 for (i = 0; opts[i]; i++) {
867 printf(" %s: %s", opts[i]->id, opts[i]->desc);
869 s = g_variant_print(opts[i]->def, FALSE);
870 printf(" (default %s", s);
872 if (opts[i]->values) {
873 printf(", possible values ");
874 for (l = opts[i]->values; l; l = l->next) {
875 s = g_variant_print((GVariant *)l->data, FALSE);
876 printf("%s%s", s, l->next ? ", " : "");
884 sr_output_options_free(opts);
889 void show_transform(void)
891 const struct sr_transform_module *tmod;
892 const struct sr_option **opts;
897 tok = g_strsplit(opt_transform_module, ":", 0);
898 if (!tok[0] || !(tmod = sr_transform_find(tok[0])))
899 g_critical("Transform module '%s' not found.", opt_transform_module);
901 printf("ID: %s\nName: %s\n", sr_transform_id_get(tmod),
902 sr_transform_name_get(tmod));
903 printf("Description: %s\n", sr_transform_description_get(tmod));
904 if ((opts = sr_transform_options_get(tmod))) {
905 printf("Options:\n");
906 for (i = 0; opts[i]; i++) {
907 printf(" %s: %s", opts[i]->id, opts[i]->desc);
909 s = g_variant_print(opts[i]->def, FALSE);
910 printf(" (default %s", s);
912 if (opts[i]->values) {
913 printf(", possible values ");
914 for (l = opts[i]->values; l; l = l->next) {
915 s = g_variant_print((GVariant *)l->data, FALSE);
916 printf("%s%s", s, l->next ? ", " : "");
924 sr_transform_options_free(opts);