Skip to content

Commit a7cd740

Browse files
felixdoerredpgeorge
authored andcommitted
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 7f5ac83 commit a7cd740

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.1")
1+
metadata(version="0.2.0")
22
package("usb")

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def config( # noqa: PLR0913
110110
device_protocol=0,
111111
config_str=None,
112112
max_power_ma=None,
113+
remote_wakeup=False,
113114
):
114115
# Configure the USB device with a set of interfaces, and optionally reconfiguring the
115116
# device and configuration descriptor fields
@@ -199,7 +200,7 @@ def maybe_set(value, idx):
199200
bmAttributes = (
200201
(1 << 7) # Reserved
201202
| (0 if max_power_ma else (1 << 6)) # Self-Powered
202-
# Remote Wakeup not currently supported
203+
| ((1 << 5) if remote_wakeup else 0)
203204
)
204205

205206
# Configuration string is optional but supported

0 commit comments

Comments
 (0)