mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
disable only if enabled
This commit is contained in:
@@ -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")
|
udc_path = os.path.join(f"{env.SYSFS_PREFIX}/sys/kernel/config/usb_gadget", gadget, "UDC")
|
||||||
with open(udc_path) as udc_file:
|
with open(udc_path) as udc_file:
|
||||||
enabled = bool(udc_file.read().strip())
|
enabled = bool(udc_file.read().strip())
|
||||||
with open(udc_path, "w") as udc_file:
|
if enabled:
|
||||||
udc_file.write("\n")
|
with open(udc_path, "w") as udc_file:
|
||||||
|
udc_file.write("\n")
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user