diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-31 15:56:24 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-01 13:46:42 -0500 |
commit | 641269f9583c5c3535dff9c66de13a8216f791a5 (patch) | |
tree | a4ddbd699e2ccfe51bbe1be082b6f72c3d2c2ded /drivers/media/video/saa7134 | |
parent | 1e73fa5d56333230854ae9460579eb2fcee8af02 (diff) |
[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>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index d4ee24bf6928..1b15b0db7883 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -235,22 +235,25 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
235 | 235 | ||
236 | static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | 236 | static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
237 | { | 237 | { |
238 | unsigned char buf[5], cod4, code3, code4; | 238 | unsigned char buf[5]; |
239 | 239 | ||
240 | /* poll IR chip */ | 240 | /* poll IR chip */ |
241 | if (5 != i2c_master_recv(ir->c, buf, 5)) | 241 | if (5 != i2c_master_recv(ir->c, buf, 5)) |
242 | return -EIO; | 242 | return -EIO; |
243 | 243 | ||
244 | cod4 = buf[4]; | 244 | /* Check if some key were pressed */ |
245 | code4 = (cod4 >> 2); | 245 | if (!(buf[0] & 0x80)) |
246 | code3 = buf[3]; | ||
247 | if (code3 == 0) | ||
248 | /* no key pressed */ | ||
249 | return 0; | 246 | return 0; |
250 | 247 | ||
251 | /* return key */ | 248 | /* |
252 | *ir_key = code4; | 249 | * buf[3] & 0x80 is always high. |
253 | *ir_raw = code4; | 250 | * buf[3] & 0x40 is a parity bit. A repeat event is marked |
251 | * by preserving it into two separate readings | ||
252 | * buf[4] bits 0 and 1, and buf[1] and buf[2] are always | ||
253 | * zero. | ||
254 | */ | ||
255 | *ir_key = 0x1fff & ((buf[3] << 8) | (buf[4] >> 2)); | ||
256 | *ir_raw = *ir_key; | ||
254 | return 1; | 257 | return 1; |
255 | } | 258 | } |
256 | 259 | ||