diff --git a/tuhi/protocol.py b/tuhi/protocol.py index 887b08d..24f0e52 100644 --- a/tuhi/protocol.py +++ b/tuhi/protocol.py @@ -602,7 +602,13 @@ class MsgConnectSpark(Msg): if len(self.args) != 6: raise ValueError('UUID must be 6 bytes long') - # uses the default 0xb3 handler + def _handle_reply(self, reply): + try: + super()._handle_reply(reply) + except DeviceError as e: + if e.errorcode == DeviceError.ErrorCode.GENERAL_ERROR: + raise AuthorizationError() + raise e class MsgGetName(Msg): diff --git a/tuhi/wacom.py b/tuhi/wacom.py index a821c42..8b6db19 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -395,12 +395,9 @@ class WacomRegisterHelper(WacomProtocolLowLevelComm): # expected try: self.p.execute(Interactions.CONNECT, uuid) - except tuhi.protocol.DeviceError as e: - if e.errorcode == tuhi.protocol.DeviceError.ErrorCode.GENERAL_ERROR: - # this is expected - pass - else: - raise e + except AuthorizationError: + # this is expected + pass # The "press button now command" on the spark self.p.execute(Interactions.REGISTER_PRESS_BUTTON)