• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2025 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.cts.input
18 
19 /**
20  * Constants for evdev input events used by UinputDevice
21  * Referring to the defined header in the "linux/input.h".
22  */
23 class EvdevInputEventCodes {
24 
25     companion object {
26         /**
27          * Event types
28          */
29         const val EV_SYN = 0x00
30         const val EV_KEY = 0x01
31         const val EV_REL = 0x02
32         const val EV_ABS = 0x03
33         const val EV_MSC = 0x04
34 
35         /**
36          * Synchronization events.
37          */
38         const val SYN_REPORT = 0
39 
40         /**
41          * Keys and buttons
42          */
43         const val KEY_ESC = 1
44         const val KEY_1 = 2
45         const val KEY_2 = 3
46         const val KEY_BACKSPACE = 14
47         const val KEY_Q = 16
48         const val KEY_A = 30
49         const val KEY_LEFTSHIFT = 42
50         const val KEY_LEFTALT = 56
51         const val KEY_CAPSLOCK = 58
52         const val KEY_LEFT = 105
53         const val KEY_LEFTMETA = 125
54 
55         const val BTN_LEFT = 0x110
56         const val BTN_SOUTH = 0x130
57         const val BTN_TOUCH = 0x14a
58         const val BTN_TOOL_PEN = 0x140
59         const val BTN_TOOL_FINGER = 0x145
60         const val BTN_TOOL_MOUSE = 0x146
61         const val BTN_TOOL_QUINTTAP = 0x148 // Five fingers on trackpad
62         const val BTN_STYLUS3 = 0x149
63         const val BTN_STYLUS = 0x14b
64         const val BTN_STYLUS2 = 0x14c
65         const val BTN_TOOL_DOUBLETAP = 0x14d
66         const val BTN_TOOL_TRIPLETAP = 0x14e
67         const val BTN_TOOL_QUADTAP = 0x14f // Four fingers on trackpad
68 
69         /**
70          * Relative axes
71          */
72         const val REL_X = 0x00
73         const val REL_Y = 0x01
74 
75         /**
76          * Absolute axes
77          */
78         const val ABS_X = 0x00
79         const val ABS_Y = 0x01
80         const val ABS_Z = 0x02
81         const val ABS_RX = 0x03
82         const val ABS_RY = 0x04
83         const val ABS_RZ = 0x05
84         const val ABS_MT_SLOT = 0x2f
85         const val ABS_MT_POSITION_X = 0x35
86         const val ABS_MT_POSITION_Y = 0x36
87         const val ABS_MT_TOOL_TYPE = 0x37
88         const val ABS_MT_TRACKING_ID = 0x39
89         const val ABS_MT_PRESSURE = 0x3a
90 
91         /**
92          * Misc events
93          */
94         const val MSC_TIMESTAMP = 0x05
95 
96         /**
97          * MT_TOOL types
98          */
99         const val MT_TOOL_FINGER = 0
100         const val MT_TOOL_PEN = 1
101         const val MT_TOOL_PALM = 2
102 
103         /**
104          * Not directly a linux input evdev constants, but part of the contract to define
105          * a particular value, e.g. press/release, invalid value.
106          */
107         const val EV_KEY_RELEASE = 0x00
108         const val EV_KEY_PRESS = 0x01
109         const val INVALID_MT_TRACKING_ID = -1
110     }
111 }
112