unsigned int num_devices, i, j;
char *tmp_str, *s, c;
const char **stropts;
+ double tmp_flt;
+ const double *fltopts;
if (parse_driver(opt_drv, &driver_from_opt, NULL)) {
/* A driver was specified, report driver-wide options now. */
} else if (srci->datatype == SR_T_FLOAT) {
printf(" %s: ", srci->id);
+ tmp_flt = 0.0;
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);
g_variant_unref(gvar);
- } else
+ }
+ if (maybe_config_list(driver, sdi, channel_group, key,
+ &gvar) != SR_OK) {
+ if (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 (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) {
}
g_strfreev(tok);
}
+
+static void print_serial_port(gpointer data, gpointer user_data)
+{
+ struct sr_serial_port *port;
+
+ port = (void *)data;
+ (void)user_data;
+ printf(" %s\t%s\n", port->name, port->description);
+}
+
+void show_serial_ports(void)
+{
+ GSList *serial_ports;
+
+ serial_ports = sr_serial_list(NULL);
+ if (!serial_ports)
+ return;
+
+ 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);
+}