summaryrefslogtreecommitdiff
path: root/drivers/media/dvb/firesat/firesat-rc.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-03-06 21:30:23 -0800
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-02-24 14:51:25 +0100
commitc81c8b68b46752721b0c1addfabb828da27e1489 (patch)
tree59d2a336150ce59780b73ba8dc59a829e217b2d0 /drivers/media/dvb/firesat/firesat-rc.c
parentf7e603ad8f78cd3b59e33fa72707da0cbabdf699 (diff)
downloadlwn-c81c8b68b46752721b0c1addfabb828da27e1489.tar.gz
lwn-c81c8b68b46752721b0c1addfabb828da27e1489.zip
DVB: add firesat driver
Original code written by Christian Dolzer <c.dolzer@digital-everywhere.com> Cleaned up by Greg. Major cleanup and reorg by Manu Abraham <manu@linuxtv.org> Additions also by Ben Backx <ben@bbackx.com> Cc: Christian Dolzer <c.dolzer@digital-everywhere.com> Cc: Andreas Monitzer <andy@monitzer.com> Cc: Manu Abraham <manu@linuxtv.org> Cc: Fabio De Lorenzo <delorenzo.fabio@gmail.com> Cc: Robert Berger <robert.berger@reliableembeddedsystems.com> Signed-off-by: Ben Backx <ben@bbackx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Added missing dependency to dvb/firesat/Kconfig, Reported-by: Randy Dunlap <randy.dunlap@oracle.com> Tweaked dvb/Makefile. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/media/dvb/firesat/firesat-rc.c')
-rw-r--r--drivers/media/dvb/firesat/firesat-rc.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/drivers/media/dvb/firesat/firesat-rc.c b/drivers/media/dvb/firesat/firesat-rc.c
new file mode 100644
index 000000000000..e300b81008af
--- /dev/null
+++ b/drivers/media/dvb/firesat/firesat-rc.c
@@ -0,0 +1,84 @@
+#include "firesat.h"
+#include "firesat-rc.h"
+
+#include <linux/input.h>
+
+static u16 firesat_irtable[] = {
+ KEY_ESC,
+ KEY_F9,
+ KEY_1,
+ KEY_2,
+ KEY_3,
+ KEY_4,
+ KEY_5,
+ KEY_6,
+ KEY_7,
+ KEY_8,
+ KEY_9,
+ KEY_I,
+ KEY_0,
+ KEY_ENTER,
+ KEY_RED,
+ KEY_UP,
+ KEY_GREEN,
+ KEY_F10,
+ KEY_SPACE,
+ KEY_F11,
+ KEY_YELLOW,
+ KEY_DOWN,
+ KEY_BLUE,
+ KEY_Z,
+ KEY_P,
+ KEY_PAGEDOWN,
+ KEY_LEFT,
+ KEY_W,
+ KEY_RIGHT,
+ KEY_P,
+ KEY_M,
+ KEY_R,
+ KEY_V,
+ KEY_C,
+ 0
+};
+
+static struct input_dev firesat_idev;
+
+int firesat_register_rc(void)
+{
+ int index;
+
+ memset(&firesat_idev, 0, sizeof(firesat_idev));
+
+ firesat_idev.evbit[0] = BIT(EV_KEY);
+
+ for (index = 0; firesat_irtable[index] != 0; index++)
+ set_bit(firesat_irtable[index], firesat_idev.keybit);
+
+ return input_register_device(&firesat_idev);
+}
+
+int firesat_unregister_rc(void)
+{
+ input_unregister_device(&firesat_idev);
+ return 0;
+}
+
+int firesat_got_remotecontrolcode(u16 code)
+{
+ u16 keycode;
+
+ if (code > 0x4500 && code < 0x4520)
+ keycode = firesat_irtable[code - 0x4501];
+ else if (code > 0x453f && code < 0x4543)
+ keycode = firesat_irtable[code - 0x4521];
+ else {
+ printk(KERN_DEBUG "%s: invalid key code 0x%04x\n", __func__,
+ code);
+ return -EINVAL;
+ }
+
+ input_report_key(&firesat_idev, keycode, 1);
+ input_report_key(&firesat_idev, keycode, 0);
+
+ return 0;
+}