vboot/ui: implement to_dev transition flow

Introduce three new action hooks:

- vb2_screen_info.init
  Init function runs once when changing to the screen.

- vb2_screen_info.action
  Action function runs repeatedly while on the screen.

- vb2_menu_item:
  Action function takes precedence over target screen if non-NULL.

Create the VB2_SCREEN_RECOVERY_TO_DEV screen, and add a
keyboard shortcut to get to that screen directly when in
manual recovery mode: Ctrl+D.

The TO_DEV screen repeatedly checks for the correct physical
verification state.  When that state is triggered, it switches
to dev mode and reboots.  The trigger depends on physical
presence type:

- PHYSICAL_PRESENCE_KEYBOARD: wait for ENTER key on the
  confirm button, pressed by internal keyboard

- !PHYSICAL_PRESENCE_KEYBOARD: wait for the physical presence
  button (recovery or power) to be pressed and released

- SPACE character also cancels in order to preserve prior
  behaviour

Note that currently there is no way to exit developer mode
once it has been enabled.

BUG=b:146399181
TEST=make clean && make runtests
BRANCH=none

Change-Id: If3ff248d98859d530c3a24524618c6282a5ac5b5
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2168072
Reviewed-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
6 files changed