diff options
Diffstat (limited to 'qtserialbluetooth.cpp')
-rw-r--r-- | qtserialbluetooth.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/qtserialbluetooth.cpp b/qtserialbluetooth.cpp index 442702da7..ee8b2b793 100644 --- a/qtserialbluetooth.cpp +++ b/qtserialbluetooth.cpp @@ -248,8 +248,15 @@ static int qt_serial_read(serial_t *device, void* data, unsigned int size) } else if (rc == 0) { // Wait until the device is available for read operations QEventLoop loop; + QTimer timer; + timer.setSingleShot(true); + loop.connect(&timer, SIGNAL(timeout()), SLOT(quit())); loop.connect(device->socket, SIGNAL(readyRead()), SLOT(quit())); + timer.start(device->timeout); loop.exec(); + + if (!timer.isActive()) + return nbytes; } nbytes += rc; |