protocol: on the spark treat a general error during connect as wrong uuid

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
pull/191/head
Peter Hutterer 2019-08-22 11:51:38 +10:00 committed by Benjamin Tissoires
parent 7a121cfe6c
commit f21af42131
2 changed files with 10 additions and 7 deletions

View File

@ -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):

View File

@ -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)