handle ESHUTDOWN during hid write()

61b7f805dc
This commit is contained in:
Devaev Maxim 2020-10-03 05:31:52 +03:00
parent 792f94d9e8
commit 9db6a4a6b4

View File

@ -162,7 +162,11 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in
logger.error("HID-%s write() error: written (%s) != report length (%d)", logger.error("HID-%s write() error: written (%s) != report length (%d)",
self.__name, written, len(report)) self.__name, written, len(report))
except Exception as err: except Exception as err:
if isinstance(err, OSError) and err.errno == errno.EAGAIN: # pylint: disable=no-member if isinstance(err, OSError) and (
# https://github.com/raspberrypi/linux/commit/61b7f805dc2fd364e0df682de89227e94ce88e25
err.errno == errno.EAGAIN
or err.errno == errno.ESHUTDOWN
):
logger.debug("HID-%s busy/unplugged (write): %s: %s", logger.debug("HID-%s busy/unplugged (write): %s: %s",
self.__name, type(err).__name__, err) self.__name, type(err).__name__, err)
else: else: