Skip to content

Commit

Permalink
BLESession: Enrich logs for device UUID check
Browse files Browse the repository at this point in the history
To debug the GitHub issue #30, add more debug logs to functions to check
UUID.

Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
  • Loading branch information
kawasaki committed Nov 14, 2021
1 parent 80b99f8 commit 266bcc9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pyscrlink/scratch_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,11 @@ def _get_dev_uuid(self, dev):
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):
Expand All @@ -481,11 +484,11 @@ def matches(self, dev, filters):
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...")
Expand Down

0 comments on commit 266bcc9

Please sign in to comment.