diff options
author | Ricardo Cerqueira <v4l@cerqueira.org> | 2005-11-14 01:07:49 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-14 03:14:18 +0100 |
commit | 8069695c9e7da7ab7cd8ee749e8d5aa9e6e0660b (patch) | |
tree | f5e7208c2b9fd261d12424816388a736d500c987 /drivers/media/video/ir-kbd-i2c.c | |
parent | [PATCH] v4l: (943) added secam l video standard (diff) | |
download | linux-8069695c9e7da7ab7cd8ee749e8d5aa9e6e0660b.tar.xz linux-8069695c9e7da7ab7cd8ee749e8d5aa9e6e0660b.zip |
[PATCH] v4l: (935) Moved common IR stuff to ir-common.c
- The pinnacle handler & remote are common to saa7134 PCI boards and em28xx
USB boards, so the keymap was moved to ir-common and the keyhandler is back
to ir-kbd-i2c
- request_module("ir-kbd-i2c") is no longer necessary at saa7134-core since
saa7134.ko now depends on ir-kbd-i2c.ko to get the keyhandler
Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
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/media/video/ir-kbd-i2c.c')
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 0085567a1421..801c736e9328 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -183,6 +183,58 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) return 1; } +/* The new pinnacle PCTV remote (with the colored buttons) + * + * Ricardo Cerqueira <v4l@cerqueira.org> + */ + +int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + unsigned char b[4]; + unsigned int start = 0,parity = 0,code = 0; + + /* poll IR chip */ + if (4 != i2c_master_recv(&ir->c,b,4)) { + dprintk(2,"read error\n"); + return -EIO; + } + + for (start = 0; start<4; start++) { + if (b[start] == 0x80) { + code=b[(start+3)%4]; + parity=b[(start+2)%4]; + } + } + + /* Empty Request */ + if (parity==0) + return 0; + + /* Repeating... */ + if (ir->old == parity) + return 0; + + + ir->old = parity; + + /* Reduce code value to fit inside IR_KEYTAB_SIZE + * + * this is the only value that results in 42 unique + * codes < 128 + */ + + code %= 0x88; + + *ir_raw = code; + *ir_key = code; + + dprintk(1,"Pinnacle PCTV key %02x\n", code); + + return 1; +} + +EXPORT_SYMBOL_GPL(get_key_pinnacle); + /* ----------------------------------------------------------------------- */ static void ir_key_poll(struct IR_i2c *ir) |