aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarkus Rechberger <mrechberger@gmail.com>2005-11-08 21:37:35 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 07:56:19 -0800
commite43f14af143921ac6680aa3ddfff111bef4e034a (patch)
tree9b83b7070ecb3faeef8ef4515bcac61b071ff380 /drivers
parent340622c5a9028d70b1238ecafb463125277a30eb (diff)
[PATCH] v4l: 790: added support for terratec cinergy 250 usb
- Added support for Terratec Cinergy 250 USB Signed-off-by: Markus Rechberger <mrechberger@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c94
-rw-r--r--drivers/media/video/ir-kbd-i2c.c2
2 files changed, 63 insertions, 33 deletions
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index d6b3e15a035..3800b99e4b8 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -42,40 +42,68 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
/* ---------------------------------------------------------------------- */
-static IR_KEYTAB_TYPE ir_codes_em_pinnacle[IR_KEYTAB_SIZE] = {
- [ 0 ] = KEY_CHANNEL,
- [ 1 ] = KEY_SELECT,
- [ 2 ] = KEY_MUTE,
- [ 3 ] = KEY_POWER,
- [ 4 ] = KEY_KP1,
- [ 5 ] = KEY_KP2,
- [ 6 ] = KEY_KP3,
- [ 7 ] = KEY_CHANNELUP,
- [ 8 ] = KEY_KP4,
- [ 9 ] = KEY_KP5,
- [ 10 ] = KEY_KP6,
-
- [ 11 ] = KEY_CHANNELDOWN,
- [ 12 ] = KEY_KP7,
- [ 13 ] = KEY_KP8,
- [ 14 ] = KEY_KP9,
- [ 15 ] = KEY_VOLUMEUP,
- [ 16 ] = KEY_KP0,
- [ 17 ] = KEY_MENU,
- [ 18 ] = KEY_PRINT,
-
- [ 19 ] = KEY_VOLUMEDOWN,
- [ 21 ] = KEY_PAUSE,
- [ 23 ] = KEY_RECORD,
- [ 24 ] = KEY_REWIND,
- [ 25 ] = KEY_PLAY,
- [ 27 ] = KEY_BACKSPACE,
- [ 29 ] = KEY_STOP,
- [ 31 ] = KEY_ZOOM,
+static IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE] = {
+ [ 0x01 ] = KEY_CHANNEL,
+ [ 0x02 ] = KEY_SELECT,
+ [ 0x03 ] = KEY_MUTE,
+ [ 0x04 ] = KEY_POWER,
+ [ 0x05 ] = KEY_KP1,
+ [ 0x06 ] = KEY_KP2,
+ [ 0x07 ] = KEY_KP3,
+ [ 0x08 ] = KEY_CHANNELUP,
+ [ 0x09 ] = KEY_KP4,
+ [ 0x0a ] = KEY_KP5,
+ [ 0x0b ] = KEY_KP6,
+ [ 0x0c ] = KEY_CHANNELDOWN,
+ [ 0x0d ] = KEY_KP7,
+ [ 0x0e ] = KEY_KP8,
+ [ 0x0f ] = KEY_KP9,
+ [ 0x10 ] = KEY_VOLUMEUP,
+ [ 0x11 ] = KEY_KP0,
+ [ 0x12 ] = KEY_MENU,
+ [ 0x13 ] = KEY_PRINT,
+ [ 0x14 ] = KEY_VOLUMEDOWN,
+ [ 0x16 ] = KEY_PAUSE,
+ [ 0x18 ] = KEY_RECORD,
+ [ 0x19 ] = KEY_REWIND,
+ [ 0x1a ] = KEY_PLAY,
+ [ 0x1b ] = KEY_FORWARD,
+ [ 0x1c ] = KEY_BACKSPACE,
+ [ 0x1e ] = KEY_STOP,
+ [ 0x40 ] = KEY_ZOOM,
};
/* ----------------------------------------------------------------------- */
+static int 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)) {
+ dprintk("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 */
+
+ dprintk("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;
+}
+
+
static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
{
unsigned char buf[2];
@@ -123,14 +151,16 @@ void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir)
case (EM2820_BOARD_UNKNOWN):
break;
case (EM2820_BOARD_TERRATEC_CINERGY_250):
+ ir->ir_codes = ir_codes_em_terratec;
+ ir->get_key = get_key_terratec;
+ snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2820 Terratec)");
break;
case (EM2820_BOARD_PINNACLE_USB_2):
- ir->ir_codes = ir_codes_em_pinnacle;
break;
case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
ir->ir_codes = ir_codes_hauppauge_new;
ir->get_key = get_key_em_haup;
- snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2840 Hauppage)");
+ snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2840 Hauppauge)");
break;
case (EM2820_BOARD_MSI_VOX_USB_2):
break;
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 8cc3f8ab2f3..c4701035ca2 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -429,7 +429,7 @@ static int ir_probe(struct i2c_adapter *adap)
static const int probe_saa7134[] = { 0x7a, -1 };
static const int probe_em2820[] = { 0x30, 0x47, -1 };
const int *probe = NULL;
- struct i2c_client c; char buf; int i,rc;
+ struct i2c_client c; unsigned char buf; int i,rc;
switch (adap->id) {
case I2C_HW_B_BT848: