From 8f3b8464ad9b3b322971d8baa1f07739252f1783 Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Thu, 17 May 2012 02:03:46 +0200 Subject: [PATCH] cli: support SR_HWCAP_VDIV and the new SR_T_RATIONAL_VOLT type --- sigrok-cli.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sigrok-cli.c b/sigrok-cli.c index b5cb5af..0fa343d 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -332,6 +332,18 @@ static void show_dev_detail(void) for (i = 0; stropts[i]; i++) printf(" %s\n", stropts[i]); + } else if (hwo->hwcap == SR_HWCAP_VDIV) { + /* Supported volts/div values */ + printf(" %s", hwo->shortname); + if (sr_dev_info_get(dev, SR_DI_VDIVS, + (const void **)&rationals) != SR_OK) { + printf("\n"); + continue; + } + printf(" - supported volts/div:\n"); + for (i = 0; rationals[i].p && rationals[i].q; i++) + printf(" %s\n", sr_voltage_string( &rationals[i])); + } else { /* Everything else */ printf(" %s\n", hwo->shortname); @@ -1116,6 +1128,12 @@ static int set_dev_options(struct sr_dev *dev, GHashTable *args) ret = dev->driver->dev_config_set(dev->driver_index, sr_hwcap_options[i].hwcap, &tmp_rat); break; + case SR_T_RATIONAL_VOLT: + if ((ret = sr_parse_voltage(value, &tmp_rat)) != SR_OK) + break; + ret = dev->driver->dev_config_set(dev->driver_index, + sr_hwcap_options[i].hwcap, &tmp_rat); + break; default: ret = SR_ERR; } -- 2.30.2