diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2014-11-28 21:25:36 +0000 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2014-12-03 11:57:59 +0100 |
commit | 015c8a9053ffdf550f460e9ef10c4bb26284feaa (patch) | |
tree | 3a1a1efcd8703a4cb9f31c65287d7ae819bed53f /src/serialport/qserialportinfo.h | |
parent | 2e627bdd20b77b323b22d214283560db0056b79e (diff) | |
download | qtserialport-015c8a9053ffdf550f460e9ef10c4bb26284feaa.tar.gz |
Improve QSPI algorithm on Unix
QSPI uses the wrong algorithm of devices search. In case no any devices
are detected with udev (or with sysfs), starts a search with a filters.
In this case a user gets a list of devices that are not a serial ports,
that is wrong.
The main idea should be in that udev or sysfs are the main sources of
obtaining information. In case they returns an empty list this means
that system has no serial ports.
Algorithm is:
Try to find devices through udev. If it fails (system error or udev is
not present), then try to find using sysfs; otherwise return udev result,
even if it has an empty list. If sysfs is fails (permission denied or
sysfs is not present), then try to find devices in /dev/ as last attempt;
otherwise return sysfs result, even if it has an empty list.
Tested on Linux (with udev, sysfs, filters) using FTDI serial ports.
Change-Id: I0132e27f720b007ea3f4861e9cd7ed77833cff8c
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/serialport/qserialportinfo.h')
-rw-r--r-- | src/serialport/qserialportinfo.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/serialport/qserialportinfo.h b/src/serialport/qserialportinfo.h index 0c7a0f1..714708d 100644 --- a/src/serialport/qserialportinfo.h +++ b/src/serialport/qserialportinfo.h @@ -82,9 +82,9 @@ public: private: QSerialPortInfo(const QSerialPortInfoPrivate &dd); - friend QList<QSerialPortInfo> availablePortsByUdev(); - friend QList<QSerialPortInfo> availablePortsBySysfs(); - friend QList<QSerialPortInfo> availablePortsByFiltersOfDevices(); + friend QList<QSerialPortInfo> availablePortsByUdev(bool &ok); + friend QList<QSerialPortInfo> availablePortsBySysfs(bool &ok); + friend QList<QSerialPortInfo> availablePortsByFiltersOfDevices(bool &ok); QScopedPointer<QSerialPortInfoPrivate, QSerialPortInfoPrivateDeleter> d_ptr; }; |