* [PATCH] [media] cx231xx: Fix inverted bits for RC on PV Hybrid
@ 2010-12-17 17:22 Mauro Carvalho Chehab
2010-12-17 22:23 ` Andy Walls
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2010-12-17 17:22 UTC (permalink / raw)
To: Linux Media Mailing List
At Pixelview SBTVD Hybrid, the bits sent by the IR are inverted. Due to that,
the existing keytables produce wrong codes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c
index c236a4e..45e14ca 100644
--- a/drivers/media/video/cx231xx/cx231xx-input.c
+++ b/drivers/media/video/cx231xx/cx231xx-input.c
@@ -27,7 +27,7 @@
static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key,
u32 *ir_raw)
{
- u8 cmd;
+ u8 cmd, scancode;
dev_dbg(&ir->rc->input_dev->dev, "%s\n", __func__);
@@ -42,10 +42,21 @@ static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key,
if (cmd == 0xff)
return 0;
- dev_dbg(&ir->rc->input_dev->dev, "scancode = %02x\n", cmd);
-
- *ir_key = cmd;
- *ir_raw = cmd;
+ scancode =
+ ((cmd & 0x01) ? 0x80 : 0) |
+ ((cmd & 0x02) ? 0x40 : 0) |
+ ((cmd & 0x04) ? 0x20 : 0) |
+ ((cmd & 0x08) ? 0x10 : 0) |
+ ((cmd & 0x10) ? 0x08 : 0) |
+ ((cmd & 0x20) ? 0x04 : 0) |
+ ((cmd & 0x40) ? 0x02 : 0) |
+ ((cmd & 0x80) ? 0x01 : 0);
+
+ dev_dbg(&ir->rc->input_dev->dev, "cmd %02x, scan = %02x\n",
+ cmd, scancode);
+
+ *ir_key = scancode;
+ *ir_raw = scancode;
return 1;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [media] cx231xx: Fix inverted bits for RC on PV Hybrid
2010-12-17 17:22 [PATCH] [media] cx231xx: Fix inverted bits for RC on PV Hybrid Mauro Carvalho Chehab
@ 2010-12-17 22:23 ` Andy Walls
0 siblings, 0 replies; 2+ messages in thread
From: Andy Walls @ 2010-12-17 22:23 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List
On Fri, 2010-12-17 at 15:22 -0200, Mauro Carvalho Chehab wrote:
> At Pixelview SBTVD Hybrid, the bits sent by the IR are inverted. Due to that,
> the existing keytables produce wrong codes.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
>
> diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c
> index c236a4e..45e14ca 100644
> --- a/drivers/media/video/cx231xx/cx231xx-input.c
> +++ b/drivers/media/video/cx231xx/cx231xx-input.c
> @@ -27,7 +27,7 @@
> static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key,
> u32 *ir_raw)
> {
> - u8 cmd;
> + u8 cmd, scancode;
>
> dev_dbg(&ir->rc->input_dev->dev, "%s\n", __func__);
>
> @@ -42,10 +42,21 @@ static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key,
> if (cmd == 0xff)
> return 0;
>
> - dev_dbg(&ir->rc->input_dev->dev, "scancode = %02x\n", cmd);
> -
> - *ir_key = cmd;
> - *ir_raw = cmd;
> + scancode =
> + ((cmd & 0x01) ? 0x80 : 0) |
> + ((cmd & 0x02) ? 0x40 : 0) |
> + ((cmd & 0x04) ? 0x20 : 0) |
> + ((cmd & 0x08) ? 0x10 : 0) |
> + ((cmd & 0x10) ? 0x08 : 0) |
> + ((cmd & 0x20) ? 0x04 : 0) |
> + ((cmd & 0x40) ? 0x02 : 0) |
> + ((cmd & 0x80) ? 0x01 : 0);
I have to point out this alternate method just for fun:
http://www-graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
:D
Regards,
Andy
> + dev_dbg(&ir->rc->input_dev->dev, "cmd %02x, scan = %02x\n",
> + cmd, scancode);
> +
> + *ir_key = scancode;
> + *ir_raw = scancode;
> return 1;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-17 22:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-17 17:22 [PATCH] [media] cx231xx: Fix inverted bits for RC on PV Hybrid Mauro Carvalho Chehab
2010-12-17 22:23 ` Andy Walls
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox