diff --git a/platform/qt/dmxwidget/dmxwidget.cpp b/platform/qt/dmxwidget/dmxwidget.cpp index 896437e..6d58d94 100644 --- a/platform/qt/dmxwidget/dmxwidget.cpp +++ b/platform/qt/dmxwidget/dmxwidget.cpp @@ -60,19 +60,23 @@ void DmxWidget::close() QList DmxWidget::availableWidgets() { QList wdgts; + // evaluate all system serial ports const auto ports = QSerialPortInfo::availablePorts(); for (const QSerialPortInfo &port : ports) { - auto widget = new DmxWidget(); - widget->setPort(port); - widget->open(); - if (widget->isConnected()) - { - WidgetInfo wdgt; - wdgt.serialNo = widget->serialNumber(); - wdgt.port = port; - wdgts.push_back(wdgt); - } - delete widget; + // try to open a widget on each port + auto widget = new DmxWidget(); + widget->setPort(port); + widget->open(); + if (widget->isConnected()) + { + // add ports with valid widgets to the list + WidgetInfo wdgt; + wdgt.serialNo = widget->serialNumber(); + wdgt.fwVersion = widget->firmwareVersion(); + wdgt.port = port; + wdgts.push_back(wdgt); + } + delete widget; } return wdgts; } diff --git a/platform/qt/dmxwidget/dmxwidget.h b/platform/qt/dmxwidget/dmxwidget.h index 1afb768..1cf7c85 100644 --- a/platform/qt/dmxwidget/dmxwidget.h +++ b/platform/qt/dmxwidget/dmxwidget.h @@ -39,6 +39,7 @@ using ENTTEC::Pro::DMX_RX_MODE; struct WidgetInfo { uint32_t serialNo; + uint16_t fwVersion; QSerialPortInfo port; };