From 98bd303d934b804c90cb236a4ae1775f0cf95826 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 20 Jun 2018 15:01:35 +0900 Subject: qt-ble: purge pending read data when writing This should never happen, since our interface is bassically synchronous, but it could happen with delayed replies that came in just after we decided to re-transmit a command. Signed-off-by: Linus Torvalds --- core/qt-ble.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core') diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp index 7556b01f8..2d1de1408 100644 --- a/core/qt-ble.cpp +++ b/core/qt-ble.cpp @@ -155,6 +155,9 @@ dc_status_t BLEObject::write(const void *data, size_t size, size_t *actual) if (!receivedPackets.isEmpty()) { qDebug() << ".. write HIT with still incoming packets in queue"; + do { + receivedPackets.takeFirst(); + } while (!receivedPackets.isEmpty()); } QList list = preferredService()->characteristics(); -- cgit v1.2.3-70-g09d2