I assume, you are use the Linux...
https://github.com/qt/qtserialport/blob/dev/src/serialport/qserialport_unix.cpp#L986
look on:
if (ret == 0) {
setError(QSerialPortErrorInfo(QSerialPort::TimeoutError));
return false;
}
prevouosly, the qt_safe_poll has been implemented something like that (e.g. up to Qt6, e.g. in Qt 5.15):
https://github.com/qt/qtbase/blob/5.15/src/corelib/kernel/qcore_unix.cpp#L150
int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts)
{
if (!timeout_ts) {
// no timeout -> block forever
int ret;
EINTR_LOOP(ret, qt_ppoll(fds, nfds, nullptr));
return ret;
}
timespec start = qt_gettime();
timespec timeout = *timeout_ts;
// loop and recalculate the timeout as needed
forever {
const int ret = qt_ppoll(fds, nfds, &timeout);
if (ret != -1 || errno != EINTR)
return ret;
// recalculate the timeout
if (!time_update(&timeout, start, *timeout_ts)) {
// timeout during update
// or clock reset, fake timeout error
return 0;
}
}
}
look on:
// timeout during update
// or clock reset, fake timeout error
return 0;
so, the ret-code with 0-value was interpreted as a some TimeoutError (only when you ar euse the waitFor metrods, on Linux).
But right now, in Qt6, the implementation of qt_safe_poll seems a bit different:
https://github.com/qt/qtbase/blob/6.8/src/corelib/kernel/qcore_unix.cpp#L121
look on:
int qt_safe_poll(struct pollfd *fds, nfds_t nfds, QDeadlineTimer deadline)
{
if (deadline.isForever()) {
// no timeout -> block forever
int ret;
QT_EINTR_LOOP(ret, qt_ppoll(fds, nfds, nullptr));
return ret;
}
using namespace std::chrono;
nanoseconds remaining = deadline.remainingTimeAsDuration();
// loop and recalculate the timeout as needed
do {
timespec ts = durationToTimespec(remaining);
const int ret = qt_ppoll(fds, nfds, &ts);
if (ret != -1 || errno != EINTR)
return ret;
remaining = deadline.remainingTimeAsDuration();
} while (remaining > 0ns);
return 0;
}
so, maybe a cause in that.. maybe in something else. Just don't use the waifForXXX methods... it is a crutch.
AFAIK, right not there are no any maintainer for a serialport module... I assume, that the serialport module should be refactored because it's implementation is too old.