serial hid: clear events on exceptions

This commit is contained in:
Devaev Maxim 2020-10-14 17:01:10 +03:00
parent c4dc68bee5
commit d769742768

View File

@ -348,12 +348,14 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
self.clear_events() self.clear_events()
except serial.SerialException as err: except serial.SerialException as err:
self.clear_events()
if err.errno == errno.ENOENT: if err.errno == errno.ENOENT:
logger.error("Missing HID serial device: %s", self.__device_path) logger.error("Missing HID serial device: %s", self.__device_path)
else: else:
logger.exception("Unexpected HID error") logger.exception("Unexpected HID error")
except Exception: except Exception:
self.clear_events()
logger.exception("Unexpected HID error") logger.exception("Unexpected HID error")
finally: finally: