Re: [PATCH] cx88-input: filter IR codes by address forHauppauge cards, don't truncate name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



which snapshot are you using?  My July05 video4linux won't patch with this??


----- Original Message ----- From: "Darren Salt" <linux@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: <linux-dvb@xxxxxxxxxxx>
Sent: Saturday, April 01, 2006 10:37 AM
Subject: [PATCH] cx88-input: filter IR codes by address forHauppauge cards, don't truncate name


cx88-input: filter IR codes by address for Hauppauge cards, don't truncate name
From: Darren Salt <linux@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

This patch adds IR codes filtering by RC5 address for Hauppauge cards. For
now, I'm assuming that the remote control is an A415; this has address 0x1E,
which the card supplied in bits 6-10 of the value read from its IR
interface.

It also adds a parameter, ir_any_address. If this is non-zero, no IR address
checking is done.

The input device name buffer is enlarged to avoid truncation.

Signed-off-by: Darren Salt <linux@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

diff --git a/linux/drivers/media/video/cx88/cx88-input.c b/linux/drivers/media/video/cx88/cx88-input.c
--- a/linux/drivers/media/video/cx88/cx88-input.c Thu Mar 23 02:27:41 2006
+++ b/linux/drivers/media/video/cx88/cx88-input.c Thu Mar 23 17:11:18 2006
@@ -40,7 +40,7 @@
 struct cx88_core *core;
 struct input_dev *input;
 struct ir_input_state ir;
- char name[32];
+ char name[72];
 char phys[32];

 /* sample from gpio pin 16 */
@@ -64,6 +64,10 @@
module_param(ir_debug, int, 0644); /* debug level [IR] */
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");

+static int ir_any_address = 0;
+module_param(ir_any_address, int, 0644);
+MODULE_PARM_DESC(ir_any_address, "allow any address code [IR]");
+
#define ir_dprintk(fmt, arg...) if (ir_debug) \
 printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg)

@@ -172,7 +176,7 @@
 case CX88_BOARD_HAUPPAUGE_HVR1100:
 ir_codes = ir_codes_hauppauge_new;
 ir_type = IR_TYPE_RC5;
- ir->sampling = 1;
+ ir->sampling = (0x1E<<6) | 1; /* address in b6..10 of IR code */
 break;
 case CX88_BOARD_WINFAST2000XP_EXPERT:
 ir_codes = ir_codes_winfast;
@@ -364,7 +368,8 @@
 break;
 }

- if ((ircode & 0xffff) != (ir->sampling & 0xffff)) { /* wrong address */
+ if (!ir_any_address &&
+     (ircode & 0xffff) != (ir->sampling & 0xffff)) { /* wrong address */
 ir_dprintk("pulse distance decoded wrong address\n");
 break;
 }
@@ -387,6 +392,9 @@
 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
 ir_dprintk("biphase decoded: %x\n", ircode);
 if ((ircode & 0xfffff000) != 0x3000)
+ break;
+ if (!ir_any_address &&
+     ((ircode ^ ir->sampling) & (0x1F << 6)))
 break;
 ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode);
 ir->release = jiffies + msecs_to_jiffies(120);

--
| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
| + Output *more* particulate pollutants. BUFFER AGAINST GLOBAL WARMING.

"Bother", said Pooh, as he kicked hell out of his modem.

_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux