option to enable remote wakeup

This commit is contained in:
Maxim Devaev 2021-08-20 21:12:44 +03:00
parent 902841e8df
commit 1e7aac27b2
2 changed files with 5 additions and 3 deletions

View File

@ -478,6 +478,7 @@ def _get_config_scheme() -> Dict:
"manufacturer": Option("Pi-KVM"), "manufacturer": Option("Pi-KVM"),
"product": Option("Composite KVM Device"), "product": Option("Composite KVM Device"),
"serial": Option("CAFEBABE"), "serial": Option("CAFEBABE"),
"remote_wakeup": Option(False, type=valid_bool),
"gadget": Option("kvmd", type=valid_otg_gadget), "gadget": Option("kvmd", type=valid_otg_gadget),
"config": Option("Pi-KVM device", type=valid_stripped_string_not_empty), "config": Option("Pi-KVM device", type=valid_stripped_string_not_empty),

View File

@ -166,7 +166,7 @@ def _create_msd(
_symlink(func_path, join(config_path, f"mass_storage.usb{instance}")) _symlink(func_path, join(config_path, f"mass_storage.usb{instance}"))
def _cmd_start(config: Section) -> None: def _cmd_start(config: Section) -> None: # pylint: disable=too-many-statements
# https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt # https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt
# https://www.isticktoit.net/?p=1383 # https://www.isticktoit.net/?p=1383
@ -196,8 +196,9 @@ def _cmd_start(config: Section) -> None:
_mkdir(join(config_path, "strings/0x409")) _mkdir(join(config_path, "strings/0x409"))
_write(join(config_path, "strings/0x409/configuration"), f"Config 1: {config.otg.config}") _write(join(config_path, "strings/0x409/configuration"), f"Config 1: {config.otg.config}")
_write(join(config_path, "MaxPower"), "250") _write(join(config_path, "MaxPower"), "250")
# TODO: Add this and MaxPower=100 to enable Remote Wakeup on Bus Powered if config.otg.remote_wakeup:
# _write(join(config_path, "bmAttributes"), "0xA0") # XXX: Should we use MaxPower=100 with Remote Wakeup?
_write(join(config_path, "bmAttributes"), "0xA0")
if config.otg.devices.serial.enabled: if config.otg.devices.serial.enabled:
logger.info("===== Required Serial =====") logger.info("===== Required Serial =====")