// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// NOTE: This mojom should be kept in sync with the copy in ChromiumOS's repo in
// src/platform2/diagnostics/mojom/external/input.mojom.
module ash.diagnostics.mojom;
[Stable, Extensible]
enum ConnectionType {
// This is required for backwards compatibility, should not be used.
[Default] kUnmappedEnumField,
// Includes devices connected over USB that are on fully internal busses, as
// well as the keyboards/touchpads for detachables.
kInternal,
kUsb,
kBluetooth,
// An unknown device is most likely to be internal.
kUnknown,
};
[Stable, Extensible]
enum PhysicalLayout {
// This is required for backwards compatibility, should not be used.
[Default] kUnmappedEnumField,
kUnknown,
// A typical Chrome OS keyboard with action keys on the top row, reduced
// navigation keys, etc.
kChromeOS,
// The slightly-modified Chrome OS keyboard found on the early Dell Enterprise
// Chromebooks (Arcada and Sarien). Has Fn and keyboard layout switch keys
// between the left Ctrl and Alt, and Page Up and Down keys in the gaps around
// the arrow keys.
kChromeOSDellEnterpriseWilco,
// The layout found on later Dell Enterprise Chromebooks (Drallion) and Dell
// ChromeOS keyboards like the KM713 Chrome Keyboard. Like the Wilco layout
// except it doesn't have the Page Up and Down keys around the arrow keys.
kChromeOSDellEnterpriseDrallion,
};
// The international standard that the layout follows.
[Stable, Extensible]
enum MechanicalLayout {
// This is required for backwards compatibility, should not be used.
[Default] kUnmappedEnumField,
kUnknown,
kAnsi,
kIso,
kJis,
};
[Stable, Extensible]
enum NumberPadPresence {
// This is required for backwards compatibility, should not be used.
[Default] kUnmappedEnumField,
// Unknown indicates there is no reliable evidence whether a numberpad is
// present. This is common for external keyboards.
kUnknown,
kPresent,
kNotPresent,
};
// Note that this enumeration will need to be extended if new keys are added.
[Stable, Extensible]
enum TopRowKey {
// This is required for backwards compatibility, should not be used.
[Default] kUnmappedEnumField,
// Either no key at all, or no special action key at this position.
kNone,
// Marker for keys which cannot be decoded, but have some action.
kUnknown,
kBack,
kForward,
kRefresh,
kFullscreen,
kOverview,
kScreenshot,
kScreenBrightnessDown,
kScreenBrightnessUp,
kPrivacyScreenToggle,
kMicrophoneMute,
kVolumeMute,
kVolumeDown,
kVolumeUp,
kKeyboardBacklightToggle,
kKeyboardBacklightDown,
kKeyboardBacklightUp,
kNextTrack,
kPreviousTrack,
kPlayPause,
kScreenMirror,
kDelete,
};
[Stable, Extensible]
enum TopRightKey {
// This is required for backwards compatibility, should not be used.
[Default] kUnmappedEnumField,
kUnknown,
kPower,
kLock,
kControlPanel,
};
// Describes a connected keyboard.
[Stable]
struct KeyboardInfo {
// The number of the keyboard's /dev/input/event* node.
uint32 id@0;
ConnectionType connection_type@1;
string name@2;
PhysicalLayout physical_layout@3;
MechanicalLayout mechanical_layout@4;
// For internal keyboards, the region code of the device (from which the
// visual layout can be determined).
string? region_code@5;
NumberPadPresence number_pad_present@6;
// List of ChromeOS specific action keys in the top row. This list excludes
// the left-most Escape key, and right-most key (usually Power/Lock).
// If a keyboard has F11-F15 keys beyond the rightmost action key, they may
// not be included in this list (even as kNone).
array<TopRowKey> top_row_keys@7;
// For CrOS keyboards, the glyph shown on the key at the far right end of the
// top row. This data may not be completely reliable.
TopRightKey top_right_key@8;
// Only applicable to CrOS keyboards.
bool has_assistant_key@9;
};
// Keyboard diagnostics event info. It is fired when users completed a keyboard
// diagnostic in the Diagnostics App.
[Stable]
struct KeyboardDiagnosticEventInfo {
// The keyboard which has been tested.
KeyboardInfo keyboard_info@0;
// Keys which have been tested. It is an array of the evdev key code.
array<uint32> tested_keys@1;
// Top row keys which have been tested. They are positions of the key on the
// top row after escape (0 is leftmost, 1 is next to the right, etc.).
// Generally, 0 is F1, in some fashion.
// NOTE: This position may exceed the length of keyboard_info->top_row_keys,
// for external keyboards with keys in the F11-F15 range.
array<uint32> tested_top_row_keys@2;
};