Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176791
b: refs/heads/master
c: b779974
h: refs/heads/master
i:
  176789: 7f5d15e
  176787: ddb0c43
  176783: 0e5d59c
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Dec 16, 2009
1 parent 7be9298 commit b7941c6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b33f5f8af3fabe6a080c9d06f8f3184a4de3f3c2
refs/heads/master: b779974bdfcaec2a0eb13e44405baca07e0e92a3
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/em28xx/em28xx-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ void em28xx_register_i2c_ir(struct em28xx *dev)
dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)";
break;
case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
dev->init_data.ir_codes = &ir_codes_hauppauge_new_table;
dev->init_data.ir_codes = &ir_codes_rc5_hauppauge_new_table;
dev->init_data.get_key = em28xx_get_key_em_haup;
dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
break;
Expand Down
41 changes: 29 additions & 12 deletions trunk/drivers/media/video/em28xx/em28xx-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,13 @@ int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
{
unsigned char buf[2];
unsigned char code;
u16 code;
int size;

/* poll IR chip */
if (2 != i2c_master_recv(ir->c, buf, 2))
size = i2c_master_recv(ir->c, buf, sizeof(buf));

if (size != 2)
return -EIO;

/* Does eliminate repeated parity code */
Expand All @@ -124,16 +127,30 @@ int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)

ir->old = buf[1];

/* Rearranges bits to the right order */
code = ((buf[0]&0x01)<<5) | /* 0010 0000 */
((buf[0]&0x02)<<3) | /* 0001 0000 */
((buf[0]&0x04)<<1) | /* 0000 1000 */
((buf[0]&0x08)>>1) | /* 0000 0100 */
((buf[0]&0x10)>>3) | /* 0000 0010 */
((buf[0]&0x20)>>5); /* 0000 0001 */

i2cdprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x)\n",
code, buf[0]);
/*
* Rearranges bits to the right order.
* The bit order were determined experimentally by using
* The original Hauppauge Grey IR and another RC5 that uses addr=0x08
* The RC5 code has 14 bits, but we've experimentally determined
* the meaning for only 11 bits.
* So, the code translation is not complete. Yet, it is enough to
* work with the provided RC5 IR.
*/
code =
((buf[0] & 0x01) ? 0x0020 : 0) | /* 0010 0000 */
((buf[0] & 0x02) ? 0x0010 : 0) | /* 0001 0000 */
((buf[0] & 0x04) ? 0x0008 : 0) | /* 0000 1000 */
((buf[0] & 0x08) ? 0x0004 : 0) | /* 0000 0100 */
((buf[0] & 0x10) ? 0x0002 : 0) | /* 0000 0010 */
((buf[0] & 0x20) ? 0x0001 : 0) | /* 0000 0001 */
((buf[1] & 0x08) ? 0x1000 : 0) | /* 0001 0000 */
((buf[1] & 0x10) ? 0x0800 : 0) | /* 0000 1000 */
((buf[1] & 0x20) ? 0x0400 : 0) | /* 0000 0100 */
((buf[1] & 0x40) ? 0x0200 : 0) | /* 0000 0010 */
((buf[1] & 0x80) ? 0x0100 : 0); /* 0000 0001 */

i2cdprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x%02x)\n",
code, buf[1], buf[0]);

/* return key */
*ir_key = code;
Expand Down

0 comments on commit b7941c6

Please sign in to comment.