• 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=93474
30  * This is the keyboard device for this mouse.
31  */
32 
33 static struct input_id input_id = {
34 	.bustype = 0x3,
35 	.vendor = 0x4d9,
36 	.product = 0xfa50,
37 };
38 
39 static int events[] = {
40 	EV_REL, REL_HWHEEL,
41 	EV_KEY, KEY_ESC,
42 	EV_KEY, KEY_KPMINUS,
43 	EV_KEY, KEY_KPPLUS,
44 	EV_KEY, KEY_UP,
45 	EV_KEY, KEY_PAGEUP,
46 	EV_KEY, KEY_LEFT,
47 	EV_KEY, KEY_RIGHT,
48 	EV_KEY, KEY_END,
49 	EV_KEY, KEY_DOWN,
50 	EV_KEY, KEY_PAGEDOWN,
51 	EV_KEY, KEY_INSERT,
52 	EV_KEY, KEY_DELETE,
53 	EV_KEY, KEY_MUTE,
54 	EV_KEY, KEY_VOLUMEDOWN,
55 	EV_KEY, KEY_VOLUMEUP,
56 	EV_KEY, KEY_POWER,
57 	EV_KEY, KEY_PAUSE,
58 	EV_KEY, KEY_STOP,
59 	EV_KEY, KEY_PROPS,
60 	EV_KEY, KEY_UNDO,
61 	EV_KEY, KEY_COPY,
62 	EV_KEY, KEY_OPEN,
63 	EV_KEY, KEY_PASTE,
64 	EV_KEY, KEY_FIND,
65 	EV_KEY, KEY_CUT,
66 	EV_KEY, KEY_HELP,
67 	EV_KEY, KEY_MENU,
68 	EV_KEY, KEY_CALC,
69 	EV_KEY, KEY_SLEEP,
70 	EV_KEY, KEY_WAKEUP,
71 	EV_KEY, KEY_FILE,
72 	EV_KEY, KEY_WWW,
73 	EV_KEY, KEY_COFFEE,
74 	EV_KEY, KEY_MAIL,
75 	EV_KEY, KEY_BOOKMARKS,
76 	EV_KEY, KEY_BACK,
77 	EV_KEY, KEY_FORWARD,
78 	EV_KEY, KEY_EJECTCD,
79 	EV_KEY, KEY_NEXTSONG,
80 	EV_KEY, KEY_PLAYPAUSE,
81 	EV_KEY, KEY_PREVIOUSSONG,
82 	EV_KEY, KEY_STOPCD,
83 	EV_KEY, KEY_RECORD,
84 	EV_KEY, KEY_REWIND,
85 	EV_KEY, KEY_PHONE,
86 	EV_KEY, KEY_CONFIG,
87 	EV_KEY, KEY_HOMEPAGE,
88 	EV_KEY, KEY_REFRESH,
89 	EV_KEY, KEY_EXIT,
90 	EV_KEY, KEY_EDIT,
91 	EV_KEY, KEY_SCROLLUP,
92 	EV_KEY, KEY_SCROLLDOWN,
93 	EV_KEY, KEY_NEW,
94 	EV_KEY, KEY_REDO,
95 	EV_KEY, KEY_CLOSE,
96 	EV_KEY, KEY_PLAY,
97 	EV_KEY, KEY_FASTFORWARD,
98 	EV_KEY, KEY_BASSBOOST,
99 	EV_KEY, KEY_PRINT,
100 	EV_KEY, KEY_CAMERA,
101 	EV_KEY, KEY_CHAT,
102 	EV_KEY, KEY_SEARCH,
103 	EV_KEY, KEY_FINANCE,
104 	EV_KEY, KEY_BRIGHTNESSDOWN,
105 	EV_KEY, KEY_BRIGHTNESSUP,
106 	EV_KEY, KEY_KBDILLUMTOGGLE,
107 	EV_KEY, KEY_SAVE,
108 	EV_KEY, KEY_DOCUMENTS,
109 	EV_KEY, KEY_UNKNOWN,
110 	EV_KEY, KEY_VIDEO_NEXT,
111 	EV_KEY, KEY_BRIGHTNESS_AUTO,
112 	EV_KEY, BTN_0,
113 	EV_KEY, KEY_SELECT,
114 	EV_KEY, KEY_GOTO,
115 	EV_KEY, KEY_INFO,
116 	EV_KEY, KEY_PROGRAM,
117 	EV_KEY, KEY_PVR,
118 	EV_KEY, KEY_SUBTITLE,
119 	EV_KEY, KEY_ZOOM,
120 	EV_KEY, KEY_KEYBOARD,
121 	EV_KEY, KEY_PC,
122 	EV_KEY, KEY_TV,
123 	EV_KEY, KEY_TV2,
124 	EV_KEY, KEY_VCR,
125 	EV_KEY, KEY_VCR2,
126 	EV_KEY, KEY_SAT,
127 	EV_KEY, KEY_CD,
128 	EV_KEY, KEY_TAPE,
129 	EV_KEY, KEY_TUNER,
130 	EV_KEY, KEY_PLAYER,
131 	EV_KEY, KEY_DVD,
132 	EV_KEY, KEY_AUDIO,
133 	EV_KEY, KEY_VIDEO,
134 	EV_KEY, KEY_MEMO,
135 	EV_KEY, KEY_CALENDAR,
136 	EV_KEY, KEY_RED,
137 	EV_KEY, KEY_GREEN,
138 	EV_KEY, KEY_YELLOW,
139 	EV_KEY, KEY_BLUE,
140 	EV_KEY, KEY_CHANNELUP,
141 	EV_KEY, KEY_CHANNELDOWN,
142 	EV_KEY, KEY_LAST,
143 	EV_KEY, KEY_NEXT,
144 	EV_KEY, KEY_RESTART,
145 	EV_KEY, KEY_SLOW,
146 	EV_KEY, KEY_SHUFFLE,
147 	EV_KEY, KEY_PREVIOUS,
148 	EV_KEY, KEY_VIDEOPHONE,
149 	EV_KEY, KEY_GAMES,
150 	EV_KEY, KEY_ZOOMIN,
151 	EV_KEY, KEY_ZOOMOUT,
152 	EV_KEY, KEY_ZOOMRESET,
153 	EV_KEY, KEY_WORDPROCESSOR,
154 	EV_KEY, KEY_EDITOR,
155 	EV_KEY, KEY_SPREADSHEET,
156 	EV_KEY, KEY_GRAPHICSEDITOR,
157 	EV_KEY, KEY_PRESENTATION,
158 	EV_KEY, KEY_DATABASE,
159 	EV_KEY, KEY_NEWS,
160 	EV_KEY, KEY_VOICEMAIL,
161 	EV_KEY, KEY_ADDRESSBOOK,
162 	EV_KEY, KEY_MESSENGER,
163 	EV_KEY, KEY_DISPLAYTOGGLE,
164 	EV_KEY, KEY_SPELLCHECK,
165 	EV_KEY, KEY_LOGOFF,
166 	EV_KEY, KEY_MEDIA_REPEAT,
167 	EV_KEY, KEY_IMAGES,
168 	EV_KEY, KEY_BUTTONCONFIG,
169 	EV_KEY, KEY_TASKMANAGER,
170 	EV_KEY, KEY_JOURNAL,
171 	EV_KEY, KEY_CONTROLPANEL,
172 	EV_KEY, KEY_APPSELECT,
173 	EV_KEY, KEY_SCREENSAVER,
174 	EV_KEY, KEY_VOICECOMMAND,
175 	EV_KEY, KEY_BRIGHTNESS_MIN,
176 	EV_KEY, KEY_BRIGHTNESS_MAX,
177 	EV_KEY, KEY_KBDINPUTASSIST_PREV,
178 	EV_KEY, KEY_KBDINPUTASSIST_NEXT,
179 	EV_KEY, KEY_KBDINPUTASSIST_PREVGROUP,
180 	EV_KEY, KEY_KBDINPUTASSIST_NEXTGROUP,
181 	EV_KEY, KEY_KBDINPUTASSIST_ACCEPT,
182 	EV_KEY, KEY_KBDINPUTASSIST_CANCEL,
183 	EV_MSC, MSC_SCAN,
184 	-1 , -1,
185 };
186 
187 static struct input_absinfo absinfo[] = {
188 	{ ABS_VOLUME, 0, 4096, 0, 0, 0 },
189 	{ ABS_MISC, 0, 255, 0, 0, 0 },
190 	{ 0x29, 0, 255, 0, 0, 0 },
191 	{ 0x2a, 0, 255, 0, 0, 0 },
192 	{ 0x2b, 0, 255, 0, 0, 0 },
193 	{ 0x2c, 0, 255, 0, 0, 0 },
194 	{ 0x2d, 0, 255, 0, 0, 0 },
195 	{ 0x2e, 0, 255, 0, 0, 0 },
196 	{ ABS_MT_SLOT, 0, 255, 0, 0, 0 },
197 	{ ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0, 0 },
198 	{ ABS_MT_TOUCH_MINOR, 0, 255, 0, 0, 0 },
199 	{ ABS_MT_WIDTH_MINOR, 0, 255, 0, 0, 0 },
200 	{ ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0, 0 },
201 	{ ABS_MT_ORIENTATION, 0, 255, 0, 0, 0 },
202 	{ ABS_MT_POSITION_X, 0, 255, 0, 0, 0 },
203 	{ .value = -1 },
204 };
205 
206 TEST_DEVICE("anker-kbd",
207 	.type = LITEST_ANKER_MOUSE_KBD,
208 	.features = LITEST_KEYS | LITEST_WHEEL,
209 	.interface = NULL,
210 
211 	.name = "USB Laser Game Mouse",
212 	.id = &input_id,
213 	.absinfo = absinfo,
214 	.events = events,
215 )
216