diff --git a/tuhi/protocol.py b/tuhi/protocol.py index 91ff2e2..887b08d 100644 --- a/tuhi/protocol.py +++ b/tuhi/protocol.py @@ -446,6 +446,12 @@ class DeviceError(ProtocolError): if self.errorcode == DeviceError.ErrorCode.INVALID_STATE: self.errno = errno.EBADE + def __repr__(self): + return f'DeviceError.{self.errorcode.name}' + + def __str__(self): + return repr(self) + class Msg(object): ''' diff --git a/tuhi/wacom.py b/tuhi/wacom.py index f9128f8..a821c42 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -23,7 +23,7 @@ from gi.repository import GObject from .drawing import Drawing from .uhid import UHIDDevice import tuhi.protocol -from tuhi.protocol import NordicData, Interactions, Mode, ProtocolVersion, StrokeFile, UnexpectedDataError, DeviceError, MissingReplyError +from tuhi.protocol import NordicData, Interactions, Mode, ProtocolVersion, StrokeFile, UnexpectedDataError, DeviceError, MissingReplyError, AuthorizationError from .util import list2hex, flatten from tuhi.config import TuhiConfig @@ -1017,6 +1017,9 @@ class WacomDevice(GObject.Object): except DeviceError as e: logger.error(f'**** Exception: {e} ****') exception = e + except AuthorizationError as e: + logger.error(f'Authorization failed, device needs to be re-registered') + exception = e finally: self.sync_state = 0 self._is_running = False