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 <felix@dogcraft.de>
pull/894/head
Felix Dörre 2024-07-06 20:46:51 +00:00 zatwierdzone przez Damien George
rodzic 7f5ac83865
commit a7cd740b64
2 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -1,2 +1,2 @@
metadata(version="0.1.1") metadata(version="0.2.0")
package("usb") package("usb")

Wyświetl plik

@ -110,6 +110,7 @@ class _Device:
device_protocol=0, device_protocol=0,
config_str=None, config_str=None,
max_power_ma=None, max_power_ma=None,
remote_wakeup=False,
): ):
# Configure the USB device with a set of interfaces, and optionally reconfiguring the # Configure the USB device with a set of interfaces, and optionally reconfiguring the
# device and configuration descriptor fields # device and configuration descriptor fields
@ -199,7 +200,7 @@ class _Device:
bmAttributes = ( bmAttributes = (
(1 << 7) # Reserved (1 << 7) # Reserved
| (0 if max_power_ma else (1 << 6)) # Self-Powered | (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 # Configuration string is optional but supported