Device binding: Notify user when a config option is ignored
authorSoeren Apel <soeren@apelpie.net>
Tue, 4 Aug 2020 07:30:29 +0000 (09:30 +0200)
committerSoeren Apel <soeren@apelpie.net>
Sat, 22 Aug 2020 22:16:19 +0000 (00:16 +0200)
pv/binding/device.cpp

index 084d46511f64c6b2efedea9806220b57f2a27bdc..96217051f8433819cb9e0b575d8be28cc5a7e242 100644 (file)
@@ -61,10 +61,6 @@ Device::Device(shared_ptr<sigrok::Configurable> configurable) :
 
                auto capabilities = configurable->config_capabilities(key);
 
 
                auto capabilities = configurable->config_capabilities(key);
 
-               if (!capabilities.count(Capability::GET) ||
-                       !capabilities.count(Capability::SET))
-                       continue;
-
                string name_str;
                try {
                        name_str = key->description();
                string name_str;
                try {
                        name_str = key->description();
@@ -74,6 +70,13 @@ Device::Device(shared_ptr<sigrok::Configurable> configurable) :
 
                const QString name = QString::fromStdString(name_str);
 
 
                const QString name = QString::fromStdString(name_str);
 
+               if (!capabilities.count(Capability::GET) ||
+                       !capabilities.count(Capability::SET)) {
+                       qDebug() << QString(tr("Note for device developers: Ignoring device configuration capability '%1' " \
+                               "as it is missing GET and/or SET")).arg(name);
+                       continue;
+               }
+
                const Property::Getter get = [&, key]() {
                        return configurable_->config_get(key); };
                const Property::Setter set = [&, key](Glib::VariantBase value) {
                const Property::Getter get = [&, key]() {
                        return configurable_->config_get(key); };
                const Property::Setter set = [&, key](Glib::VariantBase value) {