mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
Compatibility with old vanilla kernels (#88)
This commit is contained in:
parent
628d25cb87
commit
d722c3fff7
@ -78,8 +78,11 @@ def _unlink(path: str, optional: bool=False) -> None:
|
||||
os.unlink(path)
|
||||
|
||||
|
||||
def _write(path: str, value: Union[str, int]) -> None:
|
||||
def _write(path: str, value: Union[str, int], optional: bool=False) -> None:
|
||||
get_logger().info("WRITE --- %s", path)
|
||||
if optional and not os.access(path, os.F_OK):
|
||||
get_logger().info("SKIP ---- %s", path)
|
||||
return
|
||||
with open(path, "w") as param_file:
|
||||
param_file.write(str(value))
|
||||
|
||||
@ -158,9 +161,9 @@ class _GadgetConfig:
|
||||
func = f"hid.usb{self.__hid_instance}"
|
||||
func_path = join(self.__gadget_path, "functions", func)
|
||||
_mkdir(func_path)
|
||||
_write(join(func_path, "no_out_endpoint"), "1")
|
||||
_write(join(func_path, "no_out_endpoint"), "1", optional=True)
|
||||
if remote_wakeup:
|
||||
_write(join(func_path, "wakeup_on_write"), "1")
|
||||
_write(join(func_path, "wakeup_on_write"), "1", optional=True)
|
||||
_write(join(func_path, "protocol"), hid.protocol)
|
||||
_write(join(func_path, "subclass"), hid.subclass)
|
||||
_write(join(func_path, "report_length"), hid.report_length)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user