X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdevicemanager.cpp;h=ca8f66bee5316e6116d4fb38afcbdd93ca78a24d;hp=5920486a9d6d8df54f7bb8dc8135bc38ff1620a8;hb=1f419596224bd8f73fc8c59b52b8775685249a07;hpb=1d6e35dcef7686faec065cb775bd211fa47f2b73 diff --git a/pv/devicemanager.cpp b/pv/devicemanager.cpp index 5920486a..ca8f66be 100644 --- a/pv/devicemanager.cpp +++ b/pv/devicemanager.cpp @@ -87,6 +87,11 @@ DeviceManager::DeviceManager(shared_ptr context, for (auto entry : context->drivers()) { if (!do_scan) break; + + // Skip drivers we won't scan anyway + if (!driver_supported(entry.second)) + continue; + progress->setLabelText(QObject::tr("Scanning for %1...") .arg(QString::fromStdString(entry.first))); @@ -218,14 +223,8 @@ DeviceManager::drive_scan_options(vector user_spec, return result; } -list< shared_ptr > -DeviceManager::driver_scan( - shared_ptr driver, map drvopts) +bool DeviceManager::driver_supported(shared_ptr driver) const { - list< shared_ptr > driver_devices; - - assert(driver); - /* * We currently only support devices that can deliver samples at * a fixed samplerate (i.e. oscilloscopes and logic analysers). @@ -233,9 +232,19 @@ DeviceManager::driver_scan( * @todo Add support for non-monotonic devices (DMMs, sensors, etc). */ const auto keys = driver->config_keys(); - bool supported_device = keys.count(ConfigKey::LOGIC_ANALYZER) | - keys.count(ConfigKey::OSCILLOSCOPE); - if (!supported_device) + + return keys.count(ConfigKey::LOGIC_ANALYZER) | keys.count(ConfigKey::OSCILLOSCOPE); +} + +list< shared_ptr > +DeviceManager::driver_scan( + shared_ptr driver, map drvopts) +{ + list< shared_ptr > driver_devices; + + assert(driver); + + if (!driver_supported(driver)) return driver_devices; // Remove any device instances from this driver from the device