Skip to content

Commit 6b37987

Browse files
committed
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/<device>/power/wakeup). Then you can wake up the host when is on standby using USBDevice.remote_wakeup. Signed-off-by: Felix Dörre <[email protected]>
1 parent fbf7e12 commit 6b37987

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: micropython/usb/usb-device/manifest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
metadata(version="0.1.0")
1+
metadata(version="0.1.1")
22
package("usb")

Diff for: micropython/usb/usb-device/usb/device/core.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def config( # noqa: PLR0913
100100
device_protocol=0,
101101
config_str=None,
102102
max_power_ma=None,
103+
remote_wakeup=False,
103104
):
104105
# Configure the USB device with a set of interfaces, and optionally reconfiguring the
105106
# device and configuration descriptor fields
@@ -189,7 +190,7 @@ def maybe_set(value, idx):
189190
bmAttributes = (
190191
(1 << 7) # Reserved
191192
| (0 if max_power_ma else (1 << 6)) # Self-Powered
192-
# Remote Wakeup not currently supported
193+
| ((1 << 5) if remote_wakeup else 0)
193194
)
194195

195196
# Configuration string is optional but supported

0 commit comments

Comments
 (0)