cx231xx: Fix inverted bits for RC on PV Hybrid
PATCH 1/1 cx231xx: Fix inverted bits for RC on PV Hybrid
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 <[email protected]>
drivers/media/video/cx231xx/cx231xx-input.c +16 -5
@@ -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 ; }
Quoted 25 lines · Mauro Carvalho Chehab
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 <[email protected]>drivers/media/video/cx231xx/cx231xx-input.c +1
-4@@ -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;
drivers/media/video/cx231xx/cx231xx-input.c static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key, · line 53
Quoted 10 lines
drivers/media/video/cx231xx/cx231xx-input.c +9
-1- *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
Quoted 8 lines
drivers/media/video/cx231xx/cx231xx-input.c +5
-0+dev_dbg (&ir->rc->input_dev->dev,"cmd %02x, scan = %02x\n" , + cmd, scancode); + + *ir_key = scancode; + *ir_raw = scancode;return 1 ; }