diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-14 14:07:32 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-14 14:07:32 +0200 |
commit | 3bb682ea29ffaf72ff73e6eb57abdc5c59524e8a (patch) | |
tree | 4d8e828da7ea6115c6ffe26cec2d024bad60aa91 /src/serialport/qserialportinfo_unix.cpp | |
parent | 14fe584d2abb1ae0776f0973b245baa79d0468d2 (diff) | |
parent | 62dfdeb3642250bdb642dbf607a8c7b95e57835e (diff) | |
download | qtserialport-3bb682ea29ffaf72ff73e6eb57abdc5c59524e8a.tar.gz |
Merge remote-tracking branch 'origin/5.3' into 5.4
Change-Id: Id7e66059233e8d07ba44cad19048d9cddc68e250
Diffstat (limited to 'src/serialport/qserialportinfo_unix.cpp')
-rw-r--r-- | src/serialport/qserialportinfo_unix.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp index 82ac91f..4479e97 100644 --- a/src/serialport/qserialportinfo_unix.cpp +++ b/src/serialport/qserialportinfo_unix.cpp @@ -161,6 +161,10 @@ QList<QSerialPortInfo> availablePortsBySysfs() if (manufacturer.open(QIODevice::ReadOnly | QIODevice::Text)) serialPortInfo.d_ptr->manufacturer = QString::fromLatin1(manufacturer.readAll()).simplified(); + QFile serialNumber(QFileInfo(targetDir, QStringLiteral("serial")).absoluteFilePath()); + if (serialNumber.open(QIODevice::ReadOnly | QIODevice::Text)) + serialPortInfo.d_ptr->serialNumber = QString::fromLatin1(serialNumber.readAll()).simplified(); + QFile vendorIdentifier(QFileInfo(targetDir, QStringLiteral("idVendor")).absoluteFilePath()); if (vendorIdentifier.open(QIODevice::ReadOnly | QIODevice::Text)) { serialPortInfo.d_ptr->vendorIdentifier = QString::fromLatin1(vendorIdentifier.readAll()) @@ -190,6 +194,9 @@ QList<QSerialPortInfo> availablePortsBySysfs() .toInt(&serialPortInfo.d_ptr->hasProductIdentifier, 16); } // TODO: Obtain more information about the device + } else if (targetPath.contains(QStringLiteral(".serial/tty/tty"))) { + // This condition matches onboard serial port on embedded devices. + // Keep those devices in the list } else { continue; } @@ -345,12 +352,7 @@ QList<QSerialPortInfo> availablePortsByUdev() QList<QSerialPortInfo> QSerialPortInfo::availablePorts() { - QList<QSerialPortInfo> serialPortInfoList; - // TODO: Remove this condition once the udev runtime symbol resolution crash - // is fixed for Qt 4. -#if defined(LINK_LIBUDEV) || (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) - serialPortInfoList = availablePortsByUdev(); -#endif + QList<QSerialPortInfo> serialPortInfoList = availablePortsByUdev(); #ifdef Q_OS_LINUX if (serialPortInfoList.isEmpty()) |