• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2017 Red Hat, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #include "config.h"
25 
26 #include "litest.h"
27 #include "litest-int.h"
28 
29 /* Recording from https://bugs.freedesktop.org/show_bug.cgi?id=102039
30  * This is the 'normal keyboard' of 2 devices exported by this keyboard.
31  */
32 
33 static struct input_id input_id = {
34 	.bustype = 0x3,
35 	.vendor = 0x1532,
36 	.product = 0x220,
37 };
38 
39 static int events[] = {
40 	EV_REL, REL_HWHEEL,
41 	EV_KEY, BTN_0,
42 	EV_KEY, KEY_ESC,
43 	EV_KEY, KEY_1,
44 	EV_KEY, KEY_2,
45 	EV_KEY, KEY_3,
46 	EV_KEY, KEY_4,
47 	EV_KEY, KEY_5,
48 	EV_KEY, KEY_6,
49 	EV_KEY, KEY_7,
50 	EV_KEY, KEY_8,
51 	EV_KEY, KEY_9,
52 	EV_KEY, KEY_0,
53 	EV_KEY, KEY_MINUS,
54 	EV_KEY, KEY_EQUAL,
55 	EV_KEY, KEY_BACKSPACE,
56 	EV_KEY, KEY_TAB,
57 	EV_KEY, KEY_Q,
58 	EV_KEY, KEY_W,
59 	EV_KEY, KEY_E,
60 	EV_KEY, KEY_R,
61 	EV_KEY, KEY_T,
62 	EV_KEY, KEY_Y,
63 	EV_KEY, KEY_U,
64 	EV_KEY, KEY_I,
65 	EV_KEY, KEY_O,
66 	EV_KEY, KEY_P,
67 	EV_KEY, KEY_LEFTBRACE,
68 	EV_KEY, KEY_RIGHTBRACE,
69 	EV_KEY, KEY_ENTER,
70 	EV_KEY, KEY_LEFTCTRL,
71 	EV_KEY, KEY_A,
72 	EV_KEY, KEY_S,
73 	EV_KEY, KEY_D,
74 	EV_KEY, KEY_F,
75 	EV_KEY, KEY_G,
76 	EV_KEY, KEY_H,
77 	EV_KEY, KEY_J,
78 	EV_KEY, KEY_K,
79 	EV_KEY, KEY_L,
80 	EV_KEY, KEY_SEMICOLON,
81 	EV_KEY, KEY_APOSTROPHE,
82 	EV_KEY, KEY_GRAVE,
83 	EV_KEY, KEY_LEFTSHIFT,
84 	EV_KEY, KEY_BACKSLASH,
85 	EV_KEY, KEY_Z,
86 	EV_KEY, KEY_X,
87 	EV_KEY, KEY_C,
88 	EV_KEY, KEY_V,
89 	EV_KEY, KEY_B,
90 	EV_KEY, KEY_N,
91 	EV_KEY, KEY_M,
92 	EV_KEY, KEY_COMMA,
93 	EV_KEY, KEY_DOT,
94 	EV_KEY, KEY_SLASH,
95 	EV_KEY, KEY_RIGHTSHIFT,
96 	EV_KEY, KEY_KPASTERISK,
97 	EV_KEY, KEY_LEFTALT,
98 	EV_KEY, KEY_SPACE,
99 	EV_KEY, KEY_CAPSLOCK,
100 	EV_KEY, KEY_F1,
101 	EV_KEY, KEY_F2,
102 	EV_KEY, KEY_F3,
103 	EV_KEY, KEY_F4,
104 	EV_KEY, KEY_F5,
105 	EV_KEY, KEY_F6,
106 	EV_KEY, KEY_F7,
107 	EV_KEY, KEY_F8,
108 	EV_KEY, KEY_F9,
109 	EV_KEY, KEY_F10,
110 	EV_KEY, KEY_NUMLOCK,
111 	EV_KEY, KEY_SCROLLLOCK,
112 	EV_KEY, KEY_KP7,
113 	EV_KEY, KEY_KP8,
114 	EV_KEY, KEY_KP9,
115 	EV_KEY, KEY_KPMINUS,
116 	EV_KEY, KEY_KP4,
117 	EV_KEY, KEY_KP5,
118 	EV_KEY, KEY_KP6,
119 	EV_KEY, KEY_KPPLUS,
120 	EV_KEY, KEY_KP1,
121 	EV_KEY, KEY_KP2,
122 	EV_KEY, KEY_KP3,
123 	EV_KEY, KEY_KP0,
124 	EV_KEY, KEY_KPDOT,
125 	EV_KEY, KEY_ZENKAKUHANKAKU,
126 	EV_KEY, KEY_102ND,
127 	EV_KEY, KEY_F11,
128 	EV_KEY, KEY_F12,
129 	EV_KEY, KEY_RO,
130 	EV_KEY, KEY_KATAKANA,
131 	EV_KEY, KEY_HIRAGANA,
132 	EV_KEY, KEY_HENKAN,
133 	EV_KEY, KEY_KATAKANAHIRAGANA,
134 	EV_KEY, KEY_MUHENKAN,
135 	EV_KEY, KEY_KPJPCOMMA,
136 	EV_KEY, KEY_KPENTER,
137 	EV_KEY, KEY_RIGHTCTRL,
138 	EV_KEY, KEY_KPSLASH,
139 	EV_KEY, KEY_SYSRQ,
140 	EV_KEY, KEY_RIGHTALT,
141 	EV_KEY, KEY_HOME,
142 	EV_KEY, KEY_UP,
143 	EV_KEY, KEY_PAGEUP,
144 	EV_KEY, KEY_LEFT,
145 	EV_KEY, KEY_RIGHT,
146 	EV_KEY, KEY_END,
147 	EV_KEY, KEY_DOWN,
148 	EV_KEY, KEY_PAGEDOWN,
149 	EV_KEY, KEY_INSERT,
150 	EV_KEY, KEY_DELETE,
151 	EV_KEY, KEY_MUTE,
152 	EV_KEY, KEY_VOLUMEDOWN,
153 	EV_KEY, KEY_VOLUMEUP,
154 	EV_KEY, KEY_POWER,
155 	EV_KEY, KEY_KPEQUAL,
156 	EV_KEY, KEY_PAUSE,
157 	EV_KEY, KEY_KPCOMMA,
158 	EV_KEY, KEY_HANGEUL,
159 	EV_KEY, KEY_HANJA,
160 	EV_KEY, KEY_YEN,
161 	EV_KEY, KEY_LEFTMETA,
162 	EV_KEY, KEY_RIGHTMETA,
163 	EV_KEY, KEY_COMPOSE,
164 	EV_KEY, KEY_STOP,
165 	EV_KEY, KEY_AGAIN,
166 	EV_KEY, KEY_PROPS,
167 	EV_KEY, KEY_UNDO,
168 	EV_KEY, KEY_FRONT,
169 	EV_KEY, KEY_COPY,
170 	EV_KEY, KEY_OPEN,
171 	EV_KEY, KEY_PASTE,
172 	EV_KEY, KEY_FIND,
173 	EV_KEY, KEY_CUT,
174 	EV_KEY, KEY_HELP,
175 	EV_KEY, KEY_MENU,
176 	EV_KEY, KEY_CALC,
177 	EV_KEY, KEY_SLEEP,
178 	EV_KEY, KEY_WAKEUP,
179 	EV_KEY, KEY_FILE,
180 	EV_KEY, KEY_WWW,
181 	EV_KEY, KEY_COFFEE,
182 	EV_KEY, KEY_MAIL,
183 	EV_KEY, KEY_BOOKMARKS,
184 	EV_KEY, KEY_BACK,
185 	EV_KEY, KEY_FORWARD,
186 	EV_KEY, KEY_EJECTCD,
187 	EV_KEY, KEY_NEXTSONG,
188 	EV_KEY, KEY_PLAYPAUSE,
189 	EV_KEY, KEY_PREVIOUSSONG,
190 	EV_KEY, KEY_STOPCD,
191 	EV_KEY, KEY_RECORD,
192 	EV_KEY, KEY_REWIND,
193 	EV_KEY, KEY_PHONE,
194 	EV_KEY, KEY_CONFIG,
195 	EV_KEY, KEY_HOMEPAGE,
196 	EV_KEY, KEY_REFRESH,
197 	EV_KEY, KEY_EXIT,
198 	EV_KEY, KEY_EDIT,
199 	EV_KEY, KEY_SCROLLUP,
200 	EV_KEY, KEY_SCROLLDOWN,
201 	EV_KEY, KEY_KPLEFTPAREN,
202 	EV_KEY, KEY_KPRIGHTPAREN,
203 	EV_KEY, KEY_NEW,
204 	EV_KEY, KEY_F13,
205 	EV_KEY, KEY_F14,
206 	EV_KEY, KEY_F15,
207 	EV_KEY, KEY_F16,
208 	EV_KEY, KEY_F17,
209 	EV_KEY, KEY_F18,
210 	EV_KEY, KEY_F19,
211 	EV_KEY, KEY_F20,
212 	EV_KEY, KEY_F21,
213 	EV_KEY, KEY_F22,
214 	EV_KEY, KEY_F23,
215 	EV_KEY, KEY_F24,
216 	EV_KEY, KEY_CLOSE,
217 	EV_KEY, KEY_PLAY,
218 	EV_KEY, KEY_FASTFORWARD,
219 	EV_KEY, KEY_BASSBOOST,
220 	EV_KEY, KEY_PRINT,
221 	EV_KEY, KEY_CAMERA,
222 	EV_KEY, KEY_CHAT,
223 	EV_KEY, KEY_SEARCH,
224 	EV_KEY, KEY_FINANCE,
225 	EV_KEY, KEY_BRIGHTNESSDOWN,
226 	EV_KEY, KEY_BRIGHTNESSUP,
227 	EV_KEY, KEY_KBDILLUMTOGGLE,
228 	EV_KEY, KEY_SAVE,
229 	EV_KEY, KEY_DOCUMENTS,
230 	EV_KEY, KEY_UNKNOWN,
231 	EV_KEY, KEY_VIDEO_NEXT,
232 	EV_KEY, KEY_BRIGHTNESS_AUTO,
233 	EV_KEY, KEY_SELECT,
234 	EV_KEY, KEY_GOTO,
235 	EV_KEY, KEY_INFO,
236 	EV_KEY, KEY_PROGRAM,
237 	EV_KEY, KEY_PVR,
238 	EV_KEY, KEY_SUBTITLE,
239 	EV_KEY, KEY_ZOOM,
240 	EV_KEY, KEY_KEYBOARD,
241 	EV_KEY, KEY_PC,
242 	EV_KEY, KEY_TV,
243 	EV_KEY, KEY_TV2,
244 	EV_KEY, KEY_VCR,
245 	EV_KEY, KEY_VCR2,
246 	EV_KEY, KEY_SAT,
247 	EV_KEY, KEY_CD,
248 	EV_KEY, KEY_TAPE,
249 	EV_KEY, KEY_TUNER,
250 	EV_KEY, KEY_PLAYER,
251 	EV_KEY, KEY_DVD,
252 	EV_KEY, KEY_AUDIO,
253 	EV_KEY, KEY_VIDEO,
254 	EV_KEY, KEY_MEMO,
255 	EV_KEY, KEY_CALENDAR,
256 	EV_KEY, KEY_RED,
257 	EV_KEY, KEY_GREEN,
258 	EV_KEY, KEY_YELLOW,
259 	EV_KEY, KEY_BLUE,
260 	EV_KEY, KEY_CHANNELUP,
261 	EV_KEY, KEY_CHANNELDOWN,
262 	EV_KEY, KEY_LAST,
263 	EV_KEY, KEY_NEXT,
264 	EV_KEY, KEY_RESTART,
265 	EV_KEY, KEY_SLOW,
266 	EV_KEY, KEY_SHUFFLE,
267 	EV_KEY, KEY_PREVIOUS,
268 	EV_KEY, KEY_VIDEOPHONE,
269 	EV_KEY, KEY_GAMES,
270 	EV_KEY, KEY_ZOOMIN,
271 	EV_KEY, KEY_ZOOMOUT,
272 	EV_KEY, KEY_ZOOMRESET,
273 	EV_KEY, KEY_WORDPROCESSOR,
274 	EV_KEY, KEY_EDITOR,
275 	EV_KEY, KEY_SPREADSHEET,
276 	EV_KEY, KEY_GRAPHICSEDITOR,
277 	EV_KEY, KEY_PRESENTATION,
278 	EV_KEY, KEY_DATABASE,
279 	EV_KEY, KEY_NEWS,
280 	EV_KEY, KEY_VOICEMAIL,
281 	EV_KEY, KEY_ADDRESSBOOK,
282 	EV_KEY, KEY_MESSENGER,
283 	EV_KEY, KEY_DISPLAYTOGGLE,
284 	EV_KEY, KEY_SPELLCHECK,
285 	EV_KEY, KEY_LOGOFF,
286 	EV_KEY, KEY_MEDIA_REPEAT,
287 	EV_KEY, KEY_IMAGES,
288 	EV_KEY, KEY_BUTTONCONFIG,
289 	EV_KEY, KEY_TASKMANAGER,
290 	EV_KEY, KEY_JOURNAL,
291 	EV_KEY, KEY_CONTROLPANEL,
292 	EV_KEY, KEY_APPSELECT,
293 	EV_KEY, KEY_SCREENSAVER,
294 	EV_KEY, KEY_VOICECOMMAND,
295 	EV_KEY, KEY_BRIGHTNESS_MIN,
296 	EV_KEY, KEY_BRIGHTNESS_MAX,
297 	EV_MSC, MSC_SCAN,
298 	-1 , -1,
299 };
300 
301 static struct input_absinfo absinfo[] = {
302 	{ ABS_VOLUME, 0, 572, 0, 0, 0 },
303 	{ ABS_MISC, 0, 255, 0, 0, 0 },
304 	{ 0x29, 0, 255, 0, 0, 0 },
305 	{ 0x2a, 0, 255, 0, 0, 0 },
306 	{ 0x2b, 0, 255, 0, 0, 0 },
307 	{ 0x2c, 0, 255, 0, 0, 0 },
308 	{ 0x2d, 0, 255, 0, 0, 0 },
309 	{ 0x2e, 0, 255, 0, 0, 0 },
310 	{ 0x2f, 0, 255, 0, 0, 0 },
311 	{ 0x30, 0, 255, 0, 0, 0 },
312 	{ 0x31, 0, 255, 0, 0, 0 },
313 	{ 0x32, 0, 255, 0, 0, 0 },
314 	{ 0x33, 0, 255, 0, 0, 0 },
315 	{ 0x34, 0, 255, 0, 0, 0 },
316 	{ 0x35, 0, 255, 0, 0, 0 },
317 	{ 0x36, 0, 255, 0, 0, 0 },
318 	{ 0x37, 0, 255, 0, 0, 0 },
319 	{ 0x38, 0, 255, 0, 0, 0 },
320 	{ 0x39, 0, 255, 0, 0, 0 },
321 	{ 0x3a, 0, 255, 0, 0, 0 },
322 	{ 0x3b, 0, 255, 0, 0, 0 },
323 	{ 0x3c, 0, 255, 0, 0, 0 },
324 	{ 0x3d, 0, 255, 0, 0, 0 },
325 	{ 0x3e, 0, 255, 0, 0, 0 },
326 	{ 0x3f, 0, 255, 0, 0, 0 },
327 	{ .value = -1 },
328 };
329 
330 TEST_DEVICE("blade-stealth",
331 	.type = LITEST_KEYBOARD_BLADE_STEALTH,
332 	.features = LITEST_KEYS | LITEST_WHEEL,
333 	.interface = NULL,
334 
335 	.name = "Razer Razer Blade Stealth",
336 	.id = &input_id,
337 	.absinfo = absinfo,
338 	.events = events,
339 )
340