]> sigrok.org Git - pulseview.git/commitdiff
MainBar: Fix warning message introduced by bc4b9ccfc78d9d0
authorSoeren Apel <redacted>
Fri, 10 Aug 2018 21:28:22 +0000 (23:28 +0200)
committerUwe Hermann <redacted>
Tue, 21 Aug 2018 10:02:38 +0000 (12:02 +0200)
"sr: hwdriver: Option 'external_clock' not available for this device instance."
Avoid this message by checking if the EXTERNAL_CLOCK property is actually
supplied by the driver.

pv/toolbars/mainbar.cpp

index 16888624bc2f124030005fc481ae6838f5adbba5..b9eda07787c912ccdef99e7fa55d38fc3aa1d0a2 100644 (file)
@@ -302,17 +302,20 @@ void MainBar::update_sample_rate_selector()
 
        const shared_ptr<sigrok::Device> sr_dev = device->device();
 
-       try {
-               auto gvar = sr_dev->config_get(ConfigKey::EXTERNAL_CLOCK);
-               if (gvar.gobj()) {
-                       bool value = Glib::VariantBase::cast_dynamic<Glib::Variant<bool>>(
-                               gvar).get();
-                       sample_rate_.allow_user_entered_values(value);
+       if (sr_dev->config_check(ConfigKey::EXTERNAL_CLOCK, Capability::GET)) {
+               try {
+                       auto gvar = sr_dev->config_get(ConfigKey::EXTERNAL_CLOCK);
+                       if (gvar.gobj()) {
+                               bool value = Glib::VariantBase::cast_dynamic<Glib::Variant<bool>>(
+                                       gvar).get();
+                               sample_rate_.allow_user_entered_values(value);
+                       }
+               } catch (Error& error) {
+                       // Do nothing
                }
-       } catch (Error& error) {
-               // Do nothing
        }
 
+
        if (sr_dev->config_check(ConfigKey::SAMPLERATE, Capability::LIST)) {
                try {
                        gvar_dict = sr_dev->config_list(ConfigKey::SAMPLERATE);