summaryrefslogtreecommitdiff
path: root/src/serialport/qserialport.cpp
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-11-24 18:21:57 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2014-11-27 11:19:43 +0100
commitab51ad6a5f4e533c31bd8e5b6f16a3bcd09a3ee6 (patch)
tree783f2a4cccc2fcc420bef5557bf8b47aa10049d6 /src/serialport/qserialport.cpp
parenta00cbfb7f336a56b9ae2235c44149ec63ced9ee5 (diff)
downloadqtserialport-ab51ad6a5f4e533c31bd8e5b6f16a3bcd09a3ee6.tar.gz
Allow to use custom devices paths
QSP incorrectly transforms non-standard device names to their paths and vice-versa (for example, "/home/ttyS0", "//./COM1", and so on). Now this problem is solved: * The transformation code is moved to QSPP. * Added autotests auto/qserialportinfoprivate to testing of conversion algorithm. These tests are private and can be activated with building of QtSerialPort with: qmake "QT_CONFIG+=private_tests warnings_are_errors" \ DEFINES+=QT_BUILD_INTERNAL Tested on Windows 8, Linux, OSX with auto-tests, with on-board and virtual serial ports. Task-number: QTBUG-38639 Change-Id: I43757a7f1390f53ed2b1d70de59c6bfb71892a59 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Diffstat (limited to 'src/serialport/qserialport.cpp')
-rw-r--r--src/serialport/qserialport.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 82bcde3..2bd7c69 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -36,6 +36,7 @@
#include "qserialport.h"
#include "qserialportinfo.h"
+#include "qserialportinfo_p.h"
#ifdef Q_OS_WINCE
#include "qserialport_wince_p.h"
@@ -435,7 +436,7 @@ QSerialPort::~QSerialPort()
void QSerialPort::setPortName(const QString &name)
{
Q_D(QSerialPort);
- d->systemLocation = QSerialPortPrivate::portNameToSystemLocation(name);
+ d->systemLocation = QSerialPortInfoPrivate::portNameToSystemLocation(name);
}
/*!
@@ -446,7 +447,7 @@ void QSerialPort::setPortName(const QString &name)
void QSerialPort::setPort(const QSerialPortInfo &serialPortInfo)
{
Q_D(QSerialPort);
- d->systemLocation = QSerialPortPrivate::portNameToSystemLocation(serialPortInfo.systemLocation());
+ d->systemLocation = serialPortInfo.systemLocation();
}
/*!
@@ -460,7 +461,7 @@ void QSerialPort::setPort(const QSerialPortInfo &serialPortInfo)
\li Brief Description
\row
\li Windows
- \li Removes the prefix "\\\\.\\" from the system location
+ \li Removes the prefix "\\\\.\\" or "//./" from the system location
and returns the remainder of the string.
\row
\li Windows CE
@@ -471,16 +472,9 @@ void QSerialPort::setPort(const QSerialPortInfo &serialPortInfo)
\li Returns the system location as it is,
as it is equivalent to the port name.
\row
- \li GNU/Linux
+ \li Unix, BSD
\li Removes the prefix "/dev/" from the system location
and returns the remainder of the string.
- \row
- \li Mac OSX
- \li Removes the prefix "/dev/cu." and "/dev/tty." from the
- system location and returns the remainder of the string.
- \row
- \li Other *nix
- \li The same as for GNU/Linux.
\endtable
\sa setPort(), QSerialPortInfo::portName()
@@ -488,7 +482,7 @@ void QSerialPort::setPort(const QSerialPortInfo &serialPortInfo)
QString QSerialPort::portName() const
{
Q_D(const QSerialPort);
- return QSerialPortPrivate::portNameFromSystemLocation(d->systemLocation);
+ return QSerialPortInfoPrivate::portNameFromSystemLocation(d->systemLocation);
}
/*!