Add a -D command line option which skips auto-detection of devices upon
startup. This can speedup program startup for setups with known devices,
and allows to skip the scan for troubled drivers which might break the
startup phase.
This -D option can be combined with -d specs, either presence or absence
of -d is acceptable when -D is specified. Users still can interactively
scan for and use devices after program startup.
This resolves bug #1116.
" -V, --version Show release version\n"
" -l, --loglevel Set libsigrok/libsigrokdecode loglevel\n"
" -d, --driver Specify the device driver to use\n"
" -V, --version Show release version\n"
" -l, --loglevel Set libsigrok/libsigrokdecode loglevel\n"
" -d, --driver Specify the device driver to use\n"
+ " -D, --no-scan Don't auto-scan for devices, use -d spec only\n"
" -i, --input-file Load input from file\n"
" -I, --input-format Input format\n"
" -c, --clean Don't restore previous sessions on startup\n"
" -i, --input-file Load input from file\n"
" -I, --input-format Input format\n"
" -c, --clean Don't restore previous sessions on startup\n"
shared_ptr<sigrok::Context> context;
string open_file, open_file_format, driver;
bool restore_sessions = true;
shared_ptr<sigrok::Context> context;
string open_file, open_file_format, driver;
bool restore_sessions = true;
Application a(argc, argv);
Application a(argc, argv);
};
const int c = getopt_long(argc, argv,
};
const int c = getopt_long(argc, argv,
- "l:Vhc?d:i:I:", long_options, nullptr);
+ "l:Vhc?d:Di:I:", long_options, nullptr);
+ case 'D':
+ do_scan = false;
+ break;
+
case 'i':
open_file = optarg;
break;
case 'i':
open_file = optarg;
break;
try {
// Create the device manager, initialise the drivers
try {
// Create the device manager, initialise the drivers
- pv::DeviceManager device_manager(context, driver);
+ pv::DeviceManager device_manager(context, driver, do_scan);
// Initialise the main window
pv::MainWindow w(device_manager);
// Initialise the main window
pv::MainWindow w(device_manager);
-DeviceManager::DeviceManager(shared_ptr<Context> context, std::string driver) :
+DeviceManager::DeviceManager(shared_ptr<Context> context,
+ std::string driver, bool do_scan) :
context_(context)
{
unique_ptr<QProgressDialog> progress(new QProgressDialog("",
context_(context)
{
unique_ptr<QProgressDialog> progress(new QProgressDialog("",
* best effort auto detection.
*/
for (auto entry : context->drivers()) {
* best effort auto detection.
*/
for (auto entry : context->drivers()) {
progress->setLabelText(QObject::tr("Scanning for %1...")
.arg(QString::fromStdString(entry.first)));
progress->setLabelText(QObject::tr("Scanning for %1...")
.arg(QString::fromStdString(entry.first)));
class DeviceManager
{
public:
class DeviceManager
{
public:
- DeviceManager(shared_ptr<sigrok::Context> context, std::string driver);
+ DeviceManager(shared_ptr<sigrok::Context> context,
+ std::string driver, bool do_scan);
~DeviceManager() = default;
~DeviceManager() = default;