8000 How to enable keyboard to wake sleeping computer? · Issue #5380 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

How to enable keyboard to wake sleeping computer? #5380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LostVector opened this issue Sep 21, 2021 · 8 comments · Fixed by #8830
Closed

How to enable keyboard to wake sleeping computer? #5380

LostVector opened this issue Sep 21, 2021 · 8 comments · Fixed by #8830
Assignees
Milestone

Comments

@LostVector
Copy link

Hi,

I'm trying to figure out how to make an emulated USB keyboard (using a neokey 1x4) wake the computer it's attached to. I've verified the QT PY RP2040 is getting power and behaves normally when the computer is on, but it seems to go haywire when the pc is asleep and i press a key (windows 10).

Is this possible to support somehow with the current libraries?

@dhalbert dhalbert transferred this issue from adafruit/Adafruit_CircuitPython_HID Sep 22, 2021
@dhalbert
Copy link
Collaborator

Transferring to https://github.com/adafruit/circuitpython, as this is a core issue.

@dhalbert
Copy link
Collaborator

@hathach What would we need to do to make USB wake work? I assume we are not doing USB at all when we detect that the host has gone away (disconnect or suspend, I guess, I'm not sure which). Thanks.

@jpconstantineau
Copy link

Just a pointer to what perhaps does it... It's arduino code example on Tinyusb: https://github.com/adafruit/Adafruit_TinyUSB_Arduino/blob/master/examples/HID/hid_composite/hid_composite.ino#L87

@hathach to confirm if that's the API to implement for the wake up.

@hathach
Copy link
Member
hathach commented Sep 22, 2021

@dhalbert tud_remote_wakeup() is API to do this, however there is a few requirements, all is implemented by hid example for your reference https://github.com/hathach/tinyusb/tree/master/examples/device/hid_composite

  1. TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP bit must be set in the configuration descriptor https://github.com/hathach/tinyusb/blob/master/examples/device/hid_composite/src/usb_descriptors.c#L111
  2. MCU DCD port remote wakeup and suspend detection must be implemented, which is true for all/most of the port used by circuitpython thanks to recent effort to get them passed USBCV
  3. Depending on host OS, before suspending it will send control request to allow device to perform remote wakeup. In my experience, Windows will always allow HID device to perform remote wakeup, but Linux is a bit trickier. Linux may need explicitly enable, can check which device support remote wakeup with
  grep . /sys/bus/usb/devices/*/product
  grep . /sys/bus/usb/devices/*/power/wakeup

@dhalbert dhalbert added the usb label Sep 22, 2021
@dhalbert dhalbert added this to the Long term milestone Sep 22, 2021
@dhalbert dhalbert modified the milestones: Long term, 7.x.x Jan 19, 2022
@dhalbert
Copy link
Collaborator

Bumped priority to do https://forums.adafruit.com/viewtopic.php?f=60&t=187399 and perhaps some other requests I have forgotten.

@dhalbert
Copy link
Collaborator
  1. Check descriptor power settings and remote wake
  2. Before sending a report, see if we need to wake.

@maxammann
Copy link

Super interesting to discover the lower level USB stuff. I have a Fomu FPGA running CircuitPython. I was able to wake up my screen, but not yet wakeup my device from sleep and I guess it is just not yet implemented.

Is this task just about sending a wakeup message before sending a key press or is it more involved to implement this?

@dhalbert
Copy link
Collaborator

Is this task just about sending a wakeup message before sending a key press or is it more involved to implement this?

I think we just need to do what is described in #5380 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
0