From 88e2210094b84ce400c50954cb31a427ab1a4bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20D=C3=B6rre?= Date: Sat, 6 Jul 2024 20:46:51 +0000 Subject: [PATCH] usb-device: Allow signaling capability of remote_wakeup. To use this feature you need to create a usb device signaling remote wakeup and then enable remote wakeup on the host (on linux write enabled to /sys/bus/usb/devices//power/wakeup). Then you can wake up the host when is on standby using USBDevice.remote_wakeup. --- micropython/usb/usb-device/manifest.py | 2 +- micropython/usb/usb-device/usb/device/core.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/micropython/usb/usb-device/manifest.py b/micropython/usb/usb-device/manifest.py index 0dfab932f..27c9aa88a 100644 --- a/micropython/usb/usb-device/manifest.py +++ b/micropython/usb/usb-device/manifest.py @@ -1,2 +1,2 @@ -metadata(version="0.1.0") +metadata(version="0.1.1") package("usb") diff --git a/micropython/usb/usb-device/usb/device/core.py b/micropython/usb/usb-device/usb/device/core.py index 08277b1f4..cee3ade21 100644 --- a/micropython/usb/usb-device/usb/device/core.py +++ b/micropython/usb/usb-device/usb/device/core.py @@ -100,6 +100,7 @@ def config( # noqa: PLR0913 device_protocol=0, config_str=None, max_power_ma=None, + remote_wakeup=False, ): # Configure the USB device with a set of interfaces, and optionally reconfiguring the # device and configuration descriptor fields @@ -189,7 +190,7 @@ def maybe_set(value, idx): bmAttributes = ( (1 << 7) # Reserved | (0 if max_power_ma else (1 << 6)) # Self-Powered - # Remote Wakeup not currently supported + | ((1 << 5) if remote_wakeup else 0) ) # Configuration string is optional but supported