diff options
-rw-r--r-- | kvmd/apps/otgconf/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmd/apps/otgconf/__init__.py b/kvmd/apps/otgconf/__init__.py index 97d822fa..5e765a99 100644 --- a/kvmd/apps/otgconf/__init__.py +++ b/kvmd/apps/otgconf/__init__.py @@ -52,8 +52,9 @@ def _udc_stopped(gadget: str, udc: str) -> Generator[None, None, None]: udc_path = os.path.join(f"{env.SYSFS_PREFIX}/sys/kernel/config/usb_gadget", gadget, "UDC") with open(udc_path) as udc_file: enabled = bool(udc_file.read().strip()) - with open(udc_path, "w") as udc_file: - udc_file.write("\n") + if enabled: + with open(udc_path, "w") as udc_file: + udc_file.write("\n") try: yield finally: |