summaryrefslogtreecommitdiff
path: root/kvmd
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2021-09-24 09:33:15 +0300
committerMaxim Devaev <[email protected]>2021-09-24 09:33:15 +0300
commit977c8a1ade70969b0bb588ac119105e6b4f29394 (patch)
tree921a0da0fdf13fe6b258e57077abaf02bee34d17 /kvmd
parent27f04a0967db92bdf985bfa7e280e5042dd47d0d (diff)
refactoring
Diffstat (limited to 'kvmd')
-rw-r--r--kvmd/apps/__init__.py36
-rw-r--r--kvmd/plugins/auth/pam.py2
-rw-r--r--kvmd/plugins/hid/_mcu/__init__.py10
-rw-r--r--kvmd/plugins/hid/bt/__init__.py18
-rw-r--r--kvmd/plugins/hid/otg/__init__.py12
-rw-r--r--kvmd/plugins/msd/relay/__init__.py4
-rw-r--r--kvmd/plugins/ugpio/hidrelay.py2
-rw-r--r--kvmd/plugins/ugpio/wol.py2
8 files changed, 43 insertions, 43 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py
index b3497682..b516d98d 100644
--- a/kvmd/apps/__init__.py
+++ b/kvmd/apps/__init__.py
@@ -352,7 +352,7 @@ def _get_config_scheme() -> Dict:
"enabled": Option(True, type=valid_bool),
"internal": {
- "type": Option("htpasswd"),
+ "type": Option("htpasswd"),
"force_users": Option([], type=valid_users_list),
# Dynamic content
},
@@ -375,7 +375,7 @@ def _get_config_scheme() -> Dict:
"hid": {
"type": Option("", type=valid_stripped_string_not_empty),
- "keymap": Option("/usr/share/kvmd/keymaps/en-us", type=valid_abs_file),
+ "keymap": Option("/usr/share/kvmd/keymaps/en-us", type=valid_abs_file),
"ignore_keys": Option([], type=functools.partial(valid_string_list, subval=valid_hid_key)),
"mouse_x_range": {
@@ -474,13 +474,13 @@ def _get_config_scheme() -> Dict:
},
"otg": {
- "vendor_id": Option(0x1D6B, type=valid_otg_id), # Linux Foundation
- "product_id": Option(0x0104, type=valid_otg_id), # Multifunction Composite Gadget
- "manufacturer": Option("PiKVM"),
- "product": Option("Composite KVM Device"),
- "serial": Option("CAFEBABE"),
+ "vendor_id": Option(0x1D6B, type=valid_otg_id), # Linux Foundation
+ "product_id": Option(0x0104, type=valid_otg_id), # Multifunction Composite Gadget
+ "manufacturer": Option("PiKVM"),
+ "product": Option("Composite KVM Device"),
+ "serial": Option("CAFEBABE"),
"usb_version": Option(0x0200, type=valid_otg_id),
- "remote_wakeup": Option(False, type=valid_bool),
+ "remote_wakeup": Option(False, type=valid_bool),
"gadget": Option("kvmd", type=valid_otg_gadget),
"config": Option("PiKVM device", type=valid_stripped_string_not_empty),
@@ -507,8 +507,8 @@ def _get_config_scheme() -> Dict:
"ethernet": {
"enabled": Option(False, type=valid_bool),
"driver": Option("ecm", type=valid_otg_ethernet),
- "host_mac": Option("", type=valid_mac, if_empty=""),
- "kvm_mac": Option("", type=valid_mac, if_empty=""),
+ "host_mac": Option("", type=valid_mac, if_empty=""),
+ "kvm_mac": Option("", type=valid_mac, if_empty=""),
},
"drives": {
@@ -528,14 +528,14 @@ def _get_config_scheme() -> Dict:
"otgnet": {
"iface": {
"net": Option("169.254.0.0/28", type=functools.partial(valid_net, v6=False)),
- "ip_cmd": Option(["/usr/bin/ip"], type=valid_command),
+ "ip_cmd": Option(["/usr/bin/ip"], type=valid_command),
},
"firewall": {
- "allow_icmp": Option(True, type=valid_bool),
- "allow_tcp": Option([], type=valid_ports_list),
- "allow_udp": Option([67], type=valid_ports_list),
- "forward_iface": Option("", type=valid_stripped_string),
+ "allow_icmp": Option(True, type=valid_bool),
+ "allow_tcp": Option([], type=valid_ports_list),
+ "allow_udp": Option([67], type=valid_ports_list),
+ "forward_iface": Option("", type=valid_stripped_string),
"iptables_cmd": Option(["/usr/sbin/iptables", "--wait=5"], type=valid_command),
},
@@ -614,9 +614,9 @@ def _get_config_scheme() -> Dict:
"no_delay": Option(True, type=valid_bool),
"keepalive": {
"enabled": Option(True, type=valid_bool, unpack_as="keepalive_enabled"),
- "idle": Option(10, type=functools.partial(valid_number, min=1, max=3600), unpack_as="keepalive_idle"),
- "interval": Option(3, type=functools.partial(valid_number, min=1, max=60), unpack_as="keepalive_interval"),
- "count": Option(3, type=functools.partial(valid_number, min=1, max=10), unpack_as="keepalive_count"),
+ "idle": Option(10, type=functools.partial(valid_number, min=1, max=3600), unpack_as="keepalive_idle"),
+ "interval": Option(3, type=functools.partial(valid_number, min=1, max=60), unpack_as="keepalive_interval"),
+ "count": Option(3, type=functools.partial(valid_number, min=1, max=10), unpack_as="keepalive_count"),
},
"tls": {
diff --git a/kvmd/plugins/auth/pam.py b/kvmd/plugins/auth/pam.py
index 62ee12f1..16ff4f4a 100644
--- a/kvmd/plugins/auth/pam.py
+++ b/kvmd/plugins/auth/pam.py
@@ -63,7 +63,7 @@ class Plugin(BaseAuthService):
"service": Option("login"),
"allow_users": Option([], type=valid_users_list),
"deny_users": Option([], type=valid_users_list),
- "allow_uids_at": Option(0, type=valid_int_f0),
+ "allow_uids_at": Option(0, type=valid_int_f0),
}
async def authorize(self, user: str, passwd: str) -> bool:
diff --git a/kvmd/plugins/hid/_mcu/__init__.py b/kvmd/plugins/hid/_mcu/__init__.py
index 2eb61072..72c01925 100644
--- a/kvmd/plugins/hid/_mcu/__init__.py
+++ b/kvmd/plugins/hid/_mcu/__init__.py
@@ -151,11 +151,11 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many-
"reset_inverted": Option(False, type=valid_bool),
"reset_delay": Option(0.1, type=valid_float_f01),
- "read_retries": Option(5, type=valid_int_f1),
- "common_retries": Option(5, type=valid_int_f1),
- "retries_delay": Option(0.5, type=valid_float_f01),
- "errors_threshold": Option(5, type=valid_int_f0),
- "noop": Option(False, type=valid_bool),
+ "read_retries": Option(5, type=valid_int_f1),
+ "common_retries": Option(5, type=valid_int_f1),
+ "retries_delay": Option(0.5, type=valid_float_f01),
+ "errors_threshold": Option(5, type=valid_int_f0),
+ "noop": Option(False, type=valid_bool),
}
def sysprep(self) -> None:
diff --git a/kvmd/plugins/hid/bt/__init__.py b/kvmd/plugins/hid/bt/__init__.py
index e2ef51e4..5606a132 100644
--- a/kvmd/plugins/hid/bt/__init__.py
+++ b/kvmd/plugins/hid/bt/__init__.py
@@ -110,17 +110,17 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
"product": Option("HID Device"),
"description": Option("Bluetooth Keyboard & Mouse"),
- "iface": Option("hci0", type=valid_stripped_string_not_empty),
- "alias": Option("PiKVM HID"),
+ "iface": Option("hci0", type=valid_stripped_string_not_empty),
+ "alias": Option("PiKVM HID"),
- "pairing_required": Option(True, type=valid_bool),
- "auth_required": Option(False, type=valid_bool),
- "control_public": Option(True, type=valid_bool),
- "unpair_on_close": Option(True, type=valid_bool),
+ "pairing_required": Option(True, type=valid_bool),
+ "auth_required": Option(False, type=valid_bool),
+ "control_public": Option(True, type=valid_bool),
+ "unpair_on_close": Option(True, type=valid_bool),
- "max_clients": Option(1, type=valid_int_f1),
- "socket_timeout": Option(5.0, type=valid_float_f01),
- "select_timeout": Option(1.0, type=valid_float_f01),
+ "max_clients": Option(1, type=valid_int_f1),
+ "socket_timeout": Option(5.0, type=valid_float_f01),
+ "select_timeout": Option(1.0, type=valid_float_f01),
}
def sysprep(self) -> None:
diff --git a/kvmd/plugins/hid/otg/__init__.py b/kvmd/plugins/hid/otg/__init__.py
index 5d88fe40..2df354f9 100644
--- a/kvmd/plugins/hid/otg/__init__.py
+++ b/kvmd/plugins/hid/otg/__init__.py
@@ -94,13 +94,13 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
"write_retries": Option(150, type=valid_int_f1),
},
"mouse": {
- "device": Option("", type=valid_abs_path, unpack_as="device_path"),
- "select_timeout": Option(0.1, type=valid_float_f01),
- "queue_timeout": Option(0.1, type=valid_float_f01),
- "write_retries": Option(150, type=valid_int_f1),
- "absolute": Option(True, type=valid_bool),
+ "device": Option("", type=valid_abs_path, unpack_as="device_path"),
+ "select_timeout": Option(0.1, type=valid_float_f01),
+ "queue_timeout": Option(0.1, type=valid_float_f01),
+ "write_retries": Option(150, type=valid_int_f1),
+ "absolute": Option(True, type=valid_bool),
"absolute_win98_fix": Option(False, type=valid_bool),
- "horizontal_wheel": Option(True, type=valid_bool),
+ "horizontal_wheel": Option(True, type=valid_bool),
},
"mouse_alt": {
"device": Option("", type=valid_abs_path, if_empty="", unpack_as="device_path"),
diff --git a/kvmd/plugins/msd/relay/__init__.py b/kvmd/plugins/msd/relay/__init__.py
index 6455ea66..0e431e46 100644
--- a/kvmd/plugins/msd/relay/__init__.py
+++ b/kvmd/plugins/msd/relay/__init__.py
@@ -99,8 +99,8 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
"sync_chunk_size": Option(4194304, type=functools.partial(valid_number, min=1024)),
"gpio_device": Option("/dev/gpiochip0", type=valid_abs_path, unpack_as="gpio_device_path"),
- "target_pin": Option(-1, type=valid_gpio_pin),
- "reset_pin": Option(-1, type=valid_gpio_pin),
+ "target_pin": Option(-1, type=valid_gpio_pin),
+ "reset_pin": Option(-1, type=valid_gpio_pin),
"reset_inverted": Option(False, type=valid_bool),
"device": Option("", type=valid_abs_path, unpack_as="device_path"),
diff --git a/kvmd/plugins/ugpio/hidrelay.py b/kvmd/plugins/ugpio/hidrelay.py
index 1aeddb23..55a05e6d 100644
--- a/kvmd/plugins/ugpio/hidrelay.py
+++ b/kvmd/plugins/ugpio/hidrelay.py
@@ -75,7 +75,7 @@ class Plugin(BaseUserGpioDriver):
@classmethod
def get_plugin_options(cls) -> Dict:
return {
- "device": Option("", type=valid_abs_path, unpack_as="device_path"),
+ "device": Option("", type=valid_abs_path, unpack_as="device_path"),
"state_poll": Option(5.0, type=valid_float_f01),
}
diff --git a/kvmd/plugins/ugpio/wol.py b/kvmd/plugins/ugpio/wol.py
index 02e95cca..190e329b 100644
--- a/kvmd/plugins/ugpio/wol.py
+++ b/kvmd/plugins/ugpio/wol.py
@@ -64,7 +64,7 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute
def get_plugin_options(cls) -> Dict:
return {
"ip": Option("255.255.255.255", type=functools.partial(valid_ip, v6=False)),
- "port": Option(9, type=valid_port),
+ "port": Option(9, type=valid_port),
"mac": Option("", type=valid_mac, if_empty=""),
}