summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-12 18:10:16 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-16 17:08:12 +0100
commitd9725b249de5a2a6bb45e4f4e1a1b316d91ed102 (patch)
tree07a0282c8744242f4a5d5b493f1c0cf945306625
parentdda7449d18cf8aaa542f869dcaea28634d21ecb0 (diff)
parent97bbe2acd8b4c14315653a3d9dc5757d6518220e (diff)
downloadqtserialport-d9725b249de5a2a6bb45e4f4e1a1b316d91ed102.tar.gz
Merge remote-tracking branch 'origin/release' into stable
Conflicts: src/serialport/qserialport.cpp src/serialport/qserialportinfo_unix.cpp Change-Id: I12658a9f92c91ab83f404c93a311ef947d1f2503
-rw-r--r--dist/changes-5.2.014
-rw-r--r--src/serialport/qserialport.cpp36
-rw-r--r--src/serialport/qserialport.h17
-rw-r--r--src/serialport/qserialport_symbian.cpp15
-rw-r--r--src/serialport/qserialport_unix.cpp11
-rw-r--r--src/serialport/qserialport_win.cpp20
-rw-r--r--src/serialport/qserialportglobal.h4
-rw-r--r--src/serialport/qserialportinfo.cpp1
-rw-r--r--src/serialport/qserialportinfo.h4
-rw-r--r--src/serialport/qserialportinfo_unix.cpp4
10 files changed, 86 insertions, 40 deletions
diff --git a/dist/changes-5.2.0 b/dist/changes-5.2.0
index 96aa704..6105c8b 100644
--- a/dist/changes-5.2.0
+++ b/dist/changes-5.2.0
@@ -64,9 +64,6 @@ now.
- [QTBUG-33774] Document that the serial port parameters cannot be set before
opening.
-- Add an "UnknownSignal" value for the pinout signals. This is now the returned
-value when the pinout state of the signals cannot be detected properly.
-
- No more unnecessary syscalls (parameter settings, pinout signal query, etc) in the
backend when the port is closed. This also means no improper errors are set
accordingly.
@@ -121,3 +118,14 @@ 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.
+
+- [QTBUG-35184] Mark the isValid() method in QSerialPortInfo deprecated because
+it has no common use case.
+
+- [QTBUG-35215] Mark the QSerialPort::Unknown* enumeration values in QSerialPort
+deprecated because it has no use case, and was added mistakenly. There is no
+such "standard" serial port behavior general for these as "unknown". It is an
+implementation detail for error reporting, and hence not recommended anymore.
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 01ca9a0..5d9442e 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -70,10 +70,10 @@ QSerialPortPrivateData::QSerialPortPrivateData(QSerialPort *q)
, error(QSerialPort::NoError)
, inputBaudRate(0)
, outputBaudRate(0)
- , dataBits(QSerialPort::UnknownDataBits)
- , parity(QSerialPort::UnknownParity)
- , stopBits(QSerialPort::UnknownStopBits)
- , flow(QSerialPort::UnknownFlowControl)
+ , dataBits(QSerialPort::Data8)
+ , parity(QSerialPort::NoParity)
+ , stopBits(QSerialPort::OneStop)
+ , flow(QSerialPort::NoFlowControl)
, policy(QSerialPort::IgnorePolicy)
, settingsRestoredOnClose(true)
, q_ptr(q)
@@ -198,7 +198,9 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed)
\value Baud38400 38400 baud.
\value Baud57600 57600 baud.
\value Baud115200 115200 baud.
- \value UnknownBaud Unknown baud.
+ \value UnknownBaud Unknown baud. This value is obsolete. It is provided to
+ keep old source code working. We strongly advise against
+ using it in new code.
\sa QSerialPort::baudRate
*/
@@ -220,7 +222,9 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed)
is used for most kinds of data, as this size matches
the size of a byte. It is almost universally used in
newer applications.
- \value UnknownDataBits Unknown number of bits.
+ \value UnknownDataBits Unknown number of bits. This value is obsolete. It
+ is provided to keep old source code working. We
+ strongly advise against using it in new code.
\sa QSerialPort::dataBits
*/
@@ -244,7 +248,9 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed)
\value MarkParity Mark parity. The parity bit is always set to the
mark signal condition (logical 1). It does not
provide error detection information.
- \value UnknownParity Unknown parity.
+ \value UnknownParity Unknown parity. This value is obsolete. It is
+ provided to keep old source code working. We
+ strongly advise against using it in new code.
\sa QSerialPort::parity
*/
@@ -257,7 +263,9 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed)
\value OneStop 1 stop bit.
\value OneAndHalfStop 1.5 stop bits. This is only for Windows platform.
\value TwoStop 2 stop bits.
- \value UnknownStopBits Unknown number of stop bit.
+ \value UnknownStopBits Unknown number of stop bit. This value is obsolete.
+ It is provided to keep old source code working. We
+ strongly advise against using it in new code.
\sa QSerialPort::stopBits
*/
@@ -270,7 +278,9 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed)
\value NoFlowControl No flow control.
\value HardwareControl Hardware flow control (RTS/CTS).
\value SoftwareControl Software flow control (XON/XOFF).
- \value UnknownFlowControl Unknown flow control.
+ \value UnknownFlowControl Unknown flow control. This value is obsolete. It
+ is provided to keep old source code working. We
+ strongly advise against using it in new code.
\sa QSerialPort::flowControl
*/
@@ -291,7 +301,6 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed)
\value ClearToSendSignal CTS (Clear To Send).
\value SecondaryTransmittedDataSignal STD (Secondary Transmitted Data).
\value SecondaryReceivedDataSignal SRD (Secondary Received Data).
- \value UnknownSignal Unknown line state. This value was introduced in QtSerialPort 5.2.
\sa pinoutSignals(), QSerialPort::dataTerminalReady,
QSerialPort::requestToSend
@@ -638,7 +647,7 @@ qint32 QSerialPort::baudRate(Directions directions) const
Q_D(const QSerialPort);
if (directions == QSerialPort::AllDirections)
return d->inputBaudRate == d->outputBaudRate ?
- d->inputBaudRate : QSerialPort::UnknownBaud;
+ d->inputBaudRate : -1;
return directions & QSerialPort::Input ? d->inputBaudRate : d->outputBaudRate;
}
@@ -970,8 +979,7 @@ bool QSerialPort::isRequestToSend()
operating systems cannot provide proper notifications about the changes.
\note The serial port has to be open before trying to get the pinout
- signals; otherwise returns UnknownSignal and sets the NotOpenError error
- code.
+ signals; otherwise returns NoSignal and sets the NotOpenError error code.
\sa isDataTerminalReady(), isRequestToSend, setDataTerminalReady(),
setRequestToSend()
@@ -983,7 +991,7 @@ QSerialPort::PinoutSignals QSerialPort::pinoutSignals()
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
qWarning("%s: device not open", Q_FUNC_INFO);
- return QSerialPort::UnknownSignal;
+ return QSerialPort::NoSignal;
}
return d->pinoutSignals();
diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h
index ada19fb..6e16463 100644
--- a/src/serialport/qserialport.h
+++ b/src/serialport/qserialport.h
@@ -47,10 +47,6 @@
#include <QtSerialPort/qserialportglobal.h>
-#ifndef QT_DEPRECATED_SINCE
-#define QT_DEPRECATED_SINCE(major, minor) 1
-#endif
-
QT_BEGIN_NAMESPACE
class QSerialPortInfo;
@@ -135,6 +131,16 @@ public:
UnknownFlowControl = -1
};
+#if QT_DEPRECATED_SINCE(5, 2)
+#if defined _MSC_VER
+#pragma deprecated(UnknownBaud)
+#pragma deprecated(UnknownDataBits)
+#pragma deprecated(UnknownParity)
+#pragma deprecated(UnknownStopBits)
+#pragma deprecated(UnknownFlowControl)
+#endif
+#endif
+
enum PinoutSignal {
NoSignal = 0x00,
TransmittedDataSignal = 0x01,
@@ -146,8 +152,7 @@ public:
RequestToSendSignal = 0x40,
ClearToSendSignal = 0x80,
SecondaryTransmittedDataSignal = 0x100,
- SecondaryReceivedDataSignal = 0x200,
- UnknownSignal = -1
+ SecondaryReceivedDataSignal = 0x200
};
Q_DECLARE_FLAGS(PinoutSignals, PinoutSignal)
diff --git a/src/serialport/qserialport_symbian.cpp b/src/serialport/qserialport_symbian.cpp
index f22494b..6047793 100644
--- a/src/serialport/qserialport_symbian.cpp
+++ b/src/serialport/qserialport_symbian.cpp
@@ -422,7 +422,8 @@ void QSerialPortPrivate::detectDefaultSettings()
dataBits = QSerialPort::Data8;
break;
default:
- dataBits = QSerialPort::UnknownDataBits;
+ qWarning("%s: Unexpected data bits settings", Q_FUNC_INFO);
+ dataBits = QSerialPort::Data8;
break;
}
@@ -444,7 +445,8 @@ void QSerialPortPrivate::detectDefaultSettings()
parity = QSerialPort::SpaceParity;
break;
default:
- parity = QSerialPort::UnknownParity;
+ qWarning("%s: Unexpected parity settings", Q_FUNC_INFO);
+ parity = QSerialPort::NoParity;
break;
}
@@ -457,7 +459,8 @@ void QSerialPortPrivate::detectDefaultSettings()
stopBits = QSerialPort::TwoStop;
break;
default:
- stopBits = QSerialPort::UnknownStopBits;
+ qWarning("%s: Unexpected stop bits settings", Q_FUNC_INFO);
+ stopBits = QSerialPort::OneStop;
break;
}
@@ -470,8 +473,10 @@ void QSerialPortPrivate::detectDefaultSettings()
flow = QSerialPort::HardwareControl;
else if (currentSettings().iHandshake & KConfigFailDSR)
flow = QSerialPort::NoFlowControl;
- else
- flow = QSerialPort::UnknownFlowControl;
+ else {
+ qWarning("%s: Unexpected flow control settings", Q_FUNC_INFO);
+ flow = QSerialPort::NoFlowControl;
+ }
}
QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp
index 18f24d8..51bb01e 100644
--- a/src/serialport/qserialport_unix.cpp
+++ b/src/serialport/qserialport_unix.cpp
@@ -305,7 +305,7 @@ QSerialPort::PinoutSignals QSerialPortPrivate::pinoutSignals()
if (::ioctl(descriptor, TIOCMGET, &arg) == -1) {
q->setError(decodeSystemError());
- return QSerialPort::UnknownSignal;
+ return QSerialPort::NoSignal;
}
QSerialPort::PinoutSignals ret = QSerialPort::NoSignal;
@@ -881,7 +881,8 @@ void QSerialPortPrivate::detectDefaultSettings()
dataBits = QSerialPort::Data8;
break;
default:
- dataBits = QSerialPort::UnknownDataBits;
+ qWarning("%s: Unexpected data bits settings", Q_FUNC_INFO);
+ dataBits = QSerialPort::Data8;
break;
}
@@ -913,8 +914,10 @@ void QSerialPortPrivate::detectDefaultSettings()
flow = QSerialPort::SoftwareControl;
else if ((currentTermios.c_cflag & CRTSCTS) && (!(currentTermios.c_iflag & (IXON | IXOFF | IXANY))))
flow = QSerialPort::HardwareControl;
- else
- flow = QSerialPort::UnknownFlowControl;
+ else {
+ qWarning("%s: Unexpected flow control settings", Q_FUNC_INFO);
+ flow = QSerialPort::NoFlowControl;
+ }
}
QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index 078ec85..611f8bf 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -368,7 +368,7 @@ QSerialPort::PinoutSignals QSerialPortPrivate::pinoutSignals()
if (!::GetCommModemStatus(descriptor, &modemStat)) {
q->setError(decodeSystemError());
- return QSerialPort::UnknownSignal;
+ return QSerialPort::NoSignal;
}
QSerialPort::PinoutSignals ret = QSerialPort::NoSignal;
@@ -900,7 +900,8 @@ void QSerialPortPrivate::detectDefaultSettings()
dataBits = QSerialPort::Data8;
break;
default:
- dataBits = QSerialPort::UnknownDataBits;
+ qWarning("%s: Unexpected data bits settings", Q_FUNC_INFO);
+ dataBits = QSerialPort::Data8;
break;
}
@@ -915,8 +916,10 @@ void QSerialPortPrivate::detectDefaultSettings()
parity = QSerialPort::EvenParity;
else if ((currentDcb.Parity == ODDPARITY) && currentDcb.fParity)
parity = QSerialPort::OddParity;
- else
- parity = QSerialPort::UnknownParity;
+ else {
+ qWarning("%s: Unexpected parity settings", Q_FUNC_INFO);
+ parity = QSerialPort::NoParity;
+ }
// Detect stopbits.
switch (currentDcb.StopBits) {
@@ -930,7 +933,8 @@ void QSerialPortPrivate::detectDefaultSettings()
stopBits = QSerialPort::TwoStop;
break;
default:
- stopBits = QSerialPort::UnknownStopBits;
+ qWarning("%s: Unexpected stop bits settings", Q_FUNC_INFO);
+ stopBits = QSerialPort::OneStop;
break;
}
@@ -944,8 +948,10 @@ void QSerialPortPrivate::detectDefaultSettings()
} else if (currentDcb.fOutxCtsFlow && (currentDcb.fRtsControl == RTS_CONTROL_HANDSHAKE)
&& !currentDcb.fInX && !currentDcb.fOutX) {
flow = QSerialPort::HardwareControl;
- } else
- flow = QSerialPort::UnknownFlowControl;
+ } else {
+ qWarning("%s: Unexpected flow control settings", Q_FUNC_INFO);
+ flow = QSerialPort::NoFlowControl;
+ }
}
QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
diff --git a/src/serialport/qserialportglobal.h b/src/serialport/qserialportglobal.h
index 09ba0df..d17ce6b 100644
--- a/src/serialport/qserialportglobal.h
+++ b/src/serialport/qserialportglobal.h
@@ -59,6 +59,10 @@ QT_BEGIN_NAMESPACE
#endif
// These macros have been available only since Qt 5.0
+#ifndef QT_DEPRECATED_SINCE
+#define QT_DEPRECATED_SINCE(major, minor) 1
+#endif
+
#ifndef Q_DECL_OVERRIDE
#define Q_DECL_OVERRIDE
#endif
diff --git a/src/serialport/qserialportinfo.cpp b/src/serialport/qserialportinfo.cpp
index 78ef694..5172e60 100644
--- a/src/serialport/qserialportinfo.cpp
+++ b/src/serialport/qserialportinfo.cpp
@@ -258,6 +258,7 @@ bool QSerialPortInfo::hasProductIdentifier() const
/*!
\fn bool QSerialPortInfo::isValid() const
+ \obsolete
Returns true if serial port is present on system;
otherwise returns false.
diff --git a/src/serialport/qserialportinfo.h b/src/serialport/qserialportinfo.h
index daa255f..8320fc5 100644
--- a/src/serialport/qserialportinfo.h
+++ b/src/serialport/qserialportinfo.h
@@ -80,7 +80,9 @@ public:
bool isNull() const;
bool isBusy() const;
- bool isValid() const;
+#if QT_DEPRECATED_SINCE(5, 2)
+ QT_DEPRECATED bool isValid() const;
+#endif
static QList<qint32> standardBaudRates();
static QList<QSerialPortInfo> availablePorts();
diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp
index fee8b84..4433a4e 100644
--- a/src/serialport/qserialportinfo_unix.cpp
+++ b/src/serialport/qserialportinfo_unix.cpp
@@ -180,6 +180,8 @@ QList<QSerialPortInfo> availablePortsBySysfs()
}
} while (targetDir.cdUp());
+ } else if (targetPath.contains(QStringLiteral("pci"))) {
+ // TODO: Obtain more information about the device
} else {
continue;
}
@@ -257,6 +259,8 @@ QList<QSerialPortInfo> availablePortsByUdev()
// TODO: Obtain more information
} else if (subsys == QStringLiteral("platform")) {
continue;
+ } else if (subsys == QStringLiteral("pci")) {
+ // TODO: Obtain more information about the device
} else {
// FIXME: Obtain more information
}