From 995187bed30c0545e8da88372e9807da0a85911e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Mar 2010 20:47:53 -0300 Subject: 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 --- include/media/ir-core.h | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'include/media/ir-core.h') diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 8d8ed7e..c377bf4 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 + * * 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 */ -- cgit v1.1