[PATCH] ir-kbd-i2c: Allow to disable Hauppauge filter through module parameter

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

 



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

Signed-off-by: Samuel Rakitničan <semiRocket@xxxxxxxxx>
---
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 Wed Jan 13 13:46:53 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;
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux