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