Waking up on key release

Daniel Drake dsd at laptop.org
Thu Sep 22 13:00:54 EDT 2011


Hi,

Right now, the EC code has coded behaviour (or a bug) to not wake up
the system on key release events.

This means that its possible to suspend the system by typing the
following at a root terminal:

  echo mem > /sys/power/state

Pressing enter will suspend the system, and frequently the system will
suspend before enter has been released by the user (or at least it
will disable IRQ handlers before the corresponding 'key released'
interrupt has arrived). Yes, we suspend pretty quick.

You can then leave the system 10 minutes, and press the power button
to turn on again. The system will *then* receive the 'key released'
interrupt (it should - theres a bug that means this doesnt always
happen).

We're thinking of changing this so that the EC wakes up the system on
all activity, key press or key release. This seems more
consistent/truthful (key release is an event the system will want to
know about), and in the current scheme, you might run the above
command and immediately press and release enter to suspend the system,
but userspace might come up 10 minutes later with the incorrect
impression that enter has been held down for 10 minutes. It should
also make the EC's life easier.

One visible change will be that running the following will no longer
be a reliable way of suspending:
  echo mem > /sys/power/state
because the system might suspend before the  'enter released'
condition is raised, meaning that it would suspend and immediately
resume due to being woken up by the key release event. The following
would avoid that:
  sleep 1; echo mem > /sys/power/state

Can anyone think of any other side effects or see any holes in this idea?

Daniel



More information about the Devel mailing list