From bad7aa45540a8d788444fdf12c7b196af8c2cf73 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 21 Aug 2019 20:49:58 +1000 Subject: [PATCH] wacom: treat any settings.ini misconfigurations as unregistered This situation will never be handled correctly b a GUI and there's no need to, our settings aren't supposed to be edited by puny humans. So just log an error and treat the device as unregistered. Signed-off-by: Peter Hutterer --- tuhi/wacom.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 86e0013..46fe091 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -260,10 +260,6 @@ class WacomTimeoutException(WacomException): errno = errno.ETIME -class WacomCorruptDataException(WacomException): - errno = errno.EPROTO - - class WacomPacket(GObject.Object): ''' A single protocol packet of variable length. The protocol format is a @@ -970,13 +966,10 @@ class WacomDevice(GObject.Object): try: protocol = ProtocolVersion.from_string(self._config['Protocol']) - except KeyError: - raise WacomCorruptDataException(f'Missing Protocol entry from config file. Please delete config file and re-register device') - except ValueError: - logger.error(f'Unknown protocol in configuration: {self._config["Protocol"]}') - raise WacomCorruptDataException(f'Unknown Protocol {self._config["Protocol"]}') - - self._init_protocol(protocol) + self._init_protocol(protocol) + except (KeyError, ValueError): + logger.error(f'Missing or invalid Protocol entry in config file. Treating this device as unregistered') + self._uuid = None def _init_protocol(self, protocol): protocols = {