From 7991784841727d39a6f71ffa4ccdc1fc86af9f98 Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Mon, 8 Apr 2013 00:37:50 +0200 Subject: [PATCH] hantek-dso: Support SR_CONF_NUM_TIMEBASE/SR_CONF_NUM_VDIV --- hardware/hantek-dso/api.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 7579ad7e..c5540b74 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -37,6 +37,9 @@ /* TODO tune this properly */ #define TICK 1 +#define NUM_TIMEBASE 10 +#define NUM_VDIV 8 + static const int32_t devopts[] = { SR_CONF_OSCILLOSCOPE, SR_CONF_LIMIT_FRAMES, @@ -49,6 +52,8 @@ static const int32_t devopts[] = { SR_CONF_FILTER, SR_CONF_VDIV, SR_CONF_COUPLING, + SR_CONF_NUM_TIMEBASE, + SR_CONF_NUM_VDIV, }; static const char *probe_names[] = { @@ -411,6 +416,25 @@ static int hw_cleanup(void) return SR_OK; } +static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (id) { + case SR_CONF_NUM_TIMEBASE: + *data = g_variant_new_int32(NUM_TIMEBASE); + break; + case SR_CONF_NUM_VDIV: + *data = g_variant_new_int32(NUM_VDIV); + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -924,7 +948,7 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, - .config_get = NULL, + .config_get = config_get, .config_set = config_set, .config_list = config_list, .dev_open = hw_dev_open,