From f27ee56d9c2b18158f2a9451b295123288134611 Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Wed, 17 Sep 2014 16:04:35 +0200 Subject: [PATCH] Adapt to config key capabilities. --- pv/dialogs/connect.cpp | 2 +- pv/prop/binding/deviceoptions.cpp | 2 +- pv/toolbars/samplingbar.cpp | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index d554b4c1..1156d6f5 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -119,7 +119,7 @@ void Connect::populate_drivers() hwopts = (const int32_t *)g_variant_get_fixed_array(gvar_opts, &num_opts, sizeof(int32_t)); for (unsigned int j = 0; j < num_opts; j++) - if (hwopts[j] == SR_CONF_SAMPLERATE) { + if ((hwopts[j] & SR_CONF_MASK) == SR_CONF_SAMPLERATE) { supported_device = true; break; } diff --git a/pv/prop/binding/deviceoptions.cpp b/pv/prop/binding/deviceoptions.cpp index 8811b6f3..c8da5a05 100644 --- a/pv/prop/binding/deviceoptions.cpp +++ b/pv/prop/binding/deviceoptions.cpp @@ -62,7 +62,7 @@ DeviceOptions::DeviceOptions(shared_ptr dev_inst, gvar_opts, &num_opts, sizeof(int32_t)); for (unsigned int i = 0; i < num_opts; i++) { const struct sr_config_info *const info = - sr_config_info_get(options[i]); + sr_config_info_get(options[i] & SR_CONF_MASK); if (!info) continue; diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index 526f382c..c3437377 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -339,13 +339,15 @@ void SamplingBar::update_device_config_widgets() gvar, &num_opts, sizeof(int32_t)); for (unsigned int i = 0; i < num_opts; i++) { - switch (options[i]) { + switch (options[i] & SR_CONF_MASK) { case SR_CONF_LIMIT_SAMPLES: - _sample_count_supported = true; + if (options[i] & SR_CONF_SET) + _sample_count_supported = true; break; case SR_CONF_LIMIT_FRAMES: - dev_inst->set_config(NULL, SR_CONF_LIMIT_FRAMES, - g_variant_new_uint64(1)); + if (options[i] & SR_CONF_SET) + dev_inst->set_config(NULL, SR_CONF_LIMIT_FRAMES, + g_variant_new_uint64(1)); break; } } -- 2.30.2