[media] saa7134: fix IR handling for HVR-1110
Return the complete RC-5 code, instead of just the 8 least significant bits. Reported-by: Dorozel Csaba <mrjuuzer@upcmail.hu> Tested-by: Dorozel Csaba <mrjuuzer@upcmail.hu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
@@ -235,22 +235,25 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
|||||||
|
|
||||||
static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
||||||
{
|
{
|
||||||
unsigned char buf[5], cod4, code3, code4;
|
unsigned char buf[5];
|
||||||
|
|
||||||
/* poll IR chip */
|
/* poll IR chip */
|
||||||
if (5 != i2c_master_recv(ir->c, buf, 5))
|
if (5 != i2c_master_recv(ir->c, buf, 5))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
cod4 = buf[4];
|
/* Check if some key were pressed */
|
||||||
code4 = (cod4 >> 2);
|
if (!(buf[0] & 0x80))
|
||||||
code3 = buf[3];
|
|
||||||
if (code3 == 0)
|
|
||||||
/* no key pressed */
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* return key */
|
/*
|
||||||
*ir_key = code4;
|
* buf[3] & 0x80 is always high.
|
||||||
*ir_raw = code4;
|
* buf[3] & 0x40 is a parity bit. A repeat event is marked
|
||||||
|
* by preserving it into two separate readings
|
||||||
|
* buf[4] bits 0 and 1, and buf[1] and buf[2] are always
|
||||||
|
* zero.
|
||||||
|
*/
|
||||||
|
*ir_key = 0x1fff & ((buf[3] << 8) | (buf[4] >> 2));
|
||||||
|
*ir_raw = *ir_key;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user