Re: [PATCH] [media] saa7134: fix IR handling for HVR-1110

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

 



> Return the complete RC-5 code, instead of just the 8 least significant
> bits.
> 
> Reported-by: Dorozel Csaba <mrjuuzer@xxxxxxxxxx>
> Tested-by: Dorozel Csaba <mrjuuzer@xxxxxxxxxx>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> 
> ---
> 
> Please, re-test this patch. It is a more detailed version of the
> previous one, with a few more documentation, and some cleanups.
> 
> 
>  drivers/media/video/saa7134/saa7134-input.c |   23 ++++++++++++++---------
>  1 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/video/saa7134/saa7134-input.c
> b/drivers/media/video/saa7134/saa7134-input.c index d4ee24b..0e4926a 100644
> --- a/drivers/media/video/saa7134/saa7134-input.c
> +++ b/drivers/media/video/saa7134/saa7134-input.c
> @@ -235,22 +235,27 @@ 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)
>  {
> -	unsigned char buf[5], cod4, code3, code4;
> +	unsigned char buf[5], scancode;
>  
>  	/* poll IR chip */
>  	if (5 != i2c_master_recv(ir->c, buf, 5))
>  		return -EIO;
>  
> -	cod4	= buf[4];
> -	code4	= (cod4 >> 2);
> -	code3	= buf[3];
> -	if (code3 == 0)
> -		/* no key pressed */
> +	/* Check if some key were pressed */
> +	if (!(buf[0] & 0x80))
>  		return 0;
>  
> -	/* return key */
> -	*ir_key = code4;
> -	*ir_raw = code4;
> +	/*
> +	 * buf[3] & 0x80 is always high.
> +	 * 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.
> +	 */
> +	scancode = 0x1fff & ((buf[3] << 8) | (buf[4] >> 2));
> +
> +	*ir_key = scancode;
> +	*ir_raw = scancode;
>  	return 1;
>  }
>  

Something is wrong with this patch.

user linux-current # ir-keytable -t -d /dev/input/event6
Testing events. Please, press CTRL-C to abort.
1325411805.906573: event MSC: scancode = 3d
1325411805.906575: event sync
1325411806.524576: event MSC: scancode = 3d
1325411806.524578: event sync
1325411806.627576: event MSC: scancode = 3d
1325411806.627578: event sync
1325411806.833581: event MSC: scancode = 3d
1325411806.833583: event sync
1325411806.936582: event MSC: scancode = 3d
1325411806.936583: event sync
1325411807.039576: event MSC: scancode = 3d
1325411807.039577: event sync
1325411807.245576: event MSC: scancode = 3d
1325411807.245578: event sync
--
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