diff options
author | Maxim Devaev <[email protected]> | 2021-08-28 19:01:13 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2021-08-28 19:01:13 +0300 |
commit | 2db0656df3ecd7c1f4502591c1a734905613e7ec (patch) | |
tree | 7ccf1cbd9a2e09ca12710302b6bc8fb3dc6b729e /kvmd/plugins/hid/otg/device.py | |
parent | 08dad87fea9cd3b5ced5642864c5e8c359e8b1cc (diff) |
unified udc code and automatic driver detection
Diffstat (limited to 'kvmd/plugins/hid/otg/device.py')
-rw-r--r-- | kvmd/plugins/hid/otg/device.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kvmd/plugins/hid/otg/device.py b/kvmd/plugins/hid/otg/device.py index 95795f1e..2902df47 100644 --- a/kvmd/plugins/hid/otg/device.py +++ b/kvmd/plugins/hid/otg/device.py @@ -35,8 +35,8 @@ from ....logging import get_logger from .... import tools from .... import aiomulti from .... import aioproc +from .... import usb -from .usb import UsbDeviceController from .events import BaseEvent @@ -49,7 +49,7 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in initial_state: Dict, notifier: aiomulti.AioProcessNotifier, - udc: UsbDeviceController, + udc: usb.UsbDeviceController, device_path: str, select_timeout: float, @@ -89,6 +89,12 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in try: event = self.__events_queue.get(timeout=self.__queue_timeout) except queue.Empty: + # Проблема в том, что устройство может отвечать EAGAIN или ESHUTDOWN, + # если оно было отключено физически. См: + # - https://github.com/raspberrypi/linux/issues/3870 + # - https://github.com/raspberrypi/linux/pull/3151 + # Так что нам нужно проверять состояние контроллера, чтобы не спамить + # в устройство и отслеживать его состояние. if not self.__udc.can_operate(): self.__state_flags.update(online=False) else: |