Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qt6-serialport for openSUSE:Factory checked in at 2025-02-03 21:41:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qt6-serialport (Old) and /work/SRC/openSUSE:Factory/.qt6-serialport.new.2316 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qt6-serialport" Mon Feb 3 21:41:13 2025 rev:28 rq:1242067 version:6.8.2 Changes: -------- --- /work/SRC/openSUSE:Factory/qt6-serialport/qt6-serialport.changes 2025-01-25 19:10:02.706667222 +0100 +++ /work/SRC/openSUSE:Factory/.qt6-serialport.new.2316/qt6-serialport.changes 2025-02-03 21:41:28.565422246 +0100 @@ -1,0 +2,6 @@ +Fri Jan 31 10:23:00 UTC 2025 - Christophe Marin <christo...@krop.fr> + +- Update to 6.8.2 + https://www.qt.io/blog/qt-6.8.2-released + +------------------------------------------------------------------- Old: ---- qtserialport-everywhere-src-6.8.1.tar.xz New: ---- qtserialport-everywhere-src-6.8.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qt6-serialport.spec ++++++ --- /var/tmp/diff_new_pack.FClmMt/_old 2025-02-03 21:41:30.065484420 +0100 +++ /var/tmp/diff_new_pack.FClmMt/_new 2025-02-03 21:41:30.073484751 +0100 @@ -16,7 +16,7 @@ # -%define real_version 6.8.1 +%define real_version 6.8.2 %define short_version 6.8 %define tar_name qtserialport-everywhere-src %define tar_suffix %{nil} @@ -27,7 +27,7 @@ %endif # Name: qt6-serialport%{?pkg_suffix} -Version: 6.8.1 +Version: 6.8.2 Release: 0 Summary: Qt 6 SerialPort library License: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only ++++++ qtserialport-everywhere-src-6.8.1.tar.xz -> qtserialport-everywhere-src-6.8.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/.cmake.conf new/qtserialport-everywhere-src-6.8.2/.cmake.conf --- old/qtserialport-everywhere-src-6.8.1/.cmake.conf 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/.cmake.conf 2025-01-24 06:31:04.000000000 +0100 @@ -1,4 +1,4 @@ -set(QT_REPO_MODULE_VERSION "6.8.1") +set(QT_REPO_MODULE_VERSION "6.8.2") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1") list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/.tag new/qtserialport-everywhere-src-6.8.2/.tag --- old/qtserialport-everywhere-src-6.8.1/.tag 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/.tag 2025-01-24 06:31:04.000000000 +0100 @@ -1 +1 @@ -88467a588d7c312d0c24adc6edd2a96e199cf760 +da87c23f2f0e9caa311fd2314c80696b05ba9ac7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/dependencies.yaml new/qtserialport-everywhere-src-6.8.2/dependencies.yaml --- old/qtserialport-everywhere-src-6.8.1/dependencies.yaml 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/dependencies.yaml 2025-01-24 06:31:04.000000000 +0100 @@ -1,4 +1,4 @@ dependencies: ../qtbase: - ref: 0db4321f2f13c6870283f3fcc0f1a462fd7cf663 + ref: f1136de66638060b8a1ab9bc0cdf1a91dcb5ec01 required: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialport.cpp new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialport.cpp --- old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialport.cpp 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialport.cpp 2025-01-24 06:31:04.000000000 +0100 @@ -129,11 +129,11 @@ See the following example: \code - int numRead = 0, numReadTotal = 0; + qint64 numReadTotal = 0; char buffer[50]; for (;;) { - numRead = serial.read(buffer, 50); + const qint64 numRead = serial.read(buffer, 50); // Do whatever with the array @@ -433,13 +433,17 @@ successful; otherwise returns \c false and sets an error code which can be obtained by calling the error() method. - \note The method returns \c false if opening the port is successful, but could + The method returns \c false if opening the port is successful, but could not set any of the port settings successfully. In that case, the port is closed automatically not to leave the port around with incorrect settings. \warning The \a mode has to be QIODeviceBase::ReadOnly, QIODeviceBase::WriteOnly, or QIODeviceBase::ReadWrite. Other modes are unsupported. + \note Due to historical reasons, upon a successful open the + \l errorOccurred() signal is emitted with the \l {QSerialPort::}{NoError} + error code. This behavior is preserved to keep backwards compatibility. + \sa QIODeviceBase::OpenMode, setPort() */ bool QSerialPort::open(OpenMode mode) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialport_p.h new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialport_p.h --- old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialport_p.h 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialport_p.h 2025-01-24 06:31:04.000000000 +0100 @@ -169,6 +169,8 @@ bool startAsyncRead(); + bool emittedReadyRead = false; + #if defined(Q_OS_WIN32) bool setDcb(DCB *dcb); @@ -243,7 +245,6 @@ bool readPortNotifierState = false; bool readPortNotifierStateSet = false; - bool emittedReadyRead = false; bool emittedBytesWritten = false; qint64 pendingBytesWritten = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialport_unix.cpp new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialport_unix.cpp --- old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialport_unix.cpp 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialport_unix.cpp 2025-01-24 06:31:04.000000000 +0100 @@ -1065,7 +1065,11 @@ par ^= parity == QSerialPort::MarkParity; if (par ^ (tio.c_cflag & PARODD)) { // Need switch parity mode? tio.c_cflag ^= PARODD; - flush(); //force sending already buffered data, because setTermios(&tio); cleares buffers + //force sending already buffered data, because setTermios(&tio); cleares buffers + if (::tcdrain(descriptor) == -1) { + setError(getSystemError()); + break; + } //todo: add receiving buffered data!!! if (!setTermios(&tio)) break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialport_win.cpp new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialport_win.cpp --- old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialport_win.cpp 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialport_win.cpp 2025-01-24 06:31:04.000000000 +0100 @@ -582,7 +582,11 @@ { Q_Q(QSerialPort); - emit q->readyRead(); + if (!emittedReadyRead) { + emittedReadyRead = true; + emit q->readyRead(); + emittedReadyRead = false; + } } qint64 QSerialPortPrivate::writeData(const char *data, qint64 maxSize) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialportinfo.cpp new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialportinfo.cpp --- old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialportinfo.cpp 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialportinfo.cpp 2025-01-24 06:31:04.000000000 +0100 @@ -41,6 +41,18 @@ \snippet doc_src_serialport.cpp enumerate_ports + \section1 Port enumeration on Linux + + By default Linux uses \c {libudev} to enumerate the available serial ports. + If the library is not available, it falls back to reading files in the + \c {/sys/class/tty} directory. + + It is known that some versions of \c {libudev} have a bug and incorrectly + report VID and PID of a USB hub instead of the actual device. In such cases, + define the \c {QT_SERIALPORT_SKIP_UDEV_LOOKUP} environment variable to skip + the \c {libudev} lookup and only use the information from the + \c {/sys/class/tty} directory. + \sa QSerialPort */ @@ -250,6 +262,8 @@ \fn QList<QSerialPortInfo> QSerialPortInfo::availablePorts() Returns a list of available serial ports on the system. + + \sa {Port enumeration on Linux} */ QT_END_NAMESPACE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialportinfo.h new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialportinfo.h --- old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialportinfo.h 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialportinfo.h 2025-01-24 06:31:04.000000000 +0100 @@ -40,7 +40,7 @@ bool hasVendorIdentifier() const; bool hasProductIdentifier() const; - bool isNull() const; + bool isNull() const { return !d_ptr; } static QList<qint32> standardBaudRates(); static QList<QSerialPortInfo> availablePorts(); @@ -53,9 +53,6 @@ std::unique_ptr<QSerialPortInfoPrivate> d_ptr; }; -inline bool QSerialPortInfo::isNull() const -{ return !d_ptr; } - QT_END_NAMESPACE #endif // QSERIALPORTINFO_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialportinfo_unix.cpp new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialportinfo_unix.cpp --- old/qtserialport-everywhere-src-6.8.1/src/serialport/qserialportinfo_unix.cpp 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/src/serialport/qserialportinfo_unix.cpp 2025-01-24 06:31:04.000000000 +0100 @@ -10,6 +10,7 @@ #include <QtCore/qlockfile.h> #include <QtCore/qfile.h> #include <QtCore/qdir.h> +#include <QtCore/qtenvironmentvariables.h> #include <private/qcore_unix_p.h> @@ -23,6 +24,8 @@ QT_BEGIN_NAMESPACE +constexpr char SkipUdevEnvVarName[] = "QT_SERIALPORT_SKIP_UDEV_LOOKUP"; + static QStringList filteredDeviceFilePaths() { static const QStringList deviceFileNameFilterList = QStringList() @@ -414,9 +417,12 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() { - bool ok; + bool ok = false; + QList<QSerialPortInfo> serialPortInfoList; - QList<QSerialPortInfo> serialPortInfoList = availablePortsByUdev(ok); + const bool skipUdevLookup = qEnvironmentVariableIsSet(SkipUdevEnvVarName); + if (!skipUdevLookup) + serialPortInfoList = availablePortsByUdev(ok); #ifdef Q_OS_LINUX if (!ok) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtserialport-everywhere-src-6.8.1/tests/auto/qserialport/tst_qserialport.cpp new/qtserialport-everywhere-src-6.8.2/tests/auto/qserialport/tst_qserialport.cpp --- old/qtserialport-everywhere-src-6.8.1/tests/auto/qserialport/tst_qserialport.cpp 2024-11-19 12:13:56.000000000 +0100 +++ new/qtserialport-everywhere-src-6.8.2/tests/auto/qserialport/tst_qserialport.cpp 2025-01-24 06:31:04.000000000 +0100 @@ -108,8 +108,13 @@ void readWriteWithDifferentBaudRate_data(); void readWriteWithDifferentBaudRate(); + void readWriteWithMarkSpaceParity_data(); + void readWriteWithMarkSpaceParity(); + void bindingsAndProperties(); + void readyReadNotRecursive(); + protected slots: void handleBytesWrittenAndExitLoopSlot(qint64 bytesWritten); void handleBytesWrittenAndExitLoopSlot2(qint64 bytesWritten); @@ -861,14 +866,14 @@ { Q_OBJECT public: - explicit AsyncWriterByTimer( - QSerialPort &port, Qt::ConnectionType connectionType, const QByteArray &dataToWrite) - : serialPort(port), writeChunkSize(0) + explicit AsyncWriterByTimer(QSerialPort &port, Qt::ConnectionType connectionType, + const QByteArray &dataToWrite, int interval = 0) + : serialPort(port), writeChunkSize(0), timerMsec(interval) { writeBuffer.setData(dataToWrite); writeBuffer.open(QIODevice::ReadOnly); connect(&timer, &QTimer::timeout, this, &AsyncWriterByTimer::send, connectionType); - timer.start(0); + timer.start(timerMsec); } private slots: @@ -885,6 +890,7 @@ QBuffer writeBuffer; int writeChunkSize; QTimer timer; + int timerMsec; }; void tst_QSerialPort::asynchronousWriteByTimer_data() @@ -1262,6 +1268,52 @@ } } +void tst_QSerialPort::readWriteWithMarkSpaceParity_data() +{ + QTest::addColumn<QSerialPort::Parity>("parity"); + + QTest::newRow("parity_space") << QSerialPort::SpaceParity; + QTest::newRow("parity_mark") << QSerialPort::MarkParity; +} + +void tst_QSerialPort::readWriteWithMarkSpaceParity() +{ + QFETCH(const QSerialPort::Parity, parity); + + auto setupPort = [&parity](QSerialPort &port) { + port.setBaudRate(QSerialPort::Baud9600); + port.setParity(parity); + port.setDataBits(QSerialPort::Data8); + port.setStopBits(QSerialPort::OneStop); + }; + + QSerialPort sender(m_senderPortName); + QSignalSpy senderSpy(&sender, &QSerialPort::bytesWritten); + setupPort(sender); + QVERIFY(sender.open(QIODevice::ReadWrite)); + + QSerialPort receiver(m_receiverPortName); + QSignalSpy receiverSpy(&receiver, &QSerialPort::readyRead); + setupPort(receiver); + QVERIFY(receiver.open(QIODevice::ReadWrite)); + + const QByteArray data("some data"); + const qint64 written = sender.write(data); + QCOMPARE(written, qint64(data.size())); + QTRY_COMPARE(senderSpy.size(), 1); + QCOMPARE(senderSpy.at(0).at(0).value<qint64>(), written); + + QTRY_COMPARE_GE(receiver.bytesAvailable(), written); + QCOMPARE_GE(receiverSpy.size(), 1); // we should get *at least one* signal + +#if !defined(Q_OS_UNIX) || defined(CMSPAR) + // On UNIX with no CMSPAR the result is flaky, so we cannot even use + // QEXPECT_FAIL(). See QTBUG-131679. + const QByteArray receivedData = receiver.readAll(); + QCOMPARE(receivedData, data); +#endif +} + void tst_QSerialPort::bindingsAndProperties() { QSerialPort sp; @@ -1349,5 +1401,78 @@ } } +// The reader connects to readyRead() and then calls waitForReadyRead() +// inside the slot. +// The tst_QSerialPort::readyReadNotRecursive() test needs to make sure +// that the slot is entered only once. +class SemiBlockingReader : public QObject +{ + Q_OBJECT +public: + explicit SemiBlockingReader(const QString &portName) + : QObject(nullptr), m_portName(portName) + {} + + int numSlotCalls() const { return m_numCalls; } + QByteArray receivedData() const { return m_data; } + +public slots: + void start() + { + m_reader = new QSerialPort(m_portName, this); + connect(m_reader, &QSerialPort::readyRead, this, &SemiBlockingReader::readData); + if (!m_reader->open(QIODevice::ReadOnly)) + emit error(); + } + +private slots: + void readData() + { + ++m_numCalls; + m_data.append(m_reader->readAll()); + while (m_reader->waitForReadyRead(1000)) + m_data.append(m_reader->readAll()); + emit allDataReceived(); + } + +signals: + void error(); + void allDataReceived(); + +private: + QString m_portName; + QByteArray m_data; + QSerialPort *m_reader = nullptr; + int m_numCalls = 0; +}; + +void tst_QSerialPort::readyReadNotRecursive() +{ + SemiBlockingReader reader(m_receiverPortName); + QThread readerThread; + connect(&readerThread, &QThread::started, &reader, &SemiBlockingReader::start); + connect(&reader, &SemiBlockingReader::allDataReceived, &readerThread, &QThread::quit); + int errorCount = 0; + connect(&reader, &SemiBlockingReader::error, this, [&] { + ++errorCount; + readerThread.quit(); + }); + bool readerThreadFinished = false; + connect(&readerThread, &QThread::finished, this, [&] { readerThreadFinished = true; }); + + reader.moveToThread(&readerThread); + readerThread.start(); + + QSerialPort senderPort(m_senderPortName); + QVERIFY(senderPort.open(QSerialPort::WriteOnly)); + [[maybe_unused]] AsyncWriterByTimer writer(senderPort, Qt::DirectConnection, + alphabetArray, 50); + + QTRY_VERIFY(readerThreadFinished); + QCOMPARE(errorCount, 0); + QCOMPARE(reader.numSlotCalls(), 1); + QCOMPARE(reader.receivedData(), alphabetArray); +} + QTEST_MAIN(tst_QSerialPort) #include "tst_qserialport.moc"