mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
removed UsbDeviceController() class
This commit is contained in:
19
kvmd/usb.py
19
kvmd/usb.py
@@ -22,8 +22,6 @@
|
||||
|
||||
import os
|
||||
|
||||
from .logging import get_logger
|
||||
|
||||
from . import env
|
||||
|
||||
|
||||
@@ -38,20 +36,3 @@ def find_udc(udc: str) -> str:
|
||||
elif udc not in candidates:
|
||||
raise RuntimeError(f"Can't find selected UDC: {udc}")
|
||||
return udc # fe980000.usb
|
||||
|
||||
|
||||
class UsbDeviceController:
|
||||
def __init__(self, udc: str) -> None:
|
||||
self.__udc = udc
|
||||
self.__state_path = ""
|
||||
|
||||
def find(self) -> None:
|
||||
udc = find_udc(self.__udc)
|
||||
self.__state_path = os.path.join(f"{env.SYSFS_PREFIX}/sys/class/udc", udc, "state")
|
||||
get_logger().info("Using UDC %s", udc)
|
||||
|
||||
def can_operate(self) -> bool:
|
||||
assert self.__state_path
|
||||
with open(self.__state_path, "r") as state_file:
|
||||
# https://www.maxlinear.com/Files/Documents/an213_033111.pdf
|
||||
return (state_file.read().strip().lower() == "configured")
|
||||
|
||||
Reference in New Issue
Block a user