From aa80ecc77ee91447a2a6bdb355e5de0b2c776ac2 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 17 Feb 2020 12:58:19 -0800 Subject: [PATCH] BLE: prefer known recognized services Yes, yes, we should probably be gathering a list of these. But this is a test patch for the Cressi BLE dongle, which has a Nordic UART service that we should pick. If we were to have a proper list of known services, we could do that for the Heinrich Weicamp case above too. Right now that's another hardcoded service name. But let's test this first, and if this works and we end up having a third case one day, we can make it a real list. Service number reported by Martin de Weger, and screenshots of his from the Nordic nRF Connect app show that Nordic calls that service "Nordic UART service". Which is a big hint that it is probably - wait for it - a serial UART service. Sherlock Holmes has nothing on me. I can figure out these tough technical conundrums all day long. Cc: Martin de Weger Signed-off-by: Linus Torvalds --- core/qt-ble.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp index 1b157b8ef..396c62cd7 100644 --- a/core/qt-ble.cpp +++ b/core/qt-ble.cpp @@ -123,6 +123,11 @@ void BLEObject::addService(const QBluetoothUuid &newService) } } + // Is it a Nordic UART service? + // If so, throw out any earlier services, we'll pick this one + if (newService == QUuid("{6e400001-b5a3-f393-e0a9-e50e24dcca9e}")) + services.clear(); + auto service = controller->createServiceObject(newService, this); qDebug() << " .. created service object" << service; if (service) {