public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] ir-kbd-i2c: Allow to disable Hauppauge filter through module parameter
@ 2010-01-17 18:26 Samuel Rakitnican
  2010-01-17 18:51 ` Samuel Rakitnican
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Rakitnican @ 2010-01-17 18:26 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

Some Hauppauge devices have id=0 so such devices won't work.
For such devices add a module parameter that allow to turn
off filtering.

Signed-off-by: Samuel Rakitničan <semiRocket@gmail.com>
-- 
Lorem ipsum

[-- Attachment #2: wintv-radio-ir.diff --]
[-- Type: application/octet-stream, Size: 1883 bytes --]

diff -r 82bbb3bd0f0a linux/drivers/media/video/ir-kbd-i2c.c
--- a/linux/drivers/media/video/ir-kbd-i2c.c	Mon Jan 11 11:47:33 2010 -0200
+++ b/linux/drivers/media/video/ir-kbd-i2c.c	Sat Jan 16 16:39:14 2010 +0100
@@ -61,6 +61,10 @@
 module_param(hauppauge, int, 0644);    /* Choose Hauppauge remote */
 MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)");
 
+static int haup_filter = 1;
+module_param(haup_filter, int, 0644);
+MODULE_PARM_DESC(haup_filter, "Hauppauge filter for other remotes, default is 1 (On)");
+
 
 #define DEVNAME "ir-kbd-i2c"
 #define dprintk(level, fmt, arg...)	if (debug >= level) \
@@ -96,24 +100,27 @@
 	if (!start)
 		/* no key pressed */
 		return 0;
-	/*
-	 * Hauppauge remotes (black/silver) always use
-	 * specific device ids. If we do not filter the
-	 * device ids then messages destined for devices
-	 * such as TVs (id=0) will get through causing
-	 * mis-fired events.
-	 *
-	 * We also filter out invalid key presses which
-	 * produce annoying debug log entries.
-	 */
-	ircode= (start << 12) | (toggle << 11) | (dev << 6) | code;
-	if ((ircode & 0x1fff)==0x1fff)
-		/* invalid key press */
-		return 0;
 
-	if (dev!=0x1e && dev!=0x1f)
-		/* not a hauppauge remote */
-		return 0;
+	if (haup_filter != 0) {
+		/*
+		 * Hauppauge remotes (black/silver) always use
+		 * specific device ids. If we do not filter the
+		 * device ids then messages destined for devices
+		 * such as TVs (id=0) will get through causing
+		 * mis-fired events.
+		 *
+		 * We also filter out invalid key presses which
+		 * produce annoying debug log entries.
+		 */
+		ircode = (start << 12) | (toggle << 11) | (dev << 6) | code;
+		if ((ircode & 0x1fff) == 0x1fff)
+			/* invalid key press */
+			return 0;
+
+		if (dev != 0x1e && dev != 0x1f)
+			/* not a hauppauge remote */
+			return 0;
+	}
 
 	if (!range)
 		code += 64;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RESEND PATCH] ir-kbd-i2c: Allow to disable Hauppauge filter through module parameter
  2010-01-17 18:26 [RESEND PATCH] ir-kbd-i2c: Allow to disable Hauppauge filter through module parameter Samuel Rakitnican
@ 2010-01-17 18:51 ` Samuel Rakitnican
  2010-02-03 11:05   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Rakitnican @ 2010-01-17 18:51 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media@vger.kernel.org

Some Hauppauge devices have id=0 so such devices won't work.
For such devices add a module parameter that allow to turn
off filtering.

Signed-off-by: Samuel Rakitničan <semiRocket@gmail.com>
---
diff -r 82bbb3bd0f0a linux/drivers/media/video/ir-kbd-i2c.c
--- a/linux/drivers/media/video/ir-kbd-i2c.c	Mon Jan 11 11:47:33 2010 -0200
+++ b/linux/drivers/media/video/ir-kbd-i2c.c	Sat Jan 16 16:39:14 2010 +0100
@@ -61,6 +61,10 @@
   module_param(hauppauge, int, 0644);    /* Choose Hauppauge remote */
   MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)");

+static int haup_filter = 1;
+module_param(haup_filter, int, 0644);
+MODULE_PARM_DESC(haup_filter, "Hauppauge filter for other remotes, default is 1 (On)");
+

   #define DEVNAME "ir-kbd-i2c"
   #define dprintk(level, fmt, arg...)	if (debug >= level) \
@@ -96,24 +100,27 @@
   	if (!start)
   		/* no key pressed */
   		return 0;
-	/*
-	 * Hauppauge remotes (black/silver) always use
-	 * specific device ids. If we do not filter the
-	 * device ids then messages destined for devices
-	 * such as TVs (id=0) will get through causing
-	 * mis-fired events.
-	 *
-	 * We also filter out invalid key presses which
-	 * produce annoying debug log entries.
-	 */
-	ircode= (start << 12) | (toggle << 11) | (dev << 6) | code;
-	if ((ircode & 0x1fff)==0x1fff)
-		/* invalid key press */
-		return 0;

-	if (dev!=0x1e && dev!=0x1f)
-		/* not a hauppauge remote */
-		return 0;
+	if (haup_filter != 0) {
+		/*
+		 * Hauppauge remotes (black/silver) always use
+		 * specific device ids. If we do not filter the
+		 * device ids then messages destined for devices
+		 * such as TVs (id=0) will get through causing
+		 * mis-fired events.
+		 *
+		 * We also filter out invalid key presses which
+		 * produce annoying debug log entries.
+		 */
+		ircode = (start << 12) | (toggle << 11) | (dev << 6) | code;
+		if ((ircode & 0x1fff) == 0x1fff)
+			/* invalid key press */
+			return 0;
+
+		if (dev != 0x1e && dev != 0x1f)
+			/* not a hauppauge remote */
+			return 0;
+	}

   	if (!range)
   		code += 64;

-- 
Lorem ipsum

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RESEND PATCH] ir-kbd-i2c: Allow to disable Hauppauge filter through module parameter
  2010-01-17 18:51 ` Samuel Rakitnican
@ 2010-02-03 11:05   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2010-02-03 11:05 UTC (permalink / raw)
  To: Samuel Rakitnican; +Cc: linux-media@vger.kernel.org

Hi Samuel,

Samuel Rakitnican wrote:
> Some Hauppauge devices have id=0 so such devices won't work.
> For such devices add a module parameter that allow to turn
> off filtering.
> 
> Signed-off-by: Samuel Rakitničan <semiRocket@gmail.com>

Instead of a modprobe parameter, the proper fix is to make the usage of the
complete RC5 code received from this IR. This way, the handling of the
IR will depend only at the IR table used by the device.

Please take a look at the code at em28xx (seek for ir->full_code) to see
how to implement it.

Cheers,
Mauro.

> ---
> diff -r 82bbb3bd0f0a linux/drivers/media/video/ir-kbd-i2c.c
> --- a/linux/drivers/media/video/ir-kbd-i2c.c    Mon Jan 11 11:47:33 2010
> -0200
> +++ b/linux/drivers/media/video/ir-kbd-i2c.c    Sat Jan 16 16:39:14 2010
> +0100
> @@ -61,6 +61,10 @@
>   module_param(hauppauge, int, 0644);    /* Choose Hauppauge remote */
>   MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey
> (defaults to 0)");
> 
> +static int haup_filter = 1;
> +module_param(haup_filter, int, 0644);
> +MODULE_PARM_DESC(haup_filter, "Hauppauge filter for other remotes,
> default is 1 (On)");
> +
> 
>   #define DEVNAME "ir-kbd-i2c"
>   #define dprintk(level, fmt, arg...)    if (debug >= level) \
> @@ -96,24 +100,27 @@
>       if (!start)
>           /* no key pressed */
>           return 0;
> -    /*
> -     * Hauppauge remotes (black/silver) always use
> -     * specific device ids. If we do not filter the
> -     * device ids then messages destined for devices
> -     * such as TVs (id=0) will get through causing
> -     * mis-fired events.
> -     *
> -     * We also filter out invalid key presses which
> -     * produce annoying debug log entries.
> -     */
> -    ircode= (start << 12) | (toggle << 11) | (dev << 6) | code;
> -    if ((ircode & 0x1fff)==0x1fff)
> -        /* invalid key press */
> -        return 0;
> 
> -    if (dev!=0x1e && dev!=0x1f)
> -        /* not a hauppauge remote */
> -        return 0;
> +    if (haup_filter != 0) {
> +        /*
> +         * Hauppauge remotes (black/silver) always use
> +         * specific device ids. If we do not filter the
> +         * device ids then messages destined for devices
> +         * such as TVs (id=0) will get through causing
> +         * mis-fired events.
> +         *
> +         * We also filter out invalid key presses which
> +         * produce annoying debug log entries.
> +         */
> +        ircode = (start << 12) | (toggle << 11) | (dev << 6) | code;
> +        if ((ircode & 0x1fff) == 0x1fff)
> +            /* invalid key press */
> +            return 0;
> +
> +        if (dev != 0x1e && dev != 0x1f)
> +            /* not a hauppauge remote */
> +            return 0;
> +    }
> 
>       if (!range)
>           code += 64;
> 


-- 

Cheers,
Mauro

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-03 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-17 18:26 [RESEND PATCH] ir-kbd-i2c: Allow to disable Hauppauge filter through module parameter Samuel Rakitnican
2010-01-17 18:51 ` Samuel Rakitnican
2010-02-03 11:05   ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox