X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=c9fa4c1a25fc749a9d47804ea369b8c9ff3e1ad1;hp=82087ee080164f28cdfc9b3273ba2049d11dfe95;hb=18203d86e200131f50e9830c4f16a9edba96d669;hpb=ef4d020135822a8acb5a19475bcd7dc5c841fa04 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 82087ee0..c9fa4c1a 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -179,6 +179,7 @@ void MainWindow::setup_ui() addToolBar(_toolbar); _sampling_bar = new SamplingBar(this); + scan_devices(); connect(_sampling_bar, SIGNAL(run_stop()), this, SLOT(run_stop())); addToolBar(_sampling_bar); @@ -192,6 +193,23 @@ void MainWindow::setup_ui() } +void MainWindow::scan_devices() +{ + _devices.clear(); + + /* Scan all drivers for all devices. */ + struct sr_dev_driver **const drivers = sr_driver_list(); + for (struct sr_dev_driver **driver = drivers; *driver; driver++) { + GSList *const devices = sr_driver_scan(*driver, NULL); + for (GSList *l = devices; l; l = l->next) + _devices.push_back((sr_dev_inst*)l->data); + g_slist_free(devices); + } + + assert(_sampling_bar); + _sampling_bar->set_device_list(_devices); +} + void MainWindow::load_file(QString file_name) { _session.load_file(file_name.toStdString());