diff options
author | Darron Broad <darron@kewl.org> | 2008-09-21 23:54:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:37:06 -0400 |
commit | 34c080295af9b3ed9f704a881e07eb5ac128e1ed (patch) | |
tree | af525a9735fbc138e2466f840e0d10f369600429 | |
parent | 681faa0b7a1d67576df07e0ad55ca42b2eab174a (diff) |
V4L/DVB (9016): HVR3000/4000 Hauppauge related IR cleanups
From the author:
This patch-set fixes remote control issues I have experienced
with hauppauge drivers in Linux since the PVR-350 and now
with both a NOVA-S+ and HVR-4000. It has also been confirmed
to work with an HVR-1300 user who had exactly the same issue.
Hauppage remote controls use RC5. RC5 has a bit-field which
represents the target device. The hauppauge windows drivers
have a registry key which can enable filtering, but the linux
drivers will accept any target device in this bit field for
internal processing.
This causes problems with setups such as mythtv where remote
control key presses destined for the TV (target = 0) are
interpreted by the kernel and subsequenctly LIRC then mythtv.
Of the remote controls I have to hand (wintv black, pvr/hvr
silver) the hauppauge remotes send one of two device targets
ids, these are interpreted by the patch which then filters
out any non hauppauge addresses.
Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/cx88/cx88-input.c | 30 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 22 |
2 files changed, 48 insertions, 4 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 097081eb505f..13bc5d160761 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -394,7 +394,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
394 | { | 394 | { |
395 | struct cx88_IR *ir = core->ir; | 395 | struct cx88_IR *ir = core->ir; |
396 | u32 samples, ircode; | 396 | u32 samples, ircode; |
397 | int i; | 397 | int i, start, range, toggle, dev, code; |
398 | 398 | ||
399 | if (NULL == ir) | 399 | if (NULL == ir) |
400 | return; | 400 | return; |
@@ -463,11 +463,37 @@ void cx88_ir_irq(struct cx88_core *core) | |||
463 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: | 463 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
464 | case CX88_BOARD_HAUPPAUGE_HVR1100: | 464 | case CX88_BOARD_HAUPPAUGE_HVR1100: |
465 | case CX88_BOARD_HAUPPAUGE_HVR3000: | 465 | case CX88_BOARD_HAUPPAUGE_HVR3000: |
466 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: | ||
467 | case CX88_BOARD_HAUPPAUGE_HVR4000: | 466 | case CX88_BOARD_HAUPPAUGE_HVR4000: |
468 | case CX88_BOARD_HAUPPAUGE_HVR4000LITE: | 467 | case CX88_BOARD_HAUPPAUGE_HVR4000LITE: |
469 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); | 468 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); |
470 | ir_dprintk("biphase decoded: %x\n", ircode); | 469 | ir_dprintk("biphase decoded: %x\n", ircode); |
470 | /* | ||
471 | * RC5 has an extension bit which adds a new range | ||
472 | * of available codes, this is detected here. Also | ||
473 | * hauppauge remotes (black/silver) always use | ||
474 | * specific device ids. If we do not filter the | ||
475 | * device ids then messages destined for devices | ||
476 | * such as TVs (id=0) will get through to the | ||
477 | * device causing mis-fired events. | ||
478 | */ | ||
479 | /* split rc5 data block ... */ | ||
480 | start = (ircode & 0x2000) >> 13; | ||
481 | range = (ircode & 0x1000) >> 12; | ||
482 | toggle= (ircode & 0x0800) >> 11; | ||
483 | dev = (ircode & 0x07c0) >> 6; | ||
484 | code = (ircode & 0x003f) | ((range << 6) ^ 0x0040); | ||
485 | if( start != 1) | ||
486 | /* no key pressed */ | ||
487 | break; | ||
488 | if ( dev != 0x1e && dev != 0x1f ) | ||
489 | /* not a hauppauge remote */ | ||
490 | break; | ||
491 | ir_input_keydown(ir->input, &ir->ir, code, ircode); | ||
492 | ir->release = jiffies + msecs_to_jiffies(120); | ||
493 | break; | ||
494 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: | ||
495 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); | ||
496 | ir_dprintk("biphase decoded: %x\n", ircode); | ||
471 | if ((ircode & 0xfffff000) != 0x3000) | 497 | if ((ircode & 0xfffff000) != 0x3000) |
472 | break; | 498 | break; |
473 | ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode); | 499 | ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode); |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index a30254bed311..703195a5ad4e 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -65,7 +65,7 @@ static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, | |||
65 | int size, int offset) | 65 | int size, int offset) |
66 | { | 66 | { |
67 | unsigned char buf[6]; | 67 | unsigned char buf[6]; |
68 | int start, range, toggle, dev, code; | 68 | int start, range, toggle, dev, code, ircode; |
69 | 69 | ||
70 | /* poll IR chip */ | 70 | /* poll IR chip */ |
71 | if (size != i2c_master_recv(&ir->c,buf,size)) | 71 | if (size != i2c_master_recv(&ir->c,buf,size)) |
@@ -85,6 +85,24 @@ static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, | |||
85 | if (!start) | 85 | if (!start) |
86 | /* no key pressed */ | 86 | /* no key pressed */ |
87 | return 0; | 87 | return 0; |
88 | /* | ||
89 | * Hauppauge remotes (black/silver) always use | ||
90 | * specific device ids. If we do not filter the | ||
91 | * device ids then messages destined for devices | ||
92 | * such as TVs (id=0) will get through causing | ||
93 | * mis-fired events. | ||
94 | * | ||
95 | * We also filter out invalid key presses which | ||
96 | * produce annoying debug log entries. | ||
97 | */ | ||
98 | ircode= (start << 12) | (toggle << 11) | (dev << 6) | code; | ||
99 | if ((ircode & 0x1fff)==0x1fff) | ||
100 | /* invalid key press */ | ||
101 | return 0; | ||
102 | |||
103 | if (dev!=0x1e && dev!=0x1f) | ||
104 | /* not a hauppauge remote */ | ||
105 | return 0; | ||
88 | 106 | ||
89 | if (!range) | 107 | if (!range) |
90 | code += 64; | 108 | code += 64; |
@@ -94,7 +112,7 @@ static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, | |||
94 | 112 | ||
95 | /* return key */ | 113 | /* return key */ |
96 | *ir_key = code; | 114 | *ir_key = code; |
97 | *ir_raw = (start << 12) | (toggle << 11) | (dev << 6) | code; | 115 | *ir_raw = ircode; |
98 | return 1; | 116 | return 1; |
99 | } | 117 | } |
100 | 118 | ||