int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char b; /* poll IR chip */ if (1 != i2c_master_recv(ir->c, &b, 1)) { i2cdprintk("read error\n"); return -EIO; } /* it seems that 0xFE indicates that a button is still hold down, while 0xff indicates that no button is hold down. 0xfe sequences are sometimes interrupted by 0xFF */ i2cdprintk("key %02x\n", b); if (b == 0xff) return 0; if (b == 0xfe) /* keep old data */ return 1; *ir_key = b; *ir_raw = b; return 1; }
int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char buf[3]; /* poll IR chip */ if (3 != i2c_master_recv(ir->c, buf, 3)) { i2cdprintk("read error\n"); return -EIO; } i2cdprintk("key %02x\n", buf[2]&0x3f); if (buf[0] != 0x00) return 0; *ir_key = buf[2]&0x3f; *ir_raw = buf[2]&0x3f; return 1; }
int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char buf[2]; u16 code; int size; /* poll IR chip */ size = i2c_master_recv(ir->c, buf, sizeof(buf)); if (size != 2) return -EIO; /* Does eliminate repeated parity code */ if (buf[1] == 0xff) return 0; ir->old = buf[1]; /* * 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; *ir_raw = code; return 1; }
static int get_key_flydvb_trio(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { int gpio; int attempt = 0; unsigned char b; /* We need this to access GPI Used by the saa_readl macro. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) struct saa7134_dev *dev = ir->c.adapter->algo_data; #else struct saa7134_dev *dev = ir->c->adapter->algo_data; #endif if (dev == NULL) { i2cdprintk("get_key_flydvb_trio: " #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) "gir->c.adapter->algo_data is NULL!\n"); #else "ir->c->adapter->algo_data is NULL!\n"); #endif return -EIO; }