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

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

 



[Posted to both lists; followups not set.]

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. (Without this, input events can be generated when signals are
received from other remote controls, e.g. those for Philips TVs.)

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 -r bc20565a24a7 -r ce250a816b7e linux/drivers/media/video/cx88/cx88-input.c
--- a/linux/drivers/media/video/cx88/cx88-input.c	Sun Nov 26 10:47:07 2006 -0200
+++ b/linux/drivers/media/video/cx88/cx88-input.c	Tue Nov 28 15:21:11 2006 +0000
@@ -39,7 +39,7 @@ struct cx88_IR {
 	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 */
@@ -63,6 +63,10 @@ module_param(ir_debug, int, 0644);	/* de
 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)
 
@@ -227,7 +231,7 @@ int cx88_ir_init(struct cx88_core *core,
 	case CX88_BOARD_HAUPPAUGE_HVR3000:
 		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_WINFAST_DTV2000H:
 		ir_codes = ir_codes_winfast;
@@ -429,7 +433,8 @@ void cx88_ir_irq(struct cx88_core *core)
 			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;
 		}
@@ -455,6 +460,9 @@ void cx88_ir_irq(struct cx88_core *core)
 		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);
 		break;

-- 
| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
| + Lobby friends, family, business, government.    WE'RE KILLING THE PLANET.

This place has everything.

_______________________________________________
linux-dvb mailing list
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