From: Soeren Apel Date: Fri, 10 Aug 2018 21:28:22 +0000 (+0200) Subject: MainBar: Fix warning message introduced by bc4b9ccfc78d9d0 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c78081004d8d7c6440358ccbf9278826a0fdb568;p=pulseview.git MainBar: Fix warning message introduced by bc4b9ccfc78d9d0 "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. --- diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index 16888624..b9eda077 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -302,17 +302,20 @@ void MainBar::update_sample_rate_selector() const shared_ptr sr_dev = device->device(); - try { - auto gvar = sr_dev->config_get(ConfigKey::EXTERNAL_CLOCK); - if (gvar.gobj()) { - bool value = Glib::VariantBase::cast_dynamic>( - 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>( + 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);