From 1e0bdfb31b84bb1b74c3a20cd0df1440127f8263 Mon Sep 17 00:00:00 2001 From: Joe Villegas Date: Sun, 14 Feb 2021 13:32:57 -0800 Subject: [PATCH 1/2] Check for UUID on "Unknown" device name --- src/mario.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mario.py b/src/mario.py index bddee31..f5e9428 100644 --- a/src/mario.py +++ b/src/mario.py @@ -148,7 +148,7 @@ async def run(self): self.gui.accel_field.SetLabel("") devices = await BleakScanner.discover() for d in devices: - if d.name.lower().startswith("lego mario"): + if d.name.lower().startswith("lego mario") or LEGO_CHARACTERISTIC_UUID in d.metadata['uuids']: self.gui.status_field.SetLabel("Found Mario!") try: async with BleakClient(d.address) as client: From fda68d1ccb1483ec171fd59366b25abb5f37a741 Mon Sep 17 00:00:00 2001 From: Joe Villegas Date: Sun, 14 Feb 2021 15:02:51 -0800 Subject: [PATCH 2/2] Add service UUID --- src/mario.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mario.py b/src/mario.py index f5e9428..d685c02 100644 --- a/src/mario.py +++ b/src/mario.py @@ -18,6 +18,7 @@ # BLE stuff LEGO_CHARACTERISTIC_UUID = "00001624-1212-efde-1623-785feabcd123" +LEGO_SERVICE_UUID = "00001623-1212-efde-1623-785feabcd123" SUBSCRIBE_IMU_COMMAND = bytearray([0x0A, 0x00, 0x41, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01]) SUBSCRIBE_RGB_COMMAND = bytearray([0x0A, 0x00, 0x41, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01]) @@ -148,7 +149,7 @@ async def run(self): self.gui.accel_field.SetLabel("") devices = await BleakScanner.discover() for d in devices: - if d.name.lower().startswith("lego mario") or LEGO_CHARACTERISTIC_UUID in d.metadata['uuids']: + if d.name.lower().startswith("lego mario") or LEGO_SERVICE_UUID in d.metadata['uuids']: self.gui.status_field.SetLabel("Found Mario!") try: async with BleakClient(d.address) as client: