Commit d2624bb9 authored by Mathew King's avatar Mathew King Committed by Commit Bot

Chrome OS: Add key code for privacy screen toggle

Some upcoming Chromebooks will have an electronic privacy screen which
can be toggled on or off via a hotkey. When this key is pressed linux
will emit a KEY_PRIVACY_SCREEN_TOGGLE keycode 0x279. There is not
currently a USB HID usage for privacy screen control but there is a
request in progress and is expected to be in the 0x300 range of the
consumer page. We use the next available device DomKey 0x60C and the
next unused VKEY 0x9B.

BUG=b:146006851, b:138397511, 952051

Change-Id: Ia519c6227ca1acf3f352ef1d757b0ef3925dca05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1979232
Commit-Queue: Mathew King <mathewk@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Reviewed-by: default avatarGil Dekel <gildekel@chromium.org>
Reviewed-by: default avatarKevin Schoedel <kpschoedel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733021}
parent dabad3c2
...@@ -103,6 +103,12 @@ DOM_CODE_DECLARATION { ...@@ -103,6 +103,12 @@ DOM_CODE_DECLARATION {
DOM_CODE(0x000014, 0x0000, 0x0000, 0x0000, 0xffff, "Suspend", SUSPEND), DOM_CODE(0x000014, 0x0000, 0x0000, 0x0000, 0xffff, "Suspend", SUSPEND),
DOM_CODE(0x000015, 0x0000, 0x0000, 0x0000, 0xffff, "Resume", RESUME), DOM_CODE(0x000015, 0x0000, 0x0000, 0x0000, 0xffff, "Resume", RESUME),
DOM_CODE(0x000016, 0x0000, 0x0000, 0x0000, 0xffff, "Turbo", TURBO), DOM_CODE(0x000016, 0x0000, 0x0000, 0x0000, 0xffff, "Turbo", TURBO),
// TODO(b/146683484): HID usage for privacy screen control is not yet
// approved. Once it is update the code here.
// TODO(https://crbug.com/952051): Privacy screen will not have a DOM |code|
// name defined as it is not exposed to web content.
DOM_CODE(0x000017, 0x0279, 0x0281, 0x0000, 0xffff, "PrivacyScreenToggle",
PRIVACY_SCREEN_TOGGLE), // Privacy Screen Toggle
// ========================================= // =========================================
// USB Usage Page 0x01: Generic Desktop Page // USB Usage Page 0x01: Generic Desktop Page
......
...@@ -24,8 +24,8 @@ namespace { ...@@ -24,8 +24,8 @@ namespace {
// These are in the same order as the columns in dom_code_data.inc // These are in the same order as the columns in dom_code_data.inc
// as reflected in the DOM_CODE() macro below. // as reflected in the DOM_CODE() macro below.
const size_t expected_mapped_key_count[] = { const size_t expected_mapped_key_count[] = {
212, // evdev 213, // evdev
212, // xkb 213, // xkb
157, // windows 157, // windows
118, // mac 118, // mac
}; };
......
...@@ -417,6 +417,10 @@ const struct DomCodeToKeyboardCodeEntry { ...@@ -417,6 +417,10 @@ const struct DomCodeToKeyboardCodeEntry {
// DomCode::SUSPEND 0x000014 Suspend // DomCode::SUSPEND 0x000014 Suspend
// DomCode::RESUME 0x000015 Resume // DomCode::RESUME 0x000015 Resume
// DomCode::TURBO 0x000016 Turbo // DomCode::TURBO 0x000016 Turbo
#if defined(OS_POSIX)
{DomCode::PRIVACY_SCREEN_TOGGLE,
VKEY_PRIVACY_SCREEN_TOGGLE}, // 0x000017 PrivacyScreenToggle
#endif
{DomCode::SLEEP, VKEY_SLEEP}, // 0x010082 Sleep {DomCode::SLEEP, VKEY_SLEEP}, // 0x010082 Sleep
// DomCode::WAKE_UP 0x010083 WakeUp // DomCode::WAKE_UP 0x010083 WakeUp
{DomCode::US_A, VKEY_A}, // 0x070004 KeyA {DomCode::US_A, VKEY_A}, // 0x070004 KeyA
......
...@@ -220,6 +220,7 @@ enum KeyboardCode { ...@@ -220,6 +220,7 @@ enum KeyboardCode {
VKEY_POWER = 0x98, VKEY_POWER = 0x98,
VKEY_ASSISTANT = 0x99, VKEY_ASSISTANT = 0x99,
VKEY_SETTINGS = 0x9A, VKEY_SETTINGS = 0x9A,
VKEY_PRIVACY_SCREEN_TOGGLE = 0x9B,
VKEY_BRIGHTNESS_DOWN = 0xD8, VKEY_BRIGHTNESS_DOWN = 0xD8,
VKEY_BRIGHTNESS_UP = 0xD9, VKEY_BRIGHTNESS_UP = 0xD9,
VKEY_KBD_BRIGHTNESS_DOWN = 0xDA, VKEY_KBD_BRIGHTNESS_DOWN = 0xDA,
......
...@@ -819,6 +819,7 @@ TEST_F(XkbLayoutEngineVkTest, KeyboardCodeForNonPrintable) { ...@@ -819,6 +819,7 @@ TEST_F(XkbLayoutEngineVkTest, KeyboardCodeForNonPrintable) {
// known to XKB. // known to XKB.
{{DomCode::LAUNCH_ASSISTANT, EF_NONE}, VKEY_ASSISTANT}, {{DomCode::LAUNCH_ASSISTANT, EF_NONE}, VKEY_ASSISTANT},
{{DomCode::LAUNCH_CONTROL_PANEL, EF_NONE}, VKEY_SETTINGS}, {{DomCode::LAUNCH_CONTROL_PANEL, EF_NONE}, VKEY_SETTINGS},
{{DomCode::PRIVACY_SCREEN_TOGGLE, EF_NONE}, VKEY_PRIVACY_SCREEN_TOGGLE},
// Verify that number pad digits produce located VKEY codes. // Verify that number pad digits produce located VKEY codes.
{{DomCode::NUMPAD0, EF_NONE, XKB_KEY_KP_0, '0'}, VKEY_NUMPAD0}, {{DomCode::NUMPAD0, EF_NONE, XKB_KEY_KP_0, '0'}, VKEY_NUMPAD0},
{{DomCode::NUMPAD9, EF_NONE, XKB_KEY_KP_9, '9'}, VKEY_NUMPAD9}, {{DomCode::NUMPAD9, EF_NONE, XKB_KEY_KP_9, '9'}, VKEY_NUMPAD9},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment