summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2025-01-05 02:34:11 +0200
committerMaxim Devaev <[email protected]>2025-01-05 02:34:11 +0200
commit5973b9e77353c3a5d57a69253b4f8926a8405413 (patch)
treecf28cc501bffbf0a8733f5e2f8f6b330c7aeefae
parente120b50f50504e050d4c1ae904d9676142e4cf11 (diff)
kvmd-otgconf: Ignore some errors
-rw-r--r--kvmd/apps/otgconf/__init__.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/kvmd/apps/otgconf/__init__.py b/kvmd/apps/otgconf/__init__.py
index 4ad9c2ea..ac5d54f5 100644
--- a/kvmd/apps/otgconf/__init__.py
+++ b/kvmd/apps/otgconf/__init__.py
@@ -103,12 +103,18 @@ class _GadgetControl:
def enable_functions(self, funcs: list[str]) -> None:
with self.__udc_stopped():
for func in funcs:
- os.symlink(self.__get_fsrc_path(func), self.__get_fdest_path(func))
+ try:
+ os.symlink(self.__get_fsrc_path(func), self.__get_fdest_path(func))
+ except FileExistsError:
+ pass
def disable_functions(self, funcs: list[str]) -> None:
with self.__udc_stopped():
for func in funcs:
- os.unlink(self.__get_fdest_path(func))
+ try:
+ os.unlink(self.__get_fdest_path(func))
+ except FileNotFoundError:
+ pass
def list_functions(self) -> None:
metas = list(self.__read_metas())