From 498a86755840c49725064bf490de8abe407ef8e2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 15 Jul 2019 21:08:10 +1000 Subject: [PATCH] Revert "base: once the device is registered, we're done" This broke device initialization in some cases (not sure why it worked until today though). Where a device is in register mode but the ManufacturerData has not yet updated to the 4-byte string (i.e. a device previously known normally), the device would now always call listen(). The firmware - in register mode - would start initializing the connection though and get rejected, leaving us with a device that cannot be registered. This reverts commit a061240b116a61b355f2f07b971e5c60f81050c1. --- tuhi/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tuhi/base.py b/tuhi/base.py index b594281..242666a 100644 --- a/tuhi/base.py +++ b/tuhi/base.py @@ -385,11 +385,11 @@ class Tuhi(GObject.Object): d = self.devices[bluez_device.address] - if d.mode == DeviceMode.LISTEN or d.listening: - d.listen() - else: + if mode == DeviceMode.REGISTER: d.mode = mode logger.debug(f'{bluez_device.objpath}: call Register() on device') + elif d.listening: + d.listen() def _on_bluez_device_updated(self, manager, bluez_device): self._add_device(manager, bluez_device, True)