From 641b84a86e2c4d31e2b3bfd1e9edc2c59984384f Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Sun, 14 Nov 2021 13:41:54 +0900 Subject: [PATCH] BLESession: Enrich logs for device UUID check To debug the GitHub issue #30, add more debug logs to functions to check UUID. Signed-off-by: Shin'ichiro Kawasaki --- pyscrlink/scratch_link.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyscrlink/scratch_link.py b/pyscrlink/scratch_link.py index 7d09c46..42da30a 100755 --- a/pyscrlink/scratch_link.py +++ b/pyscrlink/scratch_link.py @@ -457,8 +457,11 @@ class BLESession(Session): for adtype in self.SERVICE_CLASS_UUID_ADTYPES: service_class_uuid = dev.getValueText(adtype) if service_class_uuid: - logger.debug(self.SERVICE_CLASS_UUID_ADTYPES[adtype]) - return UUID(service_class_uuid) + a = self.SERVICE_CLASS_UUID_ADTYPES[adtype] + logger.debug(f"service class uuid for {a}/{adtype}: {service_class_uuid}") + uuid = UUID(service_class_uuid) + logger.debug(f"uuid: {uuid}") + return uuid return None def matches(self, dev, filters): @@ -471,11 +474,11 @@ class BLESession(Session): for s in f['services']: logger.debug(f"service to check: {s}") given_uuid = s - logger.debug(f"given: {given_uuid}") + logger.debug(f"given UUID: {given_uuid} hash={UUID(given_uuid).__hash__()}") dev_uuid = self._get_dev_uuid(dev) if not dev_uuid: continue - logger.debug(f"dev: {dev_uuid}") + logger.debug(f"dev UUID: {dev_uuid} hash={dev_uuid.__hash__()}") logger.debug(given_uuid == dev_uuid) if given_uuid == dev_uuid: logger.debug("match...")