From a0566e0dc0d864a05efe69146f61dd99270e4cbd Mon Sep 17 00:00:00 2001 From: Niclas Hoyer Date: Thu, 2 Jan 2020 20:59:04 +0100 Subject: [PATCH] Workaround for Spark register problems This is a workaround for registering problems with Spark. The registration hangs at "Connecting to device...". Internally the `GENERAL_ERROR` occurs, which is expected when registering a Spark device, but this should also raise an AuthorizeException, but it instead reaches the handler as DeviceError. It is currently unclear why the `GENERAL_ERROR` passes to this handler, so this catches any `GENERAL_ERROR` while registering a Spark device. --- tuhi/wacom.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 0d139c5..798172e 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -423,6 +423,13 @@ class WacomRegisterHelper(WacomProtocolLowLevelComm): except AuthorizationError: # this is expected pass + except Exception as e: + logger.exception('Got other Exception while registering Spark device') + if e.errorcode == DeviceError.ErrorCode.GENERAL_ERROR: + logger.debug('Got GENERAL_ERROR while registering Spark device') + pass + else: + raise # The "press button now command" on the spark self.p.execute(Interactions.REGISTER_PRESS_BUTTON)