GString *s;
GVariant *gvar;
struct sr_dev_driver *driver;
- const char *vendor, *model, *version;
+ const char *vendor, *model, *version, *sernum;
driver = sr_dev_inst_driver_get(sdi);
vendor = sr_dev_inst_vendor_get(sdi);
model = sr_dev_inst_model_get(sdi);
version = sr_dev_inst_version_get(sdi);
+ sernum = sr_dev_inst_sernum_get(sdi);
channels = sr_dev_inst_channels_get(sdi);
s = g_string_sized_new(128);
g_string_append_printf(s, "%s ", model);
if (version && version[0])
g_string_append_printf(s, "%s ", version);
+ if (sernum && sernum[0])
+ g_string_append_printf(s, "[S/N: %s] ", sernum);
if (channels) {
if (g_slist_length(channels) == 1) {
ch = channels->data;
gsize num_elements;
double dlow, dhigh, dcur_low, dcur_high;
const uint64_t *uint64;
+ uint64_t cur_rate, rate;
uint64_t p = 0, q = 0, low = 0, high = 0;
uint64_t tmp_uint64, mask, cur_low, cur_high, cur_p, cur_q;
GArray *opts;
unsigned int num_devices, i, j;
char *tmp_str, *s, c;
const char **stropts;
+ double tmp_flt;
+ gboolean have_tmp_flt;
+ const double *fltopts;
if (parse_driver(opt_drv, &driver_from_opt, NULL)) {
/* A driver was specified, report driver-wide options now. */
* returned, or which values for them.
*/
select_channels(sdi);
- channel_group = select_channel_group(sdi);
+ channel_group = lookup_channel_group(sdi);
if (!(opts = sr_dev_options(driver, sdi, channel_group)))
/* Driver supports no device instance options. */
} else if (key == SR_CONF_SAMPLERATE) {
/* Supported samplerates */
printf(" %s", srci->id);
+ cur_rate = ~0ull;
+ if (maybe_config_get(driver, sdi, channel_group,
+ SR_CONF_SAMPLERATE, &gvar) == SR_OK) {
+ if (g_variant_is_of_type(gvar, G_VARIANT_TYPE_UINT64))
+ cur_rate = g_variant_get_uint64(gvar);
+ g_variant_unref(gvar);
+ }
if (maybe_config_list(driver, sdi, channel_group, SR_CONF_SAMPLERATE,
&gvar_dict) != SR_OK) {
printf("\n");
&num_elements, sizeof(uint64_t));
printf(" - supported samplerates:\n");
for (i = 0; i < num_elements; i++) {
- if (!(s = sr_samplerate_string(uint64[i])))
+ rate = uint64[i];
+ s = sr_samplerate_string(rate);
+ if (!s)
continue;
- printf(" %s\n", s);
+ printf(" %s", s);
+ if (rate == cur_rate)
+ printf(" (current)");
+ printf("\n");
g_free(s);
}
g_variant_unref(gvar_list);
} else if (srci->datatype == SR_T_FLOAT) {
printf(" %s: ", srci->id);
+ tmp_flt = 0.0;
+ have_tmp_flt = FALSE;
if (maybe_config_get(driver, sdi, channel_group, key,
&gvar) == SR_OK) {
- printf("%f\n", g_variant_get_double(gvar));
+ tmp_flt = g_variant_get_double(gvar);
+ have_tmp_flt = TRUE;
g_variant_unref(gvar);
- } else
+ }
+ if (maybe_config_list(driver, sdi, channel_group, key,
+ &gvar) != SR_OK) {
+ if (have_tmp_flt) {
+ /* Can't list, but got a value to show. */
+ printf("%f (current)", tmp_flt);
+ }
printf("\n");
+ continue;
+ }
+ fltopts = g_variant_get_fixed_array(gvar,
+ &num_elements, sizeof(tmp_flt));
+ for (i = 0; i < num_elements; i++) {
+ if (i)
+ printf(", ");
+ printf("%f", fltopts[i]);
+ if (have_tmp_flt && fltopts[i] == tmp_flt)
+ printf(" (current)");
+ }
+ printf("\n");
+ g_variant_unref(gvar);
} else if (srci->datatype == SR_T_RATIONAL_PERIOD
|| srci->datatype == SR_T_RATIONAL_VOLT) {
port = (void *)data;
(void)user_data;
- printf("\t%s\t%s\n", port->name, port->description);
+ printf(" %s\t%s\n", port->name, port->description);
}
void show_serial_ports(void)
if (!serial_ports)
return;
- printf("Available serial ports:\n");
+ printf("Available serial/HID/BT/BLE ports:\n");
g_slist_foreach(serial_ports, print_serial_port, NULL);
g_slist_free_full(serial_ports, (GDestroyNotify)sr_serial_free);
}