mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 17:20:30 +08:00
refactoring
This commit is contained in:
parent
096064cfbc
commit
c124e63d6d
@ -258,17 +258,17 @@ def _get_config_scheme() -> Dict:
|
|||||||
"serial": Option("CAFEBABE"),
|
"serial": Option("CAFEBABE"),
|
||||||
|
|
||||||
"gadget": Option("kvmd", type=valid_otg_gadget),
|
"gadget": Option("kvmd", type=valid_otg_gadget),
|
||||||
"udc": Option("", type=(lambda arg: str(arg).strip())),
|
"udc": Option("", type=(lambda arg: str(arg).strip())),
|
||||||
"init_delay": Option(3.0, type=valid_float_f01),
|
"init_delay": Option(3.0, type=valid_float_f01),
|
||||||
|
|
||||||
"msd": {
|
"msd": {
|
||||||
"user": Option("kvmd", type=valid_user),
|
"user": Option("kvmd", type=valid_user),
|
||||||
"default": {
|
"default": {
|
||||||
"stall": Option(False, type=valid_bool),
|
"stall": Option(False, type=valid_bool),
|
||||||
"cdrom": Option(True, type=valid_bool),
|
"cdrom": Option(True, type=valid_bool),
|
||||||
"rw": Option(False, type=valid_bool),
|
"rw": Option(False, type=valid_bool),
|
||||||
"removable": Option(True, type=valid_bool),
|
"removable": Option(True, type=valid_bool),
|
||||||
"fua": Option(True, type=valid_bool),
|
"fua": Option(True, type=valid_bool),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -278,13 +278,13 @@ def _get_config_scheme() -> Dict:
|
|||||||
|
|
||||||
"drives": {
|
"drives": {
|
||||||
"enabled": Option(False, type=valid_bool),
|
"enabled": Option(False, type=valid_bool),
|
||||||
"count": Option(1, type=(lambda arg: valid_number(arg, min=1))),
|
"count": Option(1, type=(lambda arg: valid_number(arg, min=1))),
|
||||||
"default": {
|
"default": {
|
||||||
"stall": Option(False, type=valid_bool),
|
"stall": Option(False, type=valid_bool),
|
||||||
"cdrom": Option(False, type=valid_bool),
|
"cdrom": Option(False, type=valid_bool),
|
||||||
"rw": Option(True, type=valid_bool),
|
"rw": Option(True, type=valid_bool),
|
||||||
"removable": Option(True, type=valid_bool),
|
"removable": Option(True, type=valid_bool),
|
||||||
"fua": Option(True, type=valid_bool),
|
"fua": Option(True, type=valid_bool),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -80,13 +80,13 @@ class Plugin(BaseAtx): # pylint: disable=too-many-instance-attributes
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_plugin_options(cls) -> Dict:
|
def get_plugin_options(cls) -> Dict:
|
||||||
return {
|
return {
|
||||||
"power_led_pin": Option(-1, type=valid_gpio_pin),
|
"power_led_pin": Option(-1, type=valid_gpio_pin),
|
||||||
"hdd_led_pin": Option(-1, type=valid_gpio_pin),
|
"hdd_led_pin": Option(-1, type=valid_gpio_pin),
|
||||||
"power_led_inverted": Option(True, type=valid_bool),
|
"power_led_inverted": Option(True, type=valid_bool),
|
||||||
"hdd_led_inverted": Option(True, type=valid_bool),
|
"hdd_led_inverted": Option(True, type=valid_bool),
|
||||||
|
|
||||||
"power_switch_pin": Option(-1, type=valid_gpio_pin),
|
"power_switch_pin": Option(-1, type=valid_gpio_pin),
|
||||||
"reset_switch_pin": Option(-1, type=valid_gpio_pin),
|
"reset_switch_pin": Option(-1, type=valid_gpio_pin),
|
||||||
"click_delay": Option(0.1, type=valid_float_f01),
|
"click_delay": Option(0.1, type=valid_float_f01),
|
||||||
"long_click_delay": Option(5.5, type=valid_float_f01),
|
"long_click_delay": Option(5.5, type=valid_float_f01),
|
||||||
|
|
||||||
|
|||||||
@ -74,8 +74,8 @@ class Plugin(BaseHid):
|
|||||||
"write_retries_delay": Option(0.1, type=valid_float_f01),
|
"write_retries_delay": Option(0.1, type=valid_float_f01),
|
||||||
},
|
},
|
||||||
|
|
||||||
"noop": Option(False, type=valid_bool),
|
"noop": Option(False, type=valid_bool),
|
||||||
"state_poll": Option(0.1, type=valid_float_f01),
|
"state_poll": Option(0.1, type=valid_float_f01),
|
||||||
}
|
}
|
||||||
|
|
||||||
def start(self) -> None:
|
def start(self) -> None:
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class Plugin(BaseMsd):
|
|||||||
return {
|
return {
|
||||||
"storage": Option("/var/lib/kvmd/msd", type=valid_abs_dir, unpack_as="storage_path"),
|
"storage": Option("/var/lib/kvmd/msd", type=valid_abs_dir, unpack_as="storage_path"),
|
||||||
"remount_cmd": Option([*sudo, "/usr/bin/kvmd-helper-otgmsd-remount", "{mode}"], type=valid_command),
|
"remount_cmd": Option([*sudo, "/usr/bin/kvmd-helper-otgmsd-remount", "{mode}"], type=valid_command),
|
||||||
"unlock_cmd": Option([*sudo, "/usr/bin/kvmd-helper-otgmsd-unlock", "unlock"], type=valid_command),
|
"unlock_cmd": Option([*sudo, "/usr/bin/kvmd-helper-otgmsd-unlock", "unlock"], type=valid_command),
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_state(self) -> Dict:
|
def get_state(self) -> Dict:
|
||||||
|
|||||||
@ -203,10 +203,10 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
"target_pin": Option(-1, type=valid_gpio_pin),
|
"target_pin": Option(-1, type=valid_gpio_pin),
|
||||||
"reset_pin": Option(-1, type=valid_gpio_pin),
|
"reset_pin": Option(-1, type=valid_gpio_pin),
|
||||||
|
|
||||||
"device": Option("", type=valid_abs_path, unpack_as="device_path"),
|
"device": Option("", type=valid_abs_path, unpack_as="device_path"),
|
||||||
"init_delay": Option(1.0, type=valid_float_f01),
|
"init_delay": Option(1.0, type=valid_float_f01),
|
||||||
"init_retries": Option(5, type=valid_int_f1),
|
"init_retries": Option(5, type=valid_int_f1),
|
||||||
"reset_delay": Option(1.0, type=valid_float_f01),
|
"reset_delay": Option(1.0, type=valid_float_f01),
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_state(self) -> Dict:
|
def get_state(self) -> Dict:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user