summaryrefslogtreecommitdiffstats
path: root/include/media/ir-core.h
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-03-25 00:47:53 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-18 05:52:59 +0200
commit995187bed30c0545e8da88372e9807da0a85911e (patch)
treee3e28eff10f8f01f1bfd7ff865a29076bf6700dc /include/media/ir-core.h
parentV4L/DVB: saa7134: don't wait too much to generate an IR event on raw_decode (diff)
downloadlinux-995187bed30c0545e8da88372e9807da0a85911e.tar.xz
linux-995187bed30c0545e8da88372e9807da0a85911e.zip
V4L/DVB: ir-core: dynamically load the compiled IR protocols
Instead of hardcoding the protocols into ir-core, add a register interface for the IR protocol decoders, and convert ir-nec-decoder into a client of ir-core. With this approach, it is possible to dynamically load the needed IR protocols, and to add a RAW IR interface module, registered as one IR raw protocol decoder. This patch opens a way to register a lirc_dev interface to work as an userspace IR protocol decoder. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to '')
-rw-r--r--include/media/ir-core.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 8d8ed7e06cd5..c377bf47a059 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -1,6 +1,8 @@
/*
* Remote Controller core header
*
+ * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
@@ -80,6 +82,14 @@ struct ir_input_dev {
int keypressed; /* current state */
};
+struct ir_raw_handler {
+ struct list_head list;
+
+ int (*decode)(struct input_dev *input_dev,
+ struct ir_raw_event *evs,
+ int len);
+};
+
#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
/* Routines from ir-keytable.c */
@@ -104,11 +114,20 @@ int ir_raw_event_register(struct input_dev *input_dev);
void ir_raw_event_unregister(struct input_dev *input_dev);
int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type);
int ir_raw_event_handle(struct input_dev *input_dev);
+int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);
+void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler);
-/* from ir-nec-decoder.c */
-int ir_nec_decode(struct input_dev *input_dev,
- struct ir_raw_event *evs,
- int len);
-
+#ifdef MODULE
+void ir_raw_init(void);
+#else
+#define ir_raw_init() 0
+#endif
+/* from ir-nec-decoder.c */
+#ifdef CONFIG_IR_NEC_DECODER_MODULE
+#define load_nec_decode() request_module("ir-nec-decoder")
+#else
+#define load_nec_decode() 0
#endif
+
+#endif /* _IR_CORE */