aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/i2c/ir-kbd-i2c.c90
-rw-r--r--drivers/media/pci/bt8xx/bttv-input.c8
-rw-r--r--drivers/media/pci/cx88/cx88-input.c8
-rw-r--r--drivers/media/pci/ivtv/ivtv-i2c.c9
-rw-r--r--drivers/media/pci/saa7134/saa7134-input.c76
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-input.c20
-rw-r--r--include/media/ir-kbd-i2c.h6
-rw-r--r--include/media/rc-map.h10
8 files changed, 127 insertions, 100 deletions
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index c8fe1358ec9e..143cb2b26c46 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -62,8 +62,8 @@ module_param(debug, int, 0644); /* debug level (0,1,2) */
62 62
63/* ----------------------------------------------------------------------- */ 63/* ----------------------------------------------------------------------- */
64 64
65static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, 65static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol,
66 int size, int offset) 66 u32 *scancode, u8 *ptoggle, int size, int offset)
67{ 67{
68 unsigned char buf[6]; 68 unsigned char buf[6];
69 int start, range, toggle, dev, code, ircode; 69 int start, range, toggle, dev, code, ircode;
@@ -86,19 +86,10 @@ static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw,
86 if (!start) 86 if (!start)
87 /* no key pressed */ 87 /* no key pressed */
88 return 0; 88 return 0;
89 /* 89
90 * Hauppauge remotes (black/silver) always use 90 /* filter out invalid key presses */
91 * specific device ids. If we do not filter the 91 ircode = (start << 12) | (toggle << 11) | (dev << 6) | code;
92 * device ids then messages destined for devices 92 if ((ircode & 0x1fff) == 0x1fff)
93 * such as TVs (id=0) will get through causing
94 * mis-fired events.
95 *
96 * We also filter out invalid key presses which
97 * produce annoying debug log entries.
98 */
99 ircode= (start << 12) | (toggle << 11) | (dev << 6) | code;
100 if ((ircode & 0x1fff)==0x1fff)
101 /* invalid key press */
102 return 0; 93 return 0;
103 94
104 if (!range) 95 if (!range)
@@ -107,18 +98,20 @@ static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw,
107 dprintk(1,"ir hauppauge (rc5): s%d r%d t%d dev=%d code=%d\n", 98 dprintk(1,"ir hauppauge (rc5): s%d r%d t%d dev=%d code=%d\n",
108 start, range, toggle, dev, code); 99 start, range, toggle, dev, code);
109 100
110 /* return key */ 101 *protocol = RC_TYPE_RC5;
111 *ir_key = (dev << 8) | code; 102 *scancode = RC_SCANCODE_RC5(dev, code);
112 *ir_raw = ircode; 103 *ptoggle = toggle;
113 return 1; 104 return 1;
114} 105}
115 106
116static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 107static int get_key_haup(struct IR_i2c *ir, enum rc_type *protocol,
108 u32 *scancode, u8 *toggle)
117{ 109{
118 return get_key_haup_common (ir, ir_key, ir_raw, 3, 0); 110 return get_key_haup_common (ir, protocol, scancode, toggle, 3, 0);
119} 111}
120 112
121static int get_key_haup_xvr(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 113static int get_key_haup_xvr(struct IR_i2c *ir, enum rc_type *protocol,
114 u32 *scancode, u8 *toggle)
122{ 115{
123 int ret; 116 int ret;
124 unsigned char buf[1] = { 0 }; 117 unsigned char buf[1] = { 0 };
@@ -133,10 +126,11 @@ static int get_key_haup_xvr(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
133 if (ret != 1) 126 if (ret != 1)
134 return (ret < 0) ? ret : -EINVAL; 127 return (ret < 0) ? ret : -EINVAL;
135 128
136 return get_key_haup_common (ir, ir_key, ir_raw, 6, 3); 129 return get_key_haup_common(ir, protocol, scancode, toggle, 6, 3);
137} 130}
138 131
139static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 132static int get_key_pixelview(struct IR_i2c *ir, enum rc_type *protocol,
133 u32 *scancode, u8 *toggle)
140{ 134{
141 unsigned char b; 135 unsigned char b;
142 136
@@ -145,12 +139,15 @@ static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
145 dprintk(1,"read error\n"); 139 dprintk(1,"read error\n");
146 return -EIO; 140 return -EIO;
147 } 141 }
148 *ir_key = b; 142
149 *ir_raw = b; 143 *protocol = RC_TYPE_OTHER;
144 *scancode = b;
145 *toggle = 0;
150 return 1; 146 return 1;
151} 147}
152 148
153static int get_key_fusionhdtv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 149static int get_key_fusionhdtv(struct IR_i2c *ir, enum rc_type *protocol,
150 u32 *scancode, u8 *toggle)
154{ 151{
155 unsigned char buf[4]; 152 unsigned char buf[4];
156 153
@@ -168,13 +165,14 @@ static int get_key_fusionhdtv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
168 if(buf[0] != 0x1 || buf[1] != 0xfe) 165 if(buf[0] != 0x1 || buf[1] != 0xfe)
169 return 0; 166 return 0;
170 167
171 *ir_key = buf[2]; 168 *protocol = RC_TYPE_UNKNOWN;
172 *ir_raw = (buf[2] << 8) | buf[3]; 169 *scancode = buf[2];
173 170 *toggle = 0;
174 return 1; 171 return 1;
175} 172}
176 173
177static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 174static int get_key_knc1(struct IR_i2c *ir, enum rc_type *protocol,
175 u32 *scancode, u8 *toggle)
178{ 176{
179 unsigned char b; 177 unsigned char b;
180 178
@@ -197,13 +195,14 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
197 /* keep old data */ 195 /* keep old data */
198 return 1; 196 return 1;
199 197
200 *ir_key = b; 198 *protocol = RC_TYPE_UNKNOWN;
201 *ir_raw = b; 199 *scancode = b;
200 *toggle = 0;
202 return 1; 201 return 1;
203} 202}
204 203
205static int get_key_avermedia_cardbus(struct IR_i2c *ir, 204static int get_key_avermedia_cardbus(struct IR_i2c *ir, enum rc_type *protocol,
206 u32 *ir_key, u32 *ir_raw) 205 u32 *scancode, u8 *toggle)
207{ 206{
208 unsigned char subaddr, key, keygroup; 207 unsigned char subaddr, key, keygroup;
209 struct i2c_msg msg[] = { { .addr = ir->c->addr, .flags = 0, 208 struct i2c_msg msg[] = { { .addr = ir->c->addr, .flags = 0,
@@ -237,12 +236,11 @@ static int get_key_avermedia_cardbus(struct IR_i2c *ir,
237 } 236 }
238 key |= (keygroup & 1) << 6; 237 key |= (keygroup & 1) << 6;
239 238
240 *ir_key = key; 239 *protocol = RC_TYPE_UNKNOWN;
241 *ir_raw = key; 240 *scancode = key;
242 if (!strcmp(ir->ir_codes, RC_MAP_AVERMEDIA_M733A_RM_K6)) { 241 if (ir->c->addr == 0x41) /* AVerMedia EM78P153 */
243 *ir_key |= keygroup << 8; 242 *scancode |= keygroup << 8;
244 *ir_raw |= keygroup << 8; 243 *toggle = 0;
245 }
246 return 1; 244 return 1;
247} 245}
248 246
@@ -250,19 +248,21 @@ static int get_key_avermedia_cardbus(struct IR_i2c *ir,
250 248
251static int ir_key_poll(struct IR_i2c *ir) 249static int ir_key_poll(struct IR_i2c *ir)
252{ 250{
253 static u32 ir_key, ir_raw; 251 enum rc_type protocol;
252 u32 scancode;
253 u8 toggle;
254 int rc; 254 int rc;
255 255
256 dprintk(3, "%s\n", __func__); 256 dprintk(3, "%s\n", __func__);
257 rc = ir->get_key(ir, &ir_key, &ir_raw); 257 rc = ir->get_key(ir, &protocol, &scancode, &toggle);
258 if (rc < 0) { 258 if (rc < 0) {
259 dprintk(2,"error\n"); 259 dprintk(2,"error\n");
260 return rc; 260 return rc;
261 } 261 }
262 262
263 if (rc) { 263 if (rc) {
264 dprintk(1, "%s: keycode = 0x%04x\n", __func__, ir_key); 264 dprintk(1, "%s: scancode = 0x%08x\n", __func__, scancode);
265 rc_keydown(ir->rc, ir_key, 0); 265 rc_keydown(ir->rc, scancode, toggle);
266 } 266 }
267 return 0; 267 return 0;
268} 268}
@@ -327,7 +327,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
327 case 0x6b: 327 case 0x6b:
328 name = "FusionHDTV"; 328 name = "FusionHDTV";
329 ir->get_key = get_key_fusionhdtv; 329 ir->get_key = get_key_fusionhdtv;
330 rc_type = RC_BIT_RC5; 330 rc_type = RC_BIT_UNKNOWN;
331 ir_codes = RC_MAP_FUSIONHDTV_MCE; 331 ir_codes = RC_MAP_FUSIONHDTV_MCE;
332 break; 332 break;
333 case 0x40: 333 case 0x40:
diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c
index ffc0ee1d848b..e745f5a04a40 100644
--- a/drivers/media/pci/bt8xx/bttv-input.c
+++ b/drivers/media/pci/bt8xx/bttv-input.c
@@ -336,7 +336,8 @@ static void bttv_ir_stop(struct bttv *btv)
336 * Get_key functions used by I2C remotes 336 * Get_key functions used by I2C remotes
337 */ 337 */
338 338
339static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 339static int get_key_pv951(struct IR_i2c *ir, enum rc_type *protocol,
340 u32 *scancode, u8 *toggle)
340{ 341{
341 unsigned char b; 342 unsigned char b;
342 343
@@ -363,8 +364,9 @@ static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
363 * the device is bound to the vendor-provided RC. 364 * the device is bound to the vendor-provided RC.
364 */ 365 */
365 366
366 *ir_key = b; 367 *protocol = RC_TYPE_UNKNOWN;
367 *ir_raw = b; 368 *scancode = b;
369 *toggle = 0;
368 return 1; 370 return 1;
369} 371}
370 372
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index f991696a6c59..779fc630327a 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -539,7 +539,8 @@ void cx88_ir_irq(struct cx88_core *core)
539 ir_raw_event_handle(ir->dev); 539 ir_raw_event_handle(ir->dev);
540} 540}
541 541
542static int get_key_pvr2000(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 542static int get_key_pvr2000(struct IR_i2c *ir, enum rc_type *protocol,
543 u32 *scancode, u8 *toggle)
543{ 544{
544 int flags, code; 545 int flags, code;
545 546
@@ -563,8 +564,9 @@ static int get_key_pvr2000(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
563 dprintk("IR Key/Flags: (0x%02x/0x%02x)\n", 564 dprintk("IR Key/Flags: (0x%02x/0x%02x)\n",
564 code & 0xff, flags & 0xff); 565 code & 0xff, flags & 0xff);
565 566
566 *ir_key = code & 0xff; 567 *protocol = RC_TYPE_UNKNOWN;
567 *ir_raw = code; 568 *scancode = code & 0xff;
569 *toggle = 0;
568 return 1; 570 return 1;
569} 571}
570 572
diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c
index ceed2d87abfd..1a41ba5c7d30 100644
--- a/drivers/media/pci/ivtv/ivtv-i2c.c
+++ b/drivers/media/pci/ivtv/ivtv-i2c.c
@@ -148,7 +148,8 @@ static const char * const hw_devicenames[] = {
148 "ir_video", /* IVTV_HW_I2C_IR_RX_ADAPTEC */ 148 "ir_video", /* IVTV_HW_I2C_IR_RX_ADAPTEC */
149}; 149};
150 150
151static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 151static int get_key_adaptec(struct IR_i2c *ir, enum rc_type *protocol,
152 u32 *scancode, u8 *toggle)
152{ 153{
153 unsigned char keybuf[4]; 154 unsigned char keybuf[4];
154 155
@@ -167,9 +168,9 @@ static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
167 keybuf[2] &= 0x7f; 168 keybuf[2] &= 0x7f;
168 keybuf[3] |= 0x80; 169 keybuf[3] |= 0x80;
169 170
170 *ir_key = keybuf[3] | keybuf[2] << 8 | keybuf[1] << 16 |keybuf[0] << 24; 171 *protocol = RC_TYPE_UNKNOWN;
171 *ir_raw = *ir_key; 172 *scancode = keybuf[3] | keybuf[2] << 8 | keybuf[1] << 16 |keybuf[0] << 24;
172 173 *toggle = 0;
173 return 1; 174 return 1;
174} 175}
175 176
diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
index 6f4312663bdf..73670ed7156b 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -108,7 +108,8 @@ static int build_key(struct saa7134_dev *dev)
108 108
109/* --------------------- Chip specific I2C key builders ----------------- */ 109/* --------------------- Chip specific I2C key builders ----------------- */
110 110
111static int get_key_flydvb_trio(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 111static int get_key_flydvb_trio(struct IR_i2c *ir, enum rc_type *protocol,
112 u32 *scancode, u8 *toggle)
112{ 113{
113 int gpio; 114 int gpio;
114 int attempt = 0; 115 int attempt = 0;
@@ -158,13 +159,14 @@ static int get_key_flydvb_trio(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
158 return -EIO; 159 return -EIO;
159 } 160 }
160 161
161 *ir_key = b; 162 *protocol = RC_TYPE_UNKNOWN;
162 *ir_raw = b; 163 *scancode = b;
164 *toggle = 0;
163 return 1; 165 return 1;
164} 166}
165 167
166static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, 168static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, enum rc_type *protocol,
167 u32 *ir_raw) 169 u32 *scancode, u8 *toggle)
168{ 170{
169 unsigned char b; 171 unsigned char b;
170 int gpio; 172 int gpio;
@@ -205,14 +207,15 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key,
205 /* Button pressed */ 207 /* Button pressed */
206 208
207 dprintk("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b); 209 dprintk("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b);
208 *ir_key = b; 210 *protocol = RC_TYPE_UNKNOWN;
209 *ir_raw = b; 211 *scancode = b;
212 *toggle = 0;
210 return 1; 213 return 1;
211} 214}
212 215
213/* copied and modified from get_key_msi_tvanywhere_plus() */ 216/* copied and modified from get_key_msi_tvanywhere_plus() */
214static int get_key_kworld_pc150u(struct IR_i2c *ir, u32 *ir_key, 217static int get_key_kworld_pc150u(struct IR_i2c *ir, enum rc_type *protocol,
215 u32 *ir_raw) 218 u32 *scancode, u8 *toggle)
216{ 219{
217 unsigned char b; 220 unsigned char b;
218 unsigned int gpio; 221 unsigned int gpio;
@@ -253,12 +256,14 @@ static int get_key_kworld_pc150u(struct IR_i2c *ir, u32 *ir_key,
253 /* Button pressed */ 256 /* Button pressed */
254 257
255 dprintk("get_key_kworld_pc150u: Key = 0x%02X\n", b); 258 dprintk("get_key_kworld_pc150u: Key = 0x%02X\n", b);
256 *ir_key = b; 259 *protocol = RC_TYPE_UNKNOWN;
257 *ir_raw = b; 260 *scancode = b;
261 *toggle = 0;
258 return 1; 262 return 1;
259} 263}
260 264
261static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 265static int get_key_purpletv(struct IR_i2c *ir, enum rc_type *protocol,
266 u32 *scancode, u8 *toggle)
262{ 267{
263 unsigned char b; 268 unsigned char b;
264 269
@@ -276,12 +281,14 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
276 if (b & 0x80) 281 if (b & 0x80)
277 return 1; 282 return 1;
278 283
279 *ir_key = b; 284 *protocol = RC_TYPE_UNKNOWN;
280 *ir_raw = b; 285 *scancode = b;
286 *toggle = 0;
281 return 1; 287 return 1;
282} 288}
283 289
284static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 290static int get_key_hvr1110(struct IR_i2c *ir, enum rc_type *protocol,
291 u32 *scancode, u8 *toggle)
285{ 292{
286 unsigned char buf[5]; 293 unsigned char buf[5];
287 294
@@ -299,14 +306,20 @@ static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
299 * by preserving it into two separate readings 306 * by preserving it into two separate readings
300 * buf[4] bits 0 and 1, and buf[1] and buf[2] are always 307 * buf[4] bits 0 and 1, and buf[1] and buf[2] are always
301 * zero. 308 * zero.
309 *
310 * Note that the keymap which the hvr1110 uses is RC5.
311 *
312 * FIXME: start bits could maybe be used...?
302 */ 313 */
303 *ir_key = 0x1fff & ((buf[3] << 8) | (buf[4] >> 2)); 314 *protocol = RC_TYPE_RC5;
304 *ir_raw = *ir_key; 315 *scancode = RC_SCANCODE_RC5(buf[3] & 0x1f, buf[4] >> 2);
316 *toggle = !!(buf[3] & 0x40);
305 return 1; 317 return 1;
306} 318}
307 319
308 320
309static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 321static int get_key_beholdm6xx(struct IR_i2c *ir, enum rc_type *protocol,
322 u32 *scancode, u8 *toggle)
310{ 323{
311 unsigned char data[12]; 324 unsigned char data[12];
312 u32 gpio; 325 u32 gpio;
@@ -332,17 +345,18 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
332 if (data[9] != (unsigned char)(~data[8])) 345 if (data[9] != (unsigned char)(~data[8]))
333 return 0; 346 return 0;
334 347
335 *ir_raw = ((data[10] << 16) | (data[11] << 8) | (data[9] << 0)); 348 *protocol = RC_TYPE_NEC;
336 *ir_key = *ir_raw; 349 *scancode = RC_SCANCODE_NECX(((data[10] << 8) | data[11]), data[9]);
337 350 *toggle = 0;
338 return 1; 351 return 1;
339} 352}
340 353
341/* Common (grey or coloured) pinnacle PCTV remote handling 354/* Common (grey or coloured) pinnacle PCTV remote handling
342 * 355 *
343 */ 356 */
344static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, 357static int get_key_pinnacle(struct IR_i2c *ir, enum rc_type *protocol,
345 int parity_offset, int marker, int code_modulo) 358 u32 *scancode, u8 *toggle, int parity_offset,
359 int marker, int code_modulo)
346{ 360{
347 unsigned char b[4]; 361 unsigned char b[4];
348 unsigned int start = 0,parity = 0,code = 0; 362 unsigned int start = 0,parity = 0,code = 0;
@@ -377,11 +391,11 @@ static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw,
377 391
378 code %= code_modulo; 392 code %= code_modulo;
379 393
380 *ir_raw = code; 394 *protocol = RC_TYPE_UNKNOWN;
381 *ir_key = code; 395 *scancode = code;
396 *toggle = 0;
382 397
383 i2cdprintk("Pinnacle PCTV key %02x\n", code); 398 i2cdprintk("Pinnacle PCTV key %02x\n", code);
384
385 return 1; 399 return 1;
386} 400}
387 401
@@ -394,10 +408,11 @@ static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw,
394 * 408 *
395 * Sylvain Pasche <sylvain.pasche@gmail.com> 409 * Sylvain Pasche <sylvain.pasche@gmail.com>
396 */ 410 */
397static int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 411static int get_key_pinnacle_grey(struct IR_i2c *ir, enum rc_type *protocol,
412 u32 *scancode, u8 *toggle)
398{ 413{
399 414
400 return get_key_pinnacle(ir, ir_key, ir_raw, 1, 0xfe, 0xff); 415 return get_key_pinnacle(ir, protocol, scancode, toggle, 1, 0xfe, 0xff);
401} 416}
402 417
403 418
@@ -405,7 +420,8 @@ static int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
405 * 420 *
406 * Ricardo Cerqueira <v4l@cerqueira.org> 421 * Ricardo Cerqueira <v4l@cerqueira.org>
407 */ 422 */
408static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 423static int get_key_pinnacle_color(struct IR_i2c *ir, enum rc_type *protocol,
424 u32 *scancode, u8 *toggle)
409{ 425{
410 /* code_modulo parameter (0x88) is used to reduce code value to fit inside IR_KEYTAB_SIZE 426 /* code_modulo parameter (0x88) is used to reduce code value to fit inside IR_KEYTAB_SIZE
411 * 427 *
@@ -413,7 +429,7 @@ static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
413 * codes < 128 429 * codes < 128
414 */ 430 */
415 431
416 return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88); 432 return get_key_pinnacle(ir, protocol, scancode, toggle, 2, 0x80, 0x88);
417} 433}
418 434
419void saa7134_input_irq(struct saa7134_dev *dev) 435void saa7134_input_irq(struct saa7134_dev *dev)
diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c
index 46d52fac8680..adcdd92179b2 100644
--- a/drivers/media/usb/cx231xx/cx231xx-input.c
+++ b/drivers/media/usb/cx231xx/cx231xx-input.c
@@ -21,11 +21,12 @@
21#include "cx231xx.h" 21#include "cx231xx.h"
22#include <linux/usb.h> 22#include <linux/usb.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/bitrev.h>
24 25
25#define MODULE_NAME "cx231xx-input" 26#define MODULE_NAME "cx231xx-input"
26 27
27static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key, 28static int get_key_isdbt(struct IR_i2c *ir, enum rc_type *protocol,
28 u32 *ir_raw) 29 u32 *pscancode, u8 *toggle)
29{ 30{
30 int rc; 31 int rc;
31 u8 cmd, scancode; 32 u8 cmd, scancode;
@@ -46,21 +47,14 @@ static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key,
46 if (cmd == 0xff) 47 if (cmd == 0xff)
47 return 0; 48 return 0;
48 49
49 scancode = 50 scancode = bitrev8(cmd);
50 ((cmd & 0x01) ? 0x80 : 0) |
51 ((cmd & 0x02) ? 0x40 : 0) |
52 ((cmd & 0x04) ? 0x20 : 0) |
53 ((cmd & 0x08) ? 0x10 : 0) |
54 ((cmd & 0x10) ? 0x08 : 0) |
55 ((cmd & 0x20) ? 0x04 : 0) |
56 ((cmd & 0x40) ? 0x02 : 0) |
57 ((cmd & 0x80) ? 0x01 : 0);
58 51
59 dev_dbg(&ir->rc->input_dev->dev, "cmd %02x, scan = %02x\n", 52 dev_dbg(&ir->rc->input_dev->dev, "cmd %02x, scan = %02x\n",
60 cmd, scancode); 53 cmd, scancode);
61 54
62 *ir_key = scancode; 55 *protocol = RC_TYPE_OTHER;
63 *ir_raw = scancode; 56 *pscancode = scancode;
57 *toggle = 0;
64 return 1; 58 return 1;
65} 59}
66 60
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index e221bc74020b..d8564354debb 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -20,7 +20,8 @@ struct IR_i2c {
20 struct delayed_work work; 20 struct delayed_work work;
21 char name[32]; 21 char name[32];
22 char phys[32]; 22 char phys[32];
23 int (*get_key)(struct IR_i2c*, u32*, u32*); 23 int (*get_key)(struct IR_i2c *ir, enum rc_type *protocol,
24 u32 *scancode, u8 *toggle);
24}; 25};
25 26
26enum ir_kbd_get_key_fn { 27enum ir_kbd_get_key_fn {
@@ -44,7 +45,8 @@ struct IR_i2c_init_data {
44 * Specify either a function pointer or a value indicating one of 45 * Specify either a function pointer or a value indicating one of
45 * ir_kbd_i2c's internal get_key functions 46 * ir_kbd_i2c's internal get_key functions
46 */ 47 */
47 int (*get_key)(struct IR_i2c*, u32*, u32*); 48 int (*get_key)(struct IR_i2c *ir, enum rc_type *protocol,
49 u32 *scancode, u8 *toggle);
48 enum ir_kbd_get_key_fn internal_get_key_func; 50 enum ir_kbd_get_key_fn internal_get_key_func;
49 51
50 struct rc_dev *rc_dev; 52 struct rc_dev *rc_dev;
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e5aa2409c0ea..894c7e4c409b 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -62,6 +62,16 @@ enum rc_type {
62 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ 62 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \
63 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP) 63 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP)
64 64
65#define RC_SCANCODE_UNKNOWN(x) (x)
66#define RC_SCANCODE_OTHER(x) (x)
67#define RC_SCANCODE_NEC(addr, cmd) (((addr) << 8) | (cmd))
68#define RC_SCANCODE_NECX(addr, cmd) (((addr) << 8) | (cmd))
69#define RC_SCANCODE_NEC32(data) ((data) & 0xffffffff)
70#define RC_SCANCODE_RC5(sys, cmd) (((sys) << 8) | (cmd))
71#define RC_SCANCODE_RC5_SZ(sys, cmd) (((sys) << 8) | (cmd))
72#define RC_SCANCODE_RC6_0(sys, cmd) (((sys) << 8) | (cmd))
73#define RC_SCANCODE_RC6_6A(vendor, sys, cmd) (((vendor) << 16) | ((sys) << 8) | (cmd))
74
65struct rc_map_table { 75struct rc_map_table {
66 u32 scancode; 76 u32 scancode;
67 u32 keycode; 77 u32 keycode;