aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/ir-kbd-i2c.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index fba30a40e9c6..1457b1602221 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -64,23 +64,32 @@ MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults
64static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 64static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
65{ 65{
66 unsigned char buf[3]; 66 unsigned char buf[3];
67 int start, toggle, dev, code; 67 int start, range, toggle, dev, code;
68 68
69 /* poll IR chip */ 69 /* poll IR chip */
70 if (3 != i2c_master_recv(&ir->c,buf,3)) 70 if (3 != i2c_master_recv(&ir->c,buf,3))
71 return -EIO; 71 return -EIO;
72 72
73 /* split rc5 data block ... */ 73 /* split rc5 data block ... */
74 start = (buf[0] >> 6) & 3; 74 start = (buf[0] >> 7) & 1;
75 range = (buf[0] >> 6) & 1;
75 toggle = (buf[0] >> 5) & 1; 76 toggle = (buf[0] >> 5) & 1;
76 dev = buf[0] & 0x1f; 77 dev = buf[0] & 0x1f;
77 code = (buf[1] >> 2) & 0x3f; 78 code = (buf[1] >> 2) & 0x3f;
78 79
79 if (3 != start) 80 /* rc5 has two start bits
81 * the first bit must be one
82 * the second bit defines the command range (1 = 0-63, 0 = 64 - 127)
83 */
84 if (!start)
80 /* no key pressed */ 85 /* no key pressed */
81 return 0; 86 return 0;
82 dprintk(1,"ir hauppauge (rc5): s%d t%d dev=%d code=%d\n", 87
83 start, toggle, dev, code); 88 if (!range)
89 code += 64;
90
91 dprintk(1,"ir hauppauge (rc5): s%d r%d t%d dev=%d code=%d\n",
92 start, range, toggle, dev, code);
84 93
85 /* return key */ 94 /* return key */
86 *ir_key = code; 95 *ir_key = code;