• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2015 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=89783
30  * This is the second of 4 devices exported by this keyboard, the first is
31  * just a basic keyboard that is identical to the normal litest-keyboard.c
32  * file.
33  */
34 
35 static struct input_id input_id = {
36 	.bustype = 0x3,
37 	.vendor = 0x1532,
38 	.product = 0x11b,
39 };
40 
41 static int events[] = {
42 	EV_REL, REL_HWHEEL,
43 	EV_KEY, KEY_ESC,
44 	EV_KEY, KEY_1,
45 	EV_KEY, KEY_2,
46 	EV_KEY, KEY_3,
47 	EV_KEY, KEY_4,
48 	EV_KEY, KEY_5,
49 	EV_KEY, KEY_6,
50 	EV_KEY, KEY_7,
51 	EV_KEY, KEY_8,
52 	EV_KEY, KEY_9,
53 	EV_KEY, KEY_0,
54 	EV_KEY, KEY_MINUS,
55 	EV_KEY, KEY_EQUAL,
56 	EV_KEY, KEY_BACKSPACE,
57 	EV_KEY, KEY_TAB,
58 	EV_KEY, KEY_Q,
59 	EV_KEY, KEY_W,
60 	EV_KEY, KEY_E,
61 	EV_KEY, KEY_R,
62 	EV_KEY, KEY_T,
63 	EV_KEY, KEY_Y,
64 	EV_KEY, KEY_U,
65 	EV_KEY, KEY_I,
66 	EV_KEY, KEY_O,
67 	EV_KEY, KEY_P,
68 	EV_KEY, KEY_LEFTBRACE,
69 	EV_KEY, KEY_RIGHTBRACE,
70 	EV_KEY, KEY_ENTER,
71 	EV_KEY, KEY_LEFTCTRL,
72 	EV_KEY, KEY_A,
73 	EV_KEY, KEY_S,
74 	EV_KEY, KEY_D,
75 	EV_KEY, KEY_F,
76 	EV_KEY, KEY_G,
77 	EV_KEY, KEY_H,
78 	EV_KEY, KEY_J,
79 	EV_KEY, KEY_K,
80 	EV_KEY, KEY_L,
81 	EV_KEY, KEY_SEMICOLON,
82 	EV_KEY, KEY_APOSTROPHE,
83 	EV_KEY, KEY_GRAVE,
84 	EV_KEY, KEY_LEFTSHIFT,
85 	EV_KEY, KEY_BACKSLASH,
86 	EV_KEY, KEY_Z,
87 	EV_KEY, KEY_X,
88 	EV_KEY, KEY_C,
89 	EV_KEY, KEY_V,
90 	EV_KEY, KEY_B,
91 	EV_KEY, KEY_N,
92 	EV_KEY, KEY_M,
93 	EV_KEY, KEY_COMMA,
94 	EV_KEY, KEY_DOT,
95 	EV_KEY, KEY_SLASH,
96 	EV_KEY, KEY_RIGHTSHIFT,
97 	EV_KEY, KEY_KPASTERISK,
98 	EV_KEY, KEY_LEFTALT,
99 	EV_KEY, KEY_SPACE,
100 	EV_KEY, KEY_CAPSLOCK,
101 	EV_KEY, KEY_F1,
102 	EV_KEY, KEY_F2,
103 	EV_KEY, KEY_F3,
104 	EV_KEY, KEY_F4,
105 	EV_KEY, KEY_F5,
106 	EV_KEY, KEY_F6,
107 	EV_KEY, KEY_F7,
108 	EV_KEY, KEY_F8,
109 	EV_KEY, KEY_F9,
110 	EV_KEY, KEY_F10,
111 	EV_KEY, KEY_NUMLOCK,
112 	EV_KEY, KEY_SCROLLLOCK,
113 	EV_KEY, KEY_KP7,
114 	EV_KEY, KEY_KP8,
115 	EV_KEY, KEY_KP9,
116 	EV_KEY, KEY_KPMINUS,
117 	EV_KEY, KEY_KP4,
118 	EV_KEY, KEY_KP5,
119 	EV_KEY, KEY_KP6,
120 	EV_KEY, KEY_KPPLUS,
121 	EV_KEY, KEY_KP1,
122 	EV_KEY, KEY_KP2,
123 	EV_KEY, KEY_KP3,
124 	EV_KEY, KEY_KP0,
125 	EV_KEY, KEY_KPDOT,
126 	EV_KEY, KEY_ZENKAKUHANKAKU,
127 	EV_KEY, KEY_102ND,
128 	EV_KEY, KEY_F11,
129 	EV_KEY, KEY_F12,
130 	EV_KEY, KEY_RO,
131 	EV_KEY, KEY_KATAKANA,
132 	EV_KEY, KEY_HIRAGANA,
133 	EV_KEY, KEY_HENKAN,
134 	EV_KEY, KEY_KATAKANAHIRAGANA,
135 	EV_KEY, KEY_MUHENKAN,
136 	EV_KEY, KEY_KPJPCOMMA,
137 	EV_KEY, KEY_KPENTER,
138 	EV_KEY, KEY_RIGHTCTRL,
139 	EV_KEY, KEY_KPSLASH,
140 	EV_KEY, KEY_SYSRQ,
141 	EV_KEY, KEY_RIGHTALT,
142 	EV_KEY, KEY_HOME,
143 	EV_KEY, KEY_UP,
144 	EV_KEY, KEY_PAGEUP,
145 	EV_KEY, KEY_LEFT,
146 	EV_KEY, KEY_RIGHT,
147 	EV_KEY, KEY_END,
148 	EV_KEY, KEY_DOWN,
149 	EV_KEY, KEY_PAGEDOWN,
150 	EV_KEY, KEY_INSERT,
151 	EV_KEY, KEY_DELETE,
152 	EV_KEY, KEY_MUTE,
153 	EV_KEY, KEY_VOLUMEDOWN,
154 	EV_KEY, KEY_VOLUMEUP,
155 	EV_KEY, KEY_POWER,
156 	EV_KEY, KEY_KPEQUAL,
157 	EV_KEY, KEY_PAUSE,
158 	EV_KEY, KEY_KPCOMMA,
159 	EV_KEY, KEY_HANGEUL,
160 	EV_KEY, KEY_HANJA,
161 	EV_KEY, KEY_YEN,
162 	EV_KEY, KEY_LEFTMETA,
163 	EV_KEY, KEY_RIGHTMETA,
164 	EV_KEY, KEY_COMPOSE,
165 	EV_KEY, KEY_STOP,
166 	EV_KEY, KEY_AGAIN,
167 	EV_KEY, KEY_PROPS,
168 	EV_KEY, KEY_UNDO,
169 	EV_KEY, KEY_FRONT,
170 	EV_KEY, KEY_COPY,
171 	EV_KEY, KEY_OPEN,
172 	EV_KEY, KEY_PASTE,
173 	EV_KEY, KEY_FIND,
174 	EV_KEY, KEY_CUT,
175 	EV_KEY, KEY_HELP,
176 	EV_KEY, KEY_MENU,
177 	EV_KEY, KEY_CALC,
178 	EV_KEY, KEY_SLEEP,
179 	EV_KEY, KEY_WAKEUP,
180 	EV_KEY, KEY_FILE,
181 	EV_KEY, KEY_WWW,
182 	EV_KEY, KEY_COFFEE,
183 	EV_KEY, KEY_MAIL,
184 	EV_KEY, KEY_BOOKMARKS,
185 	EV_KEY, KEY_BACK,
186 	EV_KEY, KEY_FORWARD,
187 	EV_KEY, KEY_EJECTCD,
188 	EV_KEY, KEY_NEXTSONG,
189 	EV_KEY, KEY_PLAYPAUSE,
190 	EV_KEY, KEY_PREVIOUSSONG,
191 	EV_KEY, KEY_STOPCD,
192 	EV_KEY, KEY_RECORD,
193 	EV_KEY, KEY_REWIND,
194 	EV_KEY, KEY_PHONE,
195 	EV_KEY, KEY_CONFIG,
196 	EV_KEY, KEY_HOMEPAGE,
197 	EV_KEY, KEY_REFRESH,
198 	EV_KEY, KEY_EXIT,
199 	EV_KEY, KEY_EDIT,
200 	EV_KEY, KEY_SCROLLUP,
201 	EV_KEY, KEY_SCROLLDOWN,
202 	EV_KEY, KEY_KPLEFTPAREN,
203 	EV_KEY, KEY_KPRIGHTPAREN,
204 	EV_KEY, KEY_NEW,
205 	EV_KEY, KEY_F13,
206 	EV_KEY, KEY_F14,
207 	EV_KEY, KEY_F15,
208 	EV_KEY, KEY_F16,
209 	EV_KEY, KEY_F17,
210 	EV_KEY, KEY_F18,
211 	EV_KEY, KEY_F19,
212 	EV_KEY, KEY_F20,
213 	EV_KEY, KEY_F21,
214 	EV_KEY, KEY_F22,
215 	EV_KEY, KEY_F23,
216 	EV_KEY, KEY_F24,
217 	EV_KEY, KEY_CLOSE,
218 	EV_KEY, KEY_PLAY,
219 	EV_KEY, KEY_FASTFORWARD,
220 	EV_KEY, KEY_BASSBOOST,
221 	EV_KEY, KEY_PRINT,
222 	EV_KEY, KEY_CAMERA,
223 	EV_KEY, KEY_CHAT,
224 	EV_KEY, KEY_SEARCH,
225 	EV_KEY, KEY_FINANCE,
226 	EV_KEY, KEY_BRIGHTNESSDOWN,
227 	EV_KEY, KEY_BRIGHTNESSUP,
228 	EV_KEY, KEY_KBDILLUMTOGGLE,
229 	EV_KEY, KEY_SAVE,
230 	EV_KEY, KEY_DOCUMENTS,
231 	EV_KEY, KEY_UNKNOWN,
232 	EV_KEY, KEY_VIDEO_NEXT,
233 	EV_KEY, KEY_BRIGHTNESS_AUTO,
234 	EV_KEY, BTN_0,
235 	EV_KEY, KEY_SELECT,
236 	EV_KEY, KEY_GOTO,
237 	EV_KEY, KEY_INFO,
238 	EV_KEY, KEY_PROGRAM,
239 	EV_KEY, KEY_PVR,
240 	EV_KEY, KEY_SUBTITLE,
241 	EV_KEY, KEY_ZOOM,
242 	EV_KEY, KEY_KEYBOARD,
243 	EV_KEY, KEY_PC,
244 	EV_KEY, KEY_TV,
245 	EV_KEY, KEY_TV2,
246 	EV_KEY, KEY_VCR,
247 	EV_KEY, KEY_VCR2,
248 	EV_KEY, KEY_SAT,
249 	EV_KEY, KEY_CD,
250 	EV_KEY, KEY_TAPE,
251 	EV_KEY, KEY_TUNER,
252 	EV_KEY, KEY_PLAYER,
253 	EV_KEY, KEY_DVD,
254 	EV_KEY, KEY_AUDIO,
255 	EV_KEY, KEY_VIDEO,
256 	EV_KEY, KEY_MEMO,
257 	EV_KEY, KEY_CALENDAR,
258 	EV_KEY, KEY_RED,
259 	EV_KEY, KEY_GREEN,
260 	EV_KEY, KEY_YELLOW,
261 	EV_KEY, KEY_BLUE,
262 	EV_KEY, KEY_CHANNELUP,
263 	EV_KEY, KEY_CHANNELDOWN,
264 	EV_KEY, KEY_LAST,
265 	EV_KEY, KEY_NEXT,
266 	EV_KEY, KEY_RESTART,
267 	EV_KEY, KEY_SLOW,
268 	EV_KEY, KEY_SHUFFLE,
269 	EV_KEY, KEY_PREVIOUS,
270 	EV_KEY, KEY_VIDEOPHONE,
271 	EV_KEY, KEY_GAMES,
272 	EV_KEY, KEY_ZOOMIN,
273 	EV_KEY, KEY_ZOOMOUT,
274 	EV_KEY, KEY_ZOOMRESET,
275 	EV_KEY, KEY_WORDPROCESSOR,
276 	EV_KEY, KEY_EDITOR,
277 	EV_KEY, KEY_SPREADSHEET,
278 	EV_KEY, KEY_GRAPHICSEDITOR,
279 	EV_KEY, KEY_PRESENTATION,
280 	EV_KEY, KEY_DATABASE,
281 	EV_KEY, KEY_NEWS,
282 	EV_KEY, KEY_VOICEMAIL,
283 	EV_KEY, KEY_ADDRESSBOOK,
284 	EV_KEY, KEY_MESSENGER,
285 	EV_KEY, KEY_DISPLAYTOGGLE,
286 	EV_KEY, KEY_SPELLCHECK,
287 	EV_KEY, KEY_LOGOFF,
288 	EV_KEY, KEY_MEDIA_REPEAT,
289 	EV_KEY, KEY_IMAGES,
290 	EV_KEY, KEY_BUTTONCONFIG,
291 	EV_KEY, KEY_TASKMANAGER,
292 	EV_KEY, KEY_JOURNAL,
293 	EV_KEY, KEY_CONTROLPANEL,
294 	EV_KEY, KEY_APPSELECT,
295 	EV_KEY, KEY_SCREENSAVER,
296 	EV_KEY, KEY_VOICECOMMAND,
297 	EV_KEY, KEY_BRIGHTNESS_MIN,
298 	EV_KEY, KEY_BRIGHTNESS_MAX,
299 	EV_MSC, MSC_SCAN,
300 	-1 , -1,
301 };
302 
303 static struct input_absinfo absinfo[] = {
304 	{ ABS_VOLUME, 0, 572, 0, 0, 0 },
305 	{ ABS_MISC, 0, 255, 0, 0, 0 },
306 	{ 0x29, 0, 255, 0, 0, 0 },
307 	{ 0x2a, 0, 255, 0, 0, 0 },
308 	{ 0x2b, 0, 255, 0, 0, 0 },
309 	{ 0x2c, 0, 255, 0, 0, 0 },
310 	{ 0x2d, 0, 255, 0, 0, 0 },
311 	{ 0x2e, 0, 255, 0, 0, 0 },
312 	{ 0x2f, 0, 255, 0, 0, 0 },
313 	{ 0x30, 0, 255, 0, 0, 0 },
314 	{ 0x31, 0, 255, 0, 0, 0 },
315 	{ 0x32, 0, 255, 0, 0, 0 },
316 	{ 0x33, 0, 255, 0, 0, 0 },
317 	{ 0x34, 0, 255, 0, 0, 0 },
318 	{ 0x35, 0, 255, 0, 0, 0 },
319 	{ 0x36, 0, 255, 0, 0, 0 },
320 	{ 0x37, 0, 255, 0, 0, 0 },
321 	{ 0x38, 0, 255, 0, 0, 0 },
322 	{ 0x39, 0, 255, 0, 0, 0 },
323 	{ 0x3a, 0, 255, 0, 0, 0 },
324 	{ 0x3b, 0, 255, 0, 0, 0 },
325 	{ 0x3c, 0, 255, 0, 0, 0 },
326 	{ 0x3d, 0, 255, 0, 0, 0 },
327 	{ 0x3e, 0, 255, 0, 0, 0 },
328 	{ 0x3f, 0, 255, 0, 0, 0 },
329 	{ .value = -1 },
330 };
331 
332 TEST_DEVICE("blackwidow",
333 	.type = LITEST_KEYBOARD_BLACKWIDOW,
334 	.features = LITEST_KEYS | LITEST_WHEEL,
335 	.interface = NULL,
336 
337 	.name = "Razer Razer BlackWidow 2013",
338 	.id = &input_id,
339 	.absinfo = absinfo,
340 	.events = events,
341 )
342