From e0be9ed761e730bec7b26bcaba014f028f6340d0 Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Sat, 23 Nov 2013 21:49:33 +0000 Subject: Fix the detection of PCI serial ports with sysfs and without udev Unfortunately, 0973537c5471288726b929250199a41435729bee caused a serious regression for obtaining detecting PCI serial ports without udev. This was working before since the hard coded fallback mechanism has been up to this task, but the sysfs alternative took the precedence over. A note has also been added to the udev part of the algorithm because we will need to obtain the vendor and product identifiers in a separate block in the future. The vid/pid will be fixed in a separate change once that is well-tested. This patch has no any risk as far as I can tell since it is just adding a new short block to the existing code without much implication. I have tested the change on Linux for my use cases with Qt 4 and then 5, and I cannot find any regression. Everything works as expected both with udev and without, i.e. with sysfs. Thanks go to Aaron Linville for reporting the issue. Task-number: QTBUG-35064 Change-Id: Ieae6f3e94559fb61ede67ff1d8810bb686d46383 Reviewed-by: Sergey Belyashov Reviewed-by: Denis Shienkov Reviewed-by: Aaron Linville --- dist/changes-5.2.0 | 3 +++ src/serialport/qserialportinfo_unix.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dist/changes-5.2.0 b/dist/changes-5.2.0 index 20fd35cd..7f3e4c27 100644 --- a/dist/changes-5.2.0 +++ b/dist/changes-5.2.0 @@ -121,3 +121,6 @@ information. /dev/ttyO* (native OMAP UART) is supported by that backend. - The lock file usage has been extended to support Android as there is no direct access to the usual Unix lock file system paths. The lock file is now placed into /data/local/tmp. + +- [QTBUG-35064] PCI support has been added to the sysfs backend on Linux to +support the enumeration of such devices. diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp index 971a904b..1ac40fdd 100644 --- a/src/serialport/qserialportinfo_unix.cpp +++ b/src/serialport/qserialportinfo_unix.cpp @@ -186,6 +186,8 @@ QList QSerialPortInfo::availablePorts() } } while (targetDir.cdUp()); + } else if (targetPath.contains(QStringLiteral("pci"))) { + // TODO: Obtain more information about the device } else { // unknown types of devices canAppendToList = false; @@ -287,6 +289,8 @@ QList QSerialPortInfo::availablePorts() // Skip this devices because this type of subsystem does // not include a real physical serial device. canAppendToList = false; + } else if (subsys == QStringLiteral("pci")) { + // TODO: Obtain more information about the device } else { // Others types of subsystems. // Append this devices because we believe that any other types of // subsystems provide a real serial devices. For example, for devices -- cgit v1.2.3