summaryrefslogtreecommitdiff
path: root/kvmd/apps/otgconf
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-03-07 23:54:05 +0200
committerMaxim Devaev <[email protected]>2023-03-07 23:54:05 +0200
commitf652eca9c213dd783cf2ffd02109b2353ccb86c1 (patch)
tree3c2a5c68e0b03536ec5c482b9b5be708795e8292 /kvmd/apps/otgconf
parent002031baf15d328dad764a620e1c83c01e7a55a6 (diff)
refactoring
Diffstat (limited to 'kvmd/apps/otgconf')
-rw-r--r--kvmd/apps/otgconf/__init__.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/kvmd/apps/otgconf/__init__.py b/kvmd/apps/otgconf/__init__.py
index 1a1e0f99..f6aa99ef 100644
--- a/kvmd/apps/otgconf/__init__.py
+++ b/kvmd/apps/otgconf/__init__.py
@@ -49,22 +49,22 @@ class _GadgetControl:
def __udc_stopped(self) -> Generator[None, None, None]:
udc = usb.find_udc(self.__udc)
udc_path = usb.get_gadget_path(self.__gadget, usb.G_UDC)
- with open(udc_path) as udc_file:
- enabled = bool(udc_file.read().strip())
+ with open(udc_path) as file:
+ enabled = bool(file.read().strip())
if enabled:
- with open(udc_path, "w") as udc_file:
- udc_file.write("\n")
+ with open(udc_path, "w") as file:
+ file.write("\n")
try:
yield
finally:
time.sleep(self.__init_delay)
- with open(udc_path, "w") as udc_file:
- udc_file.write(udc)
+ with open(udc_path, "w") as file:
+ file.write(udc)
def __read_metas(self) -> Generator[dict, None, None]:
for meta_name in sorted(os.listdir(self.__meta_path)):
- with open(os.path.join(self.__meta_path, meta_name)) as meta_file:
- yield json.loads(meta_file.read())
+ with open(os.path.join(self.__meta_path, meta_name)) as file:
+ yield json.loads(file.read())
def enable_function(self, func: str) -> None:
with self.__udc_stopped():