summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/ir-kbd-i2c.c
diff options
context:
space:
mode:
authorRicardo Cerqueira <devnull@localhost>2005-11-08 16:37:02 +0000
committerRicardo Cerqueira <devnull@localhost>2005-11-08 16:37:02 +0000
commiteaed794617f0bfe60c163b20beac76c49fddfa7e (patch)
treee8bed37f1e114c5d4b7fcf882087c2ebb83b1662 /linux/drivers/media/video/ir-kbd-i2c.c
parent60e495e67bcdf6af4887af43fed88cc6531bcc24 (diff)
downloadmediapointer-dvb-s2-eaed794617f0bfe60c163b20beac76c49fddfa7e.tar.gz
mediapointer-dvb-s2-eaed794617f0bfe60c163b20beac76c49fddfa7e.tar.bz2
- 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>
Diffstat (limited to 'linux/drivers/media/video/ir-kbd-i2c.c')
-rw-r--r--linux/drivers/media/video/ir-kbd-i2c.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c
index e6405386c..867b8ef6c 100644
--- a/linux/drivers/media/video/ir-kbd-i2c.c
+++ b/linux/drivers/media/video/ir-kbd-i2c.c
@@ -1,5 +1,5 @@
/*
- * $Id: ir-kbd-i2c.c,v 1.25 2005/11/04 14:23:40 mchehab Exp $
+ * $Id: ir-kbd-i2c.c,v 1.26 2005/11/08 16:37:02 rmcc Exp $
*
* keyboard input driver for i2c IR remote controls
*
@@ -185,6 +185,58 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
*ir_raw = b;
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);
/* ----------------------------------------------------------------------- */