xref: /linux/drivers/media/rc/keymaps/rc-hauppauge.c (revision 93df8a1ed6231727c5db94a80b1a6bd5ee67cec3)
1 /* rc-hauppauge.c - Keytable for Hauppauge Remote Controllers
2  *
3  * keymap imported from ir-keymaps.c
4  *
5  * This map currently contains the code for four different RCs:
6  *	- New Hauppauge Gray;
7  *	- Old Hauppauge Gray (with a golden screen for media keys);
8  *	- Hauppauge Black;
9  *	- DSR-0112 remote bundled with Haupauge MiniStick.
10  *
11  * Copyright (c) 2010-2011 by Mauro Carvalho Chehab
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  */
18 
19 #include <media/rc-map.h>
20 #include <linux/module.h>
21 
22 /*
23  * Hauppauge:the newer, gray remotes (seems there are multiple
24  * slightly different versions), shipped with cx88+ivtv cards.
25  *
26  * This table contains the complete RC5 code, instead of just the data part
27  */
28 
29 static struct rc_map_table rc5_hauppauge_new[] = {
30 	/*
31 	 * Remote Controller Hauppauge Gray found on modern devices
32 	 * Keycodes start with address = 0x1e
33 	 */
34 
35 	{ 0x1e3b, KEY_SELECT },		/* GO / house symbol */
36 	{ 0x1e3d, KEY_POWER2 },		/* system power (green button) */
37 
38 	{ 0x1e1c, KEY_TV },
39 	{ 0x1e18, KEY_VIDEO },		/* Videos */
40 	{ 0x1e19, KEY_AUDIO },		/* Music */
41 	{ 0x1e1a, KEY_CAMERA },		/* Pictures */
42 
43 	{ 0x1e1b, KEY_EPG },		/* Guide */
44 	{ 0x1e0c, KEY_RADIO },
45 
46 	{ 0x1e14, KEY_UP },
47 	{ 0x1e15, KEY_DOWN },
48 	{ 0x1e16, KEY_LEFT },
49 	{ 0x1e17, KEY_RIGHT },
50 	{ 0x1e25, KEY_OK },		/* OK */
51 
52 	{ 0x1e1f, KEY_EXIT },		/* back/exit */
53 	{ 0x1e0d, KEY_MENU },
54 
55 	{ 0x1e10, KEY_VOLUMEUP },
56 	{ 0x1e11, KEY_VOLUMEDOWN },
57 
58 	{ 0x1e12, KEY_PREVIOUS },	/* previous channel */
59 	{ 0x1e0f, KEY_MUTE },
60 
61 	{ 0x1e20, KEY_CHANNELUP },	/* channel / program + */
62 	{ 0x1e21, KEY_CHANNELDOWN },	/* channel / program - */
63 
64 	{ 0x1e37, KEY_RECORD },		/* recording */
65 	{ 0x1e36, KEY_STOP },
66 
67 	{ 0x1e32, KEY_REWIND },		/* backward << */
68 	{ 0x1e35, KEY_PLAY },
69 	{ 0x1e34, KEY_FASTFORWARD },	/* forward >> */
70 
71 	{ 0x1e24, KEY_PREVIOUSSONG },	/* replay |< */
72 	{ 0x1e30, KEY_PAUSE },		/* pause */
73 	{ 0x1e1e, KEY_NEXTSONG },	/* skip >| */
74 
75 	{ 0x1e01, KEY_1 },
76 	{ 0x1e02, KEY_2 },
77 	{ 0x1e03, KEY_3 },
78 
79 	{ 0x1e04, KEY_4 },
80 	{ 0x1e05, KEY_5 },
81 	{ 0x1e06, KEY_6 },
82 
83 	{ 0x1e07, KEY_7 },
84 	{ 0x1e08, KEY_8 },
85 	{ 0x1e09, KEY_9 },
86 
87 	{ 0x1e0a, KEY_TEXT },		/* keypad asterisk as well */
88 	{ 0x1e00, KEY_0 },
89 	{ 0x1e0e, KEY_SUBTITLE },	/* also the Pound key (#) */
90 
91 	{ 0x1e0b, KEY_RED },		/* red button */
92 	{ 0x1e2e, KEY_GREEN },		/* green button */
93 	{ 0x1e38, KEY_YELLOW },		/* yellow key */
94 	{ 0x1e29, KEY_BLUE },		/* blue key */
95 
96 	/*
97 	 * Old Remote Controller Hauppauge Gray with a golden screen
98 	 * Keycodes start with address = 0x1f
99 	 */
100 	{ 0x1f3d, KEY_POWER2 },		/* system power (green button) */
101 	{ 0x1f3b, KEY_SELECT },		/* GO */
102 
103 	/* Keys 0 to 9 */
104 	{ 0x1f00, KEY_0 },
105 	{ 0x1f01, KEY_1 },
106 	{ 0x1f02, KEY_2 },
107 	{ 0x1f03, KEY_3 },
108 	{ 0x1f04, KEY_4 },
109 	{ 0x1f05, KEY_5 },
110 	{ 0x1f06, KEY_6 },
111 	{ 0x1f07, KEY_7 },
112 	{ 0x1f08, KEY_8 },
113 	{ 0x1f09, KEY_9 },
114 
115 	{ 0x1f1f, KEY_EXIT },		/* back/exit */
116 	{ 0x1f0d, KEY_MENU },
117 
118 	{ 0x1f10, KEY_VOLUMEUP },
119 	{ 0x1f11, KEY_VOLUMEDOWN },
120 	{ 0x1f20, KEY_CHANNELUP },	/* channel / program + */
121 	{ 0x1f21, KEY_CHANNELDOWN },	/* channel / program - */
122 	{ 0x1f25, KEY_ENTER },		/* OK */
123 
124 	{ 0x1f0b, KEY_RED },		/* red button */
125 	{ 0x1f2e, KEY_GREEN },		/* green button */
126 	{ 0x1f38, KEY_YELLOW },		/* yellow key */
127 	{ 0x1f29, KEY_BLUE },		/* blue key */
128 
129 	{ 0x1f0f, KEY_MUTE },
130 	{ 0x1f0c, KEY_RADIO },		/* There's no indicator on this key */
131 	{ 0x1f3c, KEY_ZOOM },		/* full */
132 
133 	{ 0x1f32, KEY_REWIND },		/* backward << */
134 	{ 0x1f35, KEY_PLAY },
135 	{ 0x1f34, KEY_FASTFORWARD },	/* forward >> */
136 
137 	{ 0x1f37, KEY_RECORD },		/* recording */
138 	{ 0x1f36, KEY_STOP },
139 	{ 0x1f30, KEY_PAUSE },		/* pause */
140 
141 	{ 0x1f24, KEY_PREVIOUSSONG },	/* replay |< */
142 	{ 0x1f1e, KEY_NEXTSONG },	/* skip >| */
143 
144 	/*
145 	 * Keycodes for DSR-0112 remote bundled with Haupauge MiniStick
146 	 * Keycodes start with address = 0x1d
147 	 */
148 	{ 0x1d00, KEY_0 },
149 	{ 0x1d01, KEY_1 },
150 	{ 0x1d02, KEY_2 },
151 	{ 0x1d03, KEY_3 },
152 	{ 0x1d04, KEY_4 },
153 	{ 0x1d05, KEY_5 },
154 	{ 0x1d06, KEY_6 },
155 	{ 0x1d07, KEY_7 },
156 	{ 0x1d08, KEY_8 },
157 	{ 0x1d09, KEY_9 },
158 	{ 0x1d0a, KEY_TEXT },
159 	{ 0x1d0d, KEY_MENU },
160 	{ 0x1d0f, KEY_MUTE },
161 	{ 0x1d10, KEY_VOLUMEUP },
162 	{ 0x1d11, KEY_VOLUMEDOWN },
163 	{ 0x1d12, KEY_PREVIOUS },        /* Prev.Ch .. ??? */
164 	{ 0x1d14, KEY_UP },
165 	{ 0x1d15, KEY_DOWN },
166 	{ 0x1d16, KEY_LEFT },
167 	{ 0x1d17, KEY_RIGHT },
168 	{ 0x1d1c, KEY_TV },
169 	{ 0x1d1e, KEY_NEXT },           /* >|             */
170 	{ 0x1d1f, KEY_EXIT },
171 	{ 0x1d20, KEY_CHANNELUP },
172 	{ 0x1d21, KEY_CHANNELDOWN },
173 	{ 0x1d24, KEY_LAST },           /* <|             */
174 	{ 0x1d25, KEY_OK },
175 	{ 0x1d30, KEY_PAUSE },
176 	{ 0x1d32, KEY_REWIND },
177 	{ 0x1d34, KEY_FASTFORWARD },
178 	{ 0x1d35, KEY_PLAY },
179 	{ 0x1d36, KEY_STOP },
180 	{ 0x1d37, KEY_RECORD },
181 	{ 0x1d3b, KEY_GOTO },
182 	{ 0x1d3d, KEY_POWER },
183 	{ 0x1d3f, KEY_HOME },
184 
185 	/*
186 	 * Keycodes for PT# R-005 remote bundled with Haupauge HVR-930C
187 	 * Keycodes start with address = 0x1c
188 	 */
189 	{ 0x1c3b, KEY_GOTO },
190 	{ 0x1c3d, KEY_POWER },
191 
192 	{ 0x1c14, KEY_UP },
193 	{ 0x1c15, KEY_DOWN },
194 	{ 0x1c16, KEY_LEFT },
195 	{ 0x1c17, KEY_RIGHT },
196 	{ 0x1c25, KEY_OK },
197 
198 	{ 0x1c00, KEY_0 },
199 	{ 0x1c01, KEY_1 },
200 	{ 0x1c02, KEY_2 },
201 	{ 0x1c03, KEY_3 },
202 	{ 0x1c04, KEY_4 },
203 	{ 0x1c05, KEY_5 },
204 	{ 0x1c06, KEY_6 },
205 	{ 0x1c07, KEY_7 },
206 	{ 0x1c08, KEY_8 },
207 	{ 0x1c09, KEY_9 },
208 
209 	{ 0x1c1f, KEY_EXIT },	/* BACK */
210 	{ 0x1c0d, KEY_MENU },
211 	{ 0x1c1c, KEY_TV },
212 
213 	{ 0x1c10, KEY_VOLUMEUP },
214 	{ 0x1c11, KEY_VOLUMEDOWN },
215 
216 	{ 0x1c20, KEY_CHANNELUP },
217 	{ 0x1c21, KEY_CHANNELDOWN },
218 
219 	{ 0x1c0f, KEY_MUTE },
220 	{ 0x1c12, KEY_PREVIOUS }, /* Prev */
221 
222 	{ 0x1c36, KEY_STOP },
223 	{ 0x1c37, KEY_RECORD },
224 
225 	{ 0x1c24, KEY_LAST },           /* <|             */
226 	{ 0x1c1e, KEY_NEXT },           /* >|             */
227 
228 	{ 0x1c0a, KEY_TEXT },
229 	{ 0x1c0e, KEY_SUBTITLE },	/* CC */
230 
231 	{ 0x1c32, KEY_REWIND },
232 	{ 0x1c30, KEY_PAUSE },
233 	{ 0x1c35, KEY_PLAY },
234 	{ 0x1c34, KEY_FASTFORWARD },
235 
236 	/*
237 	 * Keycodes for the old Black Remote Controller
238 	 * This one also uses RC-5 protocol
239 	 * Keycodes start with address = 0x00
240 	 */
241 	{ 0x001f, KEY_TV },
242 	{ 0x0020, KEY_CHANNELUP },
243 	{ 0x000c, KEY_RADIO },
244 
245 	{ 0x0011, KEY_VOLUMEDOWN },
246 	{ 0x002e, KEY_ZOOM },		/* full screen */
247 	{ 0x0010, KEY_VOLUMEUP },
248 
249 	{ 0x000d, KEY_MUTE },
250 	{ 0x0021, KEY_CHANNELDOWN },
251 	{ 0x0022, KEY_VIDEO },		/* source */
252 
253 	{ 0x0001, KEY_1 },
254 	{ 0x0002, KEY_2 },
255 	{ 0x0003, KEY_3 },
256 
257 	{ 0x0004, KEY_4 },
258 	{ 0x0005, KEY_5 },
259 	{ 0x0006, KEY_6 },
260 
261 	{ 0x0007, KEY_7 },
262 	{ 0x0008, KEY_8 },
263 	{ 0x0009, KEY_9 },
264 
265 	{ 0x001e, KEY_RED },	/* Reserved */
266 	{ 0x0000, KEY_0 },
267 	{ 0x0026, KEY_SLEEP },	/* Minimize */
268 };
269 
270 static struct rc_map_list rc5_hauppauge_new_map = {
271 	.map = {
272 		.scan    = rc5_hauppauge_new,
273 		.size    = ARRAY_SIZE(rc5_hauppauge_new),
274 		.rc_type = RC_TYPE_RC5,
275 		.name    = RC_MAP_HAUPPAUGE,
276 	}
277 };
278 
279 static int __init init_rc_map_rc5_hauppauge_new(void)
280 {
281 	return rc_map_register(&rc5_hauppauge_new_map);
282 }
283 
284 static void __exit exit_rc_map_rc5_hauppauge_new(void)
285 {
286 	rc_map_unregister(&rc5_hauppauge_new_map);
287 }
288 
289 module_init(init_rc_map_rc5_hauppauge_new)
290 module_exit(exit_rc_map_rc5_hauppauge_new)
291 
292 MODULE_LICENSE("GPL");
293 MODULE_AUTHOR("Mauro Carvalho Chehab");
294