From 015c8a9053ffdf550f460e9ef10c4bb26284feaa Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Fri, 28 Nov 2014 21:25:36 +0000 Subject: 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 --- src/serialport/qserialportinfo.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/serialport/qserialportinfo.h') 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 availablePortsByUdev(); - friend QList availablePortsBySysfs(); - friend QList availablePortsByFiltersOfDevices(); + friend QList availablePortsByUdev(bool &ok); + friend QList availablePortsBySysfs(bool &ok); + friend QList availablePortsByFiltersOfDevices(bool &ok); QScopedPointer d_ptr; }; -- cgit v1.2.1