int ret;
char *s;
struct sr_dev_driver *driver;
+ const struct sr_key_info *srci, *srmqi, *srmqfi;
+ uint32_t mq;
+ uint64_t mask, mqflags;
+ unsigned int j;
if (!(devices = device_scan())) {
g_critical("No devices found.");
if ((devargs = parse_generic_arg(opt_config, FALSE)))
set_dev_options(sdi, devargs);
- else devargs = NULL;
+ else
+ devargs = NULL;
if ((ret = maybe_config_get(driver, sdi, cg, ci->key, &gvar)) != SR_OK)
g_critical("Failed to get '%s': %s", opt_get, sr_strerror(ret));
- s = g_variant_print(gvar, FALSE);
- printf("%s\n", s);
- g_free(s);
+ srci = sr_key_info_get(SR_KEY_CONFIG, ci->key);
+ if (srci && srci->datatype == SR_T_MQ) {
+ g_variant_get(gvar, "(ut)", &mq, &mqflags);
+ if ((srmqi = sr_key_info_get(SR_KEY_MQ, mq)))
+ printf("%s", srmqi->id);
+ else
+ printf("%d", mq);
+ for (j = 0, mask = 1; j < 32; j++, mask <<= 1) {
+ if (!(mqflags & mask))
+ continue;
+ if ((srmqfi = sr_key_info_get(SR_KEY_MQFLAGS, mqflags & mask)))
+ printf("/%s", srmqfi->id);
+ else
+ printf("/%" PRIu64, mqflags & mask);
+ }
+ printf("\n");
+ } else {
+ s = g_variant_print(gvar, FALSE);
+ printf("%s\n", s);
+ g_free(s);
+ }
g_variant_unref(gvar);
sr_dev_close(sdi);
if (opt_pd_binary) {
if (setup_pd_binary(opt_pd_binary) != 0)
goto done;
+ if (setup_binary_stdout() != 0)
+ goto done;
if (srd_pd_output_callback_add(srd_sess, SRD_OUTPUT_BINARY,
show_pd_binary, NULL) != SRD_OK)
goto done;
show_version();
else if (opt_list_supported)
show_supported();
+ else if (opt_list_supported_wiki)
+ show_supported_wiki();
+ else if (opt_input_file && opt_show)
+ load_input_file(TRUE);
else if (opt_input_format && opt_show)
show_input();
else if (opt_output_format && opt_show)
else if (opt_show)
show_dev_detail();
else if (opt_input_file)
- load_input_file();
+ load_input_file(FALSE);
else if (opt_get)
get_option();
else if (opt_set)
set_options();
else if (opt_samples || opt_time || opt_frames || opt_continuous)
run_session();
+ else if (opt_list_serial)
+ show_serial_ports();
else
show_help();