aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ir-kbd-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r--drivers/media/video/ir-kbd-i2c.c22
1 files changed, 20 insertions, 2 deletions
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