1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192

ash / system / diagnostics / mojom / input.mojom [blame]

// 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.
//
// NextMinVersion: 2
[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,
  [MinVersion=1] kAccessibility,
  [MinVersion=1] kDictation,
};

[Stable, Extensible]
enum TopRightKey {
  // This is required for backwards compatibility, should not be used.
  [Default] kUnmappedEnumField,
  kUnknown,
  kPower,
  kLock,
  kControlPanel,
};

[Stable, Extensible]
enum BottomLeftLayout {
  [Default] kUnknown,
  // The bottom left is consist of ctrl, fn and alt.
  kBottomLeft3Keys,
  // The bottom left is consist of ctrl, fn, search and alt.
  kBottomLeft4Keys,
};

[Stable, Extensible]
enum BottomRightLayout {
  [Default] kUnknown,
  // The bottom right is consist of alt and ctrl.
  kBottomRight2Keys,
  // The bottom right is consist of alt, fn and ctrl.
  kBottomRight3Keys,
  // The bottom right is consist of alt, fn, globe and ctrl.
  kBottomRight4Keys,
};

[Stable, Extensible]
enum NumpadLayout {
  [Default] kUnknown,
  // The numpad has 3 columns in total.
  kNumpad3Column,
  // The numpad has 4 columns in total.
  kNumpad4Column,
};

// Describes a connected keyboard.
//
// NextMinVersion: 2
[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;
  // Specify the layout of the bottom left keys (fn, etc.) Only required for
  // split modifier keyboards.
  [MinVersion=1]
  BottomLeftLayout bottom_left_layout@10;
  // Specify the layout of the bottom right keys (fn, etc.) Only required for
  // split modifier keyboards.
  [MinVersion=1]
  BottomRightLayout bottom_right_layout@11;
  [MinVersion=1]
  // Specify the layout of the numpad. Only required for split modifier
  // keyboards that has a numpad.
  NumpadLayout numpad_layout@12;
};

// 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;
};