mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 18:11:54 +08:00
get rid of otgbind's cleanup and fixed hid for this
This commit is contained in:
@@ -228,13 +228,17 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in
|
|||||||
logger = get_logger()
|
logger = get_logger()
|
||||||
|
|
||||||
if self.__fd < 0:
|
if self.__fd < 0:
|
||||||
try:
|
if os.path.exists(self.__device_path):
|
||||||
flags = os.O_NONBLOCK
|
try:
|
||||||
flags |= (os.O_RDWR if self.__read_size else os.O_WRONLY)
|
flags = os.O_NONBLOCK
|
||||||
self.__fd = os.open(self.__device_path, flags)
|
flags |= (os.O_RDWR if self.__read_size else os.O_WRONLY)
|
||||||
except Exception as err:
|
self.__fd = os.open(self.__device_path, flags)
|
||||||
logger.error("Can't open HID-%s device %s: %s",
|
except Exception as err:
|
||||||
self.__name, self.__device_path, tools.efmt(err))
|
logger.error("Can't open HID-%s device %s: %s",
|
||||||
|
self.__name, self.__device_path, tools.efmt(err))
|
||||||
|
time.sleep(1)
|
||||||
|
else:
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
if self.__fd >= 0:
|
if self.__fd >= 0:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -92,10 +92,6 @@ class Plugin(BaseUserGpioDriver):
|
|||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Unexpected OTG-bind watcher error")
|
logger.exception("Unexpected OTG-bind watcher error")
|
||||||
|
|
||||||
async def cleanup(self) -> None:
|
|
||||||
with open(self.__ctl_path) as ctl_file:
|
|
||||||
ctl_file.write(self.__udc)
|
|
||||||
|
|
||||||
async def read(self, pin: str) -> bool:
|
async def read(self, pin: str) -> bool:
|
||||||
_ = pin
|
_ = pin
|
||||||
with open(self.__ctl_path) as ctl_file:
|
with open(self.__ctl_path) as ctl_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user