From 9ae7de563cd0cec2fdfbea32c9cd3cfbc6df80ab Mon Sep 17 00:00:00 2001 From: Jakub Uliarczyk <117639042+jaul-nsc@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:04:28 +0100 Subject: [PATCH] [tcat] fix: use normalize_uuid_str() on BBTC_SERVICE_UUID (#10879) This commit adds 'normalize_uuid_str()' in 'scan_tcat_devices()'. It fixes an issue finding TCAT devices in newer versions of the 'bleak' module. --- tools/tcat_ble_client/ble/ble_scanner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tcat_ble_client/ble/ble_scanner.py b/tools/tcat_ble_client/ble/ble_scanner.py index 39248bb882b..408e4d2e272 100644 --- a/tools/tcat_ble_client/ble/ble_scanner.py +++ b/tools/tcat_ble_client/ble/ble_scanner.py @@ -28,6 +28,7 @@ from bleak import BleakScanner from bleak.backends.device import BLEDevice +from bleak.uuids import normalize_uuid_str from bbtc import BBTC_SERVICE_UUID from typing import Optional from ble.ble_advertisement_data import AdvertisedData @@ -48,9 +49,8 @@ async def find_first_by_mac(mac): async def scan_tcat_devices(adapter: Optional[str] = None): scanner = BleakScanner() tcat_devices: list[BLEDevice] = [] - discovered_devices = await scanner.discover(return_adv=True, - service_uuids=[BBTC_SERVICE_UUID.lower()], - adapter=adapter) + service_uuids = [normalize_uuid_str(BBTC_SERVICE_UUID)] + discovered_devices = await scanner.discover(return_adv=True, service_uuids=service_uuids, adapter=adapter) for _, (device, adv) in discovered_devices.items(): ad = None for uuid, data in adv.service_data.items():