diff options
author | Maxim Devaev <[email protected]> | 2022-03-31 14:38:00 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-03-31 14:38:00 +0300 |
commit | 984ae4fa376c84915fcf468d901bf35418ec7ef9 (patch) | |
tree | f8578ce2f23102080a2fe29d3975c10dcea1e0fb | |
parent | 5d1788cb444f81a2083cb87596148c4b4099a167 (diff) |
disable only if enabled
-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: |