Skip to content

Commit 4b25a23

Browse files
committed
[dm][input] support input
For: #6251 1. Add power event. 2. Port to touch. 3. Add uapi for unix app. Signed-off-by: GuEe-GUI <[email protected]>
1 parent 2fb53c8 commit 4b25a23

File tree

17 files changed

+1912
-0
lines changed

17 files changed

+1912
-0
lines changed

components/drivers/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ rsource "graphic/Kconfig"
2222
rsource "hwcrypto/Kconfig"
2323
rsource "wlan/Kconfig"
2424
rsource "led/Kconfig"
25+
rsource "input/Kconfig"
2526
rsource "mailbox/Kconfig"
2627
rsource "phye/Kconfig"
2728
rsource "ata/Kconfig"
Lines changed: 360 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,360 @@
1+
/*
2+
* Copyright (c) 2006-2022, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __DT_BINDINGS_INPUT_EVENT_CODES_H__
8+
#define __DT_BINDINGS_INPUT_EVENT_CODES_H__
9+
10+
/*
11+
* Event types
12+
*/
13+
14+
#define EV_SYN 0
15+
#define EV_KEY 1
16+
#define EV_REL 2
17+
#define EV_ABS 3
18+
#define EV_MSC 4
19+
#define EV_SW 5
20+
#define EV_LED 17
21+
#define EV_SND 18
22+
#define EV_REP 20
23+
#define EV_FF 21
24+
#define EV_PWR 22
25+
#define EV_FF_STATUS 23
26+
#define EV_MAX 31
27+
#define EV_CNT (EV_MAX + 1)
28+
29+
/*
30+
* Synchronization events.
31+
*/
32+
33+
#define SYN_REPORT 0
34+
#define SYN_CONFIG 1
35+
#define SYN_MT_REPORT 2
36+
#define SYN_DROPPED 3
37+
#define SYN_MAX 15
38+
#define SYN_CNT (SYN_MAX + 1)
39+
40+
/*
41+
* Keys and buttons
42+
*/
43+
44+
#define KEY_RESERVED 0 /* Reserved, do not use */
45+
#define KEY_ESC 1 /* Escape Key */
46+
#define KEY_1 2 /* 1 Key */
47+
#define KEY_2 3 /* 2 Key */
48+
#define KEY_3 4 /* 3 Key */
49+
#define KEY_4 5 /* 4 Key */
50+
#define KEY_5 6 /* 5 Key */
51+
#define KEY_6 7 /* 6 Key */
52+
#define KEY_7 8 /* 7 Key */
53+
#define KEY_8 9 /* 8 Key */
54+
#define KEY_9 10 /* 9 Key */
55+
#define KEY_0 11 /* 0 Key */
56+
#define KEY_MINUS 12 /* Minus Key */
57+
#define KEY_EQUAL 13 /* Equal Key */
58+
#define KEY_BACKSPACE 14 /* Backspace Key */
59+
#define KEY_TAB 15 /* Tab Key*/
60+
#define KEY_Q 16 /* Q Key */
61+
#define KEY_W 17 /* W Key */
62+
#define KEY_E 18 /* E Key */
63+
#define KEY_R 19 /* R Key */
64+
#define KEY_T 20 /* T Key */
65+
#define KEY_Y 21 /* Y Key */
66+
#define KEY_U 22 /* U Key */
67+
#define KEY_I 23 /* I Key */
68+
#define KEY_O 24 /* O Key */
69+
#define KEY_P 25 /* P Key */
70+
#define KEY_LEFTBRACE 26 /* Left Brace Key */
71+
#define KEY_RIGHTBRACE 27 /* Right Brace Key */
72+
#define KEY_ENTER 28 /* Enter Key */
73+
#define KEY_LEFTCTRL 29 /* Left Ctrl Key */
74+
#define KEY_A 30 /* A Key */
75+
#define KEY_S 31 /* S Key */
76+
#define KEY_D 32 /* D Key */
77+
#define KEY_F 33 /* F Key */
78+
#define KEY_G 34 /* G Key */
79+
#define KEY_H 35 /* H Key */
80+
#define KEY_J 36 /* J Key */
81+
#define KEY_K 37 /* K Key */
82+
#define KEY_L 38 /* L Key */
83+
#define KEY_SEMICOLON 39 /* Semicolon Key */
84+
#define KEY_APOSTROPHE 40 /* Apostrophe Key */
85+
#define KEY_GRAVE 41 /* Grave (backtick) Key */
86+
#define KEY_LEFTSHIFT 42 /* Left Shift Key */
87+
#define KEY_BACKSLASH 43 /* Backslash Key */
88+
#define KEY_Z 44 /* Z Key */
89+
#define KEY_X 45 /* X Key */
90+
#define KEY_C 46 /* C Key */
91+
#define KEY_V 47 /* V Key */
92+
#define KEY_B 48 /* B Key */
93+
#define KEY_N 49 /* N Key */
94+
#define KEY_M 50 /* M Key */
95+
#define KEY_COMMA 51 /* Comma Key */
96+
#define KEY_DOT 52 /* Dot Key */
97+
#define KEY_SLASH 53 /* Slash Key */
98+
#define KEY_RIGHTSHIFT 54 /* Right Shift Key */
99+
#define KEY_KPASTERISK 55 /* Keypad Asterisk Key */
100+
#define KEY_LEFTALT 56 /* Left Alt Key */
101+
#define KEY_SPACE 57 /* Space Key */
102+
#define KEY_CAPSLOCK 58 /* Caps Lock Key */
103+
#define KEY_F1 59 /* F1 Key */
104+
#define KEY_F2 60 /* F2 Key */
105+
#define KEY_F3 61 /* F3 Key */
106+
#define KEY_F4 62 /* F4 Key */
107+
#define KEY_F5 63 /* F5 Key */
108+
#define KEY_F6 64 /* F6 Key */
109+
#define KEY_F7 65 /* F7 Key */
110+
#define KEY_F8 66 /* F8 Key */
111+
#define KEY_F9 67 /* F9 Key */
112+
#define KEY_F10 68 /* F10 Key */
113+
#define KEY_NUMLOCK 69 /* Num Lock Key */
114+
#define KEY_SCROLLLOCK 70 /* Scroll Lock Key */
115+
#define KEY_KP7 71 /* Keypad 7 Key */
116+
#define KEY_KP8 72 /* Keypad 8 Key */
117+
#define KEY_KP9 73 /* Keypad 9 Key */
118+
#define KEY_KPMINUS 74 /* Keypad Minus Key */
119+
#define KEY_KP4 75 /* Keypad 4 Key */
120+
#define KEY_KP5 76 /* Keypad 5 Key */
121+
#define KEY_KP6 77 /* Keypad 6 Key */
122+
#define KEY_KPPLUS 78 /* Keypad Plus Key */
123+
#define KEY_KP1 79 /* Keypad 1 Key */
124+
#define KEY_KP2 80 /* Keypad 2 Key */
125+
#define KEY_KP3 81 /* Keypad 3 Key */
126+
#define KEY_KP0 82 /* Keypad 0 Key */
127+
#define KEY_KPDOT 83 /* Keypad Dot Key */
128+
#define KEY_F11 87 /* F11 Key */
129+
#define KEY_F12 88 /* F12 Key */
130+
#define KEY_KPENTER 96 /* Keypad Enter Key */
131+
#define KEY_RIGHTCTRL 97 /* Right Ctrl Key */
132+
#define KEY_KPSLASH 98 /* Keypad Slash Key */
133+
#define KEY_SYSRQ 99 /* SysReq Key */
134+
#define KEY_RIGHTALT 100 /* Right Alt Key */
135+
#define KEY_HOME 102 /* Home Key */
136+
#define KEY_UP 103 /* Up Key */
137+
#define KEY_PAGEUP 104 /* Page UpKey */
138+
#define KEY_LEFT 105 /* Left Key */
139+
#define KEY_RIGHT 106 /* Right Key */
140+
#define KEY_END 107 /* End Key */
141+
#define KEY_DOWN 108 /* Down Key */
142+
#define KEY_PAGEDOWN 109 /* Page Down Key */
143+
#define KEY_INSERT 110 /* Insert Key */
144+
#define KEY_DELETE 111 /* Delete Key */
145+
#define KEY_MUTE 113 /* Mute Key */
146+
#define KEY_VOLUMEDOWN 114 /* Volume Down Key */
147+
#define KEY_VOLUMEUP 115 /* Volume Up Key */
148+
#define KEY_POWER 116 /* Power Key */
149+
#define KEY_KPEQUAL 117 /* Keypad Equal Key */
150+
#define KEY_KPPLUSMINUS 118 /* Keypad Plus Key */
151+
#define KEY_PAUSE 119 /* Pause Key */
152+
#define KEY_SCALE 120 /* Scale Key */
153+
#define KEY_KPCOMMA 121 /* Keypad Comma Key */
154+
#define KEY_LEFTMETA 125 /* Left Meta Key */
155+
#define KEY_RIGHTMETA 126 /* Right Meta Key */
156+
#define KEY_COMPOSE 127 /* Compose Key */
157+
#define KEY_STOP 128 /* AC Stop */
158+
#define KEY_MENU 139 /* Menu Key */
159+
#define KEY_SETUP 141
160+
#define KEY_SLEEP 142 /* System Sleep Key */
161+
#define KEY_WAKEUP 143 /* System Wake Up Key */
162+
#define KEY_COFFEE 152 /* Screen Saver Key */
163+
#define KEY_BACK 158 /* Back Key */
164+
#define KEY_FORWARD 159 /* Forward Key */
165+
#define KEY_PLAYPAUSE 164
166+
#define KEY_RECORD 167
167+
#define KEY_REWIND 168
168+
#define KEY_EXIT 174 /* AC Exit */
169+
#define KEY_F13 183 /* F13 Key */
170+
#define KEY_F14 184 /* F14 Key */
171+
#define KEY_F15 185 /* F15 Key */
172+
#define KEY_F16 186 /* F16 Key */
173+
#define KEY_F17 187 /* F17 Key */
174+
#define KEY_F18 188 /* F18 Key */
175+
#define KEY_F19 189 /* F19 Key */
176+
#define KEY_F20 190 /* F20 Key */
177+
#define KEY_F21 191 /* F21 Key */
178+
#define KEY_F22 192 /* F22 Key */
179+
#define KEY_F23 193 /* F23 Key */
180+
#define KEY_F24 194 /* F24 Key */
181+
#define KEY_PLAY 207 /* Play Key */
182+
#define KEY_FASTFORWARD 208 /* Fast Forward Key */
183+
#define KEY_PRINT 210 /* Print Key */
184+
#define KEY_CONNECT 218 /* Connect Key */
185+
#define KEY_CANCEL 223 /* AC Cancel */
186+
#define KEY_BRIGHTNESSDOWN 224 /* Brightness Down Key */
187+
#define KEY_BRIGHTNESSUP 225 /* Brightneess Up Key */
188+
#define KEY_MEDIA 226 /* Media toggle */
189+
#define KEY_BLUETOOTH 237 /* Bluetooth Key */
190+
#define KEY_WLAN 238 /* Wireless LAN Key */
191+
#define KEY_UWB 239 /* Ultra-Wideband Key */
192+
#define KEY_SELECT 353
193+
#define KEY_CLEAR 355
194+
#define KEY_INFO 358 /* AL OEM Features/Tips/Tutorial */
195+
#define KEY_PROGRAM 362 /* Media Select Program Guide */
196+
#define KEY_CALENDAR 397
197+
#define KEY_RED 398
198+
#define KEY_GREEN 399
199+
#define KEY_YELLOW 400
200+
#define KEY_BLUE 401
201+
#define KEY_CHANNELUP 402 /* Channel Increment */
202+
#define KEY_CHANNELDOWN 403 /* Channel Decrement */
203+
#define KEY_RESTART 408 /* Restart Key */
204+
205+
#define BTN_MISC 256
206+
#define BTN_0 256
207+
#define BTN_1 257
208+
#define BTN_2 258
209+
#define BTN_3 259
210+
#define BTN_4 260
211+
#define BTN_5 261
212+
#define BTN_6 262
213+
#define BTN_7 263
214+
#define BTN_8 264
215+
#define BTN_9 265
216+
217+
#define BTN_MOUSE 272
218+
#define BTN_LEFT 272
219+
#define BTN_RIGHT 273
220+
#define BTN_MIDDLE 274
221+
#define BTN_SIDE 275
222+
#define BTN_EXTRA 276
223+
#define BTN_FORWARD 277
224+
#define BTN_BACK 278
225+
#define BTN_TASK 279
226+
227+
#define BTN_JOYSTICK 288
228+
#define BTN_TRIGGER 288
229+
#define BTN_THUMB 289
230+
#define BTN_THUMB2 290
231+
#define BTN_TOP 291
232+
#define BTN_TOP2 292
233+
#define BTN_PINKIE 293
234+
#define BTN_BASE 294
235+
#define BTN_BASE2 295
236+
#define BTN_BASE3 296
237+
#define BTN_BASE4 297
238+
#define BTN_BASE5 298
239+
#define BTN_BASE6 299
240+
#define BTN_DEAD 303
241+
242+
#define BTN_GAMEPAD 304
243+
#define BTN_SOUTH 304
244+
#define BTN_A BTN_SOUTH
245+
#define BTN_EAST 305
246+
#define BTN_B BTN_EAST
247+
#define BTN_C 306
248+
#define BTN_NORTH 307
249+
#define BTN_X BTN_NORTH
250+
#define BTN_WEST 308
251+
#define BTN_Y BTN_WEST
252+
#define BTN_Z 309
253+
#define BTN_TL 310
254+
#define BTN_TR 311
255+
#define BTN_TL2 312
256+
#define BTN_TR2 313
257+
#define BTN_SELECT 314
258+
#define BTN_START 315
259+
#define BTN_MODE 316
260+
#define BTN_THUMBL 317
261+
#define BTN_THUMBR 318
262+
263+
#define BTN_DIGI 320
264+
#define BTN_TOOL_PEN 320
265+
#define BTN_TOOL_RUBBER 321
266+
#define BTN_TOOL_BRUSH 322
267+
#define BTN_TOOL_PENCIL 323
268+
#define BTN_TOOL_AIRBRUSH 324
269+
#define BTN_TOOL_FINGER 325
270+
#define BTN_TOOL_MOUSE 326
271+
#define BTN_TOOL_LENS 327
272+
#define BTN_TOOL_QUINTTAP 328 /* Five fingers on trackpad */
273+
#define BTN_STYLUS3 329
274+
#define BTN_TOUCH 330
275+
#define BTN_STYLUS 331
276+
#define BTN_STYLUS2 332
277+
#define BTN_TOOL_DOUBLETAP 333
278+
#define BTN_TOOL_TRIPLETAP 334
279+
#define BTN_TOOL_QUADTAP 335 /* Four fingers on trackpad */
280+
281+
#define KEY_MAX 767
282+
#define KEY_CNT (KEY_MAX + 1)
283+
284+
#define BTN_TOUCH 330
285+
286+
/*
287+
* Relative axes
288+
*/
289+
290+
#define REL_X 0
291+
#define REL_Y 1
292+
#define REL_Z 2
293+
#define REL_RX 3
294+
#define REL_RY 4
295+
#define REL_RZ 5
296+
#define REL_HWHEEL 6
297+
#define REL_DIAL 7
298+
#define REL_WHEEL 8
299+
#define REL_MISC 9
300+
#define REL_RESERVED 10
301+
#define REL_WHEEL_HI_RES 11
302+
#define REL_HWHEEL_HI_RES 12
303+
#define REL_MAX 15
304+
#define REL_CNT (REL_MAX + 1)
305+
306+
/*
307+
* Absolute axes
308+
*/
309+
310+
#define ABS_X 0
311+
#define ABS_Y 1
312+
#define ABS_Z 2
313+
#define ABS_RX 3
314+
#define ABS_RY 4
315+
#define ABS_RZ 5
316+
#define ABS_THROTTLE 6
317+
#define ABS_RUDDER 7
318+
#define ABS_WHEEL 8
319+
#define ABS_GAS 9
320+
#define ABS_BRAKE 10
321+
#define ABS_HAT0X 16
322+
#define ABS_HAT0Y 17
323+
#define ABS_HAT1X 18
324+
#define ABS_HAT1Y 19
325+
#define ABS_HAT2X 20
326+
#define ABS_HAT2Y 21
327+
#define ABS_HAT3X 22
328+
#define ABS_HAT3Y 23
329+
#define ABS_PRESSURE 24
330+
#define ABS_DISTANCE 25
331+
#define ABS_TILT_X 26
332+
#define ABS_TILT_Y 27
333+
#define ABS_TOOL_WIDTH 28
334+
335+
#define ABS_VOLUME 32
336+
#define ABS_PROFILE 33
337+
338+
#define ABS_MISC 40
339+
#define ABS_RESERVED 46
340+
341+
#define ABS_MT_SLOT 47 /* MT slot being modified */
342+
#define ABS_MT_TOUCH_MAJOR 48 /* Major axis of touching ellipse */
343+
#define ABS_MT_TOUCH_MINOR 49 /* Minor axis (omit if circular) */
344+
#define ABS_MT_WIDTH_MAJOR 50 /* Major axis of approaching ellipse */
345+
#define ABS_MT_WIDTH_MINOR 51 /* Minor axis (omit if circular) */
346+
#define ABS_MT_ORIENTATION 52 /* Ellipse orientation */
347+
#define ABS_MT_POSITION_X 53 /* Center X touch position */
348+
#define ABS_MT_POSITION_Y 54 /* Center Y touch position */
349+
#define ABS_MT_TOOL_TYPE 55 /* Type of touching device */
350+
#define ABS_MT_BLOB_ID 56 /* Group a set of packets as a blob */
351+
#define ABS_MT_TRACKING_ID 57 /* Unique ID of initiated contact */
352+
#define ABS_MT_PRESSURE 58 /* Pressure on contact area */
353+
#define ABS_MT_DISTANCE 59 /* Contact hover distance */
354+
#define ABS_MT_TOOL_X 60 /* Center X tool position */
355+
#define ABS_MT_TOOL_Y 61 /* Center Y tool position */
356+
357+
#define ABS_MAX 63
358+
#define ABS_CNT (ABS_MAX + 1)
359+
360+
#endif /* __DT_BINDINGS_INPUT_EVENT_CODES_H__ */

components/drivers/include/rtdevice.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ extern "C" {
5353

5454
#ifdef RT_USING_LED
5555
#include "drivers/led.h"
56+
#endif /* RT_USING_LED */
57+
58+
#ifdef RT_USING_INPUT
59+
#include "drivers/input.h"
60+
#ifdef RT_INPUT_UAPI
61+
#include "drivers/input_uapi.h"
5662
#endif
63+
#endif /* RT_USING_INPUT */
5764

5865
#ifdef RT_USING_MBOX
5966
#include "drivers/mailbox.h"

0 commit comments

Comments
 (0)