This adds the QIODevice::Unbuffered flag to our rfcomm connections to
bypass the buffering layer in QIODevice.

This fixes so firmware upgrades work against the OSTC Sport.

Signed-off-by: Anton Lundin <gla...@acc.umu.se>
---
I'm CC'ing Thiago and Claudiu here, so they can take a look and stop me
if I've gone off by meds and misunderstood something here.

So, Dirk: Please wait for a comment from them before taking these patches.

 qtserialbluetooth.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qtserialbluetooth.cpp b/qtserialbluetooth.cpp
index 6a3360c..025ab8c 100644
--- a/qtserialbluetooth.cpp
+++ b/qtserialbluetooth.cpp
@@ -114,7 +114,7 @@ static int qt_serial_open(serial_t **out, dc_context_t 
*context, const char* dev
 #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
        // First try to connect on RFCOMM channel 1. This is the default 
channel for most devices
        QBluetoothAddress remoteDeviceAddress(devaddr);
-       serial_port->socket->connectToService(remoteDeviceAddress, 1);
+       serial_port->socket->connectToService(remoteDeviceAddress, 1, 
QIODevice::ReadWrite | QIODevice::Unbuffered);
        timer.start(msec);
        loop.exec();
 
@@ -126,7 +126,7 @@ static int qt_serial_open(serial_t **out, dc_context_t 
*context, const char* dev
        } else if (serial_port->socket->state() == 
QBluetoothSocket::UnconnectedState) {
                // Try to connect on channel number 5. Maybe this is a 
Shearwater Petrel2 device.
                qDebug() << "Connection on channel 1 failed. Trying on channel 
number 5.";
-               serial_port->socket->connectToService(remoteDeviceAddress, 5);
+               serial_port->socket->connectToService(remoteDeviceAddress, 5, 
QIODevice::ReadWrite | QIODevice::Unbuffered);
                timer.start(msec);
                loop.exec();
 
-- 
2.1.4

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to