From: Joel Holdsworth Date: Wed, 30 Jan 2013 22:29:06 +0000 (+0000) Subject: Only allow monotonic devices in the device list X-Git-Tag: pulseview-0.1.0~102 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3093830343c9d3b3220c2874a942c843d7a05cf7;p=pulseview.git Only allow monotonic devices in the device list --- diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index 03a03f26..284ce072 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -63,11 +63,30 @@ Connect::Connect(QWidget *parent) : void Connect::populate_drivers() { + const int *hwopts; struct sr_dev_driver **drivers = sr_driver_list(); - for (int i = 0; drivers[i]; ++i) - _drivers.addItem(QString("%1 (%2)").arg( - drivers[i]->longname).arg(drivers[i]->name), - qVariantFromValue((void*)drivers[i])); + for (int i = 0; drivers[i]; ++i) { + /** + * We currently only support devices that can deliver + * samples at a fixed samplerate i.e. oscilloscopes and + * logic analysers. + * @todo Add support for non-monotonic devices i.e. DMMs + * and sensors. + */ + bool supported_device = false; + if ((sr_config_list(drivers[i], SR_CONF_DEVICE_OPTIONS, + (const void **)&hwopts, NULL) == SR_OK) && hwopts) + for (int j = 0; hwopts[j]; j++) + if(hwopts[j] == SR_CONF_SAMPLERATE) { + supported_device = true; + break; + } + + if(supported_device) + _drivers.addItem(QString("%1 (%2)").arg( + drivers[i]->longname).arg(drivers[i]->name), + qVariantFromValue((void*)drivers[i])); + } } void Connect::device_selected(int index)