• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2013 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 static struct input_id input_id = {
30 	.bustype = 0x11,
31 	.vendor = 0x1,
32 	.product = 0x1,
33 };
34 
35 static int events[] = {
36 	EV_REL, REL_X,
37 	EV_REL, REL_Y,
38 
39 	EV_KEY, KEY_ESC,
40 	EV_KEY, KEY_1,
41 	EV_KEY, KEY_2,
42 	EV_KEY, KEY_3,
43 	EV_KEY, KEY_4,
44 	EV_KEY, KEY_5,
45 	EV_KEY, KEY_6,
46 	EV_KEY, KEY_7,
47 	EV_KEY, KEY_8,
48 	EV_KEY, KEY_9,
49 	EV_KEY, KEY_0,
50 	EV_KEY, KEY_MINUS,
51 	EV_KEY, KEY_EQUAL,
52 	EV_KEY, KEY_BACKSPACE,
53 	EV_KEY, KEY_TAB,
54 	EV_KEY, KEY_Q,
55 	EV_KEY, KEY_W,
56 	EV_KEY, KEY_E,
57 	EV_KEY, KEY_R,
58 	EV_KEY, KEY_T,
59 	EV_KEY, KEY_Y,
60 	EV_KEY, KEY_U,
61 	EV_KEY, KEY_I,
62 	EV_KEY, KEY_O,
63 	EV_KEY, KEY_P,
64 	EV_KEY, KEY_LEFTBRACE,
65 	EV_KEY, KEY_RIGHTBRACE,
66 	EV_KEY, KEY_ENTER,
67 	EV_KEY, KEY_LEFTCTRL,
68 	EV_KEY, KEY_A,
69 	EV_KEY, KEY_S,
70 	EV_KEY, KEY_D,
71 	EV_KEY, KEY_F,
72 	EV_KEY, KEY_G,
73 	EV_KEY, KEY_H,
74 	EV_KEY, KEY_J,
75 	EV_KEY, KEY_K,
76 	EV_KEY, KEY_L,
77 	EV_KEY, KEY_SEMICOLON,
78 	EV_KEY, KEY_APOSTROPHE,
79 	EV_KEY, KEY_GRAVE,
80 	EV_KEY, KEY_LEFTSHIFT,
81 	EV_KEY, KEY_BACKSLASH,
82 	EV_KEY, KEY_Z,
83 	EV_KEY, KEY_X,
84 	EV_KEY, KEY_C,
85 	EV_KEY, KEY_V,
86 	EV_KEY, KEY_B,
87 	EV_KEY, KEY_N,
88 	EV_KEY, KEY_M,
89 	EV_KEY, KEY_COMMA,
90 	EV_KEY, KEY_DOT,
91 	EV_KEY, KEY_SLASH,
92 	EV_KEY, KEY_RIGHTSHIFT,
93 	EV_KEY, KEY_KPASTERISK,
94 	EV_KEY, KEY_LEFTALT,
95 	EV_KEY, KEY_SPACE,
96 	EV_KEY, KEY_CAPSLOCK,
97 	EV_KEY, KEY_F1,
98 	EV_KEY, KEY_F2,
99 	EV_KEY, KEY_F3,
100 	EV_KEY, KEY_F4,
101 	EV_KEY, KEY_F5,
102 	EV_KEY, KEY_F6,
103 	EV_KEY, KEY_F7,
104 	EV_KEY, KEY_F8,
105 	EV_KEY, KEY_F9,
106 	EV_KEY, KEY_F10,
107 	EV_KEY, KEY_NUMLOCK,
108 	EV_KEY, KEY_SCROLLLOCK,
109 	EV_KEY, KEY_KP7,
110 	EV_KEY, KEY_KP8,
111 	EV_KEY, KEY_KP9,
112 	EV_KEY, KEY_KPMINUS,
113 	EV_KEY, KEY_KP4,
114 	EV_KEY, KEY_KP5,
115 	EV_KEY, KEY_KP6,
116 	EV_KEY, KEY_KPPLUS,
117 	EV_KEY, KEY_KP1,
118 	EV_KEY, KEY_KP2,
119 	EV_KEY, KEY_KP3,
120 	EV_KEY, KEY_KP0,
121 	EV_KEY, KEY_KPDOT,
122 	EV_KEY, KEY_ZENKAKUHANKAKU,
123 	EV_KEY, KEY_102ND,
124 	EV_KEY, KEY_F11,
125 	EV_KEY, KEY_F12,
126 	EV_KEY, KEY_RO,
127 	EV_KEY, KEY_KATAKANA,
128 	EV_KEY, KEY_HIRAGANA,
129 	EV_KEY, KEY_HENKAN,
130 	EV_KEY, KEY_KATAKANAHIRAGANA,
131 	EV_KEY, KEY_MUHENKAN,
132 	EV_KEY, KEY_KPJPCOMMA,
133 	EV_KEY, KEY_KPENTER,
134 	EV_KEY, KEY_RIGHTCTRL,
135 	EV_KEY, KEY_KPSLASH,
136 	EV_KEY, KEY_SYSRQ,
137 	EV_KEY, KEY_RIGHTALT,
138 	EV_KEY, KEY_LINEFEED,
139 	EV_KEY, KEY_HOME,
140 	EV_KEY, KEY_UP,
141 	EV_KEY, KEY_PAGEUP,
142 	EV_KEY, KEY_LEFT,
143 	EV_KEY, KEY_RIGHT,
144 	EV_KEY, KEY_END,
145 	EV_KEY, KEY_DOWN,
146 	EV_KEY, KEY_PAGEDOWN,
147 	EV_KEY, KEY_INSERT,
148 	EV_KEY, KEY_DELETE,
149 	EV_KEY, KEY_MACRO,
150 	EV_KEY, KEY_MUTE,
151 	EV_KEY, KEY_VOLUMEDOWN,
152 	EV_KEY, KEY_VOLUMEUP,
153 	EV_KEY, KEY_POWER,
154 	EV_KEY, KEY_KPEQUAL,
155 	EV_KEY, KEY_KPPLUSMINUS,
156 	EV_KEY, KEY_PAUSE,
157 	/* EV_KEY,  KEY_SCALE, */
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 
167 	EV_KEY, KEY_MENU,
168 	EV_KEY, KEY_CALC,
169 	EV_KEY, KEY_SETUP,
170 	EV_KEY, KEY_SLEEP,
171 	EV_KEY, KEY_WAKEUP,
172 	EV_KEY, KEY_SCREENLOCK,
173 	EV_KEY, KEY_DIRECTION,
174 	EV_KEY, KEY_CYCLEWINDOWS,
175 	EV_KEY, KEY_MAIL,
176 	EV_KEY, KEY_BOOKMARKS,
177 	EV_KEY, KEY_COMPUTER,
178 	EV_KEY, KEY_BACK,
179 	EV_KEY, KEY_FORWARD,
180 	EV_KEY, KEY_NEXTSONG,
181 	EV_KEY, KEY_PLAYPAUSE,
182 	EV_KEY, KEY_PREVIOUSSONG,
183 	EV_KEY, KEY_STOPCD,
184 	EV_KEY, KEY_HOMEPAGE,
185 	EV_KEY, KEY_REFRESH,
186 	EV_KEY, KEY_F14,
187 	EV_KEY, KEY_F15,
188 	EV_KEY, KEY_SEARCH,
189 	EV_KEY, KEY_MEDIA,
190 	EV_KEY, KEY_FN,
191 	EV_LED, LED_NUML,
192 	EV_LED, LED_CAPSL,
193 	EV_LED, LED_SCROLLL,
194 
195 	/* gets disabled */
196 	INPUT_PROP_MAX, INPUT_PROP_POINTING_STICK,
197 
198 	-1, -1,
199 };
200 
201 static const char quirk_file[] =
202 "[litest Quirked Keyboard enable rel]\n"
203 "MatchName=litest Quirked Keyboard\n"
204 "AttrEventCodeEnable=BTN_RIGHT;EV_KEY:0x110\n" /* BTN_LEFT */
205 "\n"
206 "[litest Quirked keyboard disable F1-F3]\n"
207 "MatchName=litest Quirked Keyboard\n"
208 "AttrEventCodeDisable=KEY_F1;EV_KEY:0x3c;KEY_F3\n"
209 #if HAVE_LIBEVDEV_DISABLE_PROPERTY
210 "\n"
211 "[litest Quirked keyboard enable buttonpad]\n"
212 "MatchName=litest Quirked Keyboard\n"
213 "AttrInputPropEnable=INPUT_PROP_BUTTONPAD\n"
214 "\n"
215 "[litest Quirked keyboard disable pointingstick]\n"
216 "MatchName=litest Quirked Keyboard\n"
217 "AttrInputPropDisable=INPUT_PROP_POINTING_STICK\n"
218 #endif
219 ;
220 
221 TEST_DEVICE("keyboard-quirked",
222 	.type = LITEST_KEYBOARD_QUIRKED,
223 	.features = LITEST_KEYS | LITEST_IGNORED, /* Only use this keyboard in specific tests */
224 	.interface = NULL,
225 
226 	.name = "Quirked Keyboard",
227 	.id = &input_id,
228 	.events = events,
229 	.absinfo = NULL,
230 	.quirk_file = quirk_file,
231 )
232