diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-03-24 19:47:53 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-17 23:52:59 -0400 |
commit | 995187bed30c0545e8da88372e9807da0a85911e (patch) | |
tree | e3e28eff10f8f01f1bfd7ff865a29076bf6700dc /drivers/media/IR/ir-nec-decoder.c | |
parent | 9f1547829a6f39fe6b2da22653dff40502f3d568 (diff) |
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 'drivers/media/IR/ir-nec-decoder.c')
-rw-r--r-- | drivers/media/IR/ir-nec-decoder.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 104482a6991e..c9a986dd57fd 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* ir-raw-event.c - handle IR Pulse/Space event | 1 | /* ir-nec-decoder.c - handle NEC IR Pulse/Space protocol |
2 | * | 2 | * |
3 | * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | 3 | * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> |
4 | * | 4 | * |
@@ -147,7 +147,7 @@ static int __ir_nec_decode(struct input_dev *input_dev, | |||
147 | if (++count == 32) | 147 | if (++count == 32) |
148 | break; | 148 | break; |
149 | } | 149 | } |
150 | *pos++; | 150 | (*pos)++; |
151 | 151 | ||
152 | /* | 152 | /* |
153 | * Fixme: may need to accept Extended NEC protocol? | 153 | * Fixme: may need to accept Extended NEC protocol? |
@@ -181,9 +181,9 @@ err: | |||
181 | * This function returns the number of decoded pulses or -EINVAL if no | 181 | * This function returns the number of decoded pulses or -EINVAL if no |
182 | * pulse got decoded | 182 | * pulse got decoded |
183 | */ | 183 | */ |
184 | int ir_nec_decode(struct input_dev *input_dev, | 184 | static int ir_nec_decode(struct input_dev *input_dev, |
185 | struct ir_raw_event *evs, | 185 | struct ir_raw_event *evs, |
186 | int len) | 186 | int len) |
187 | { | 187 | { |
188 | int pos = 0; | 188 | int pos = 0; |
189 | int rc = 0; | 189 | int rc = 0; |
@@ -198,4 +198,27 @@ int ir_nec_decode(struct input_dev *input_dev, | |||
198 | return rc; | 198 | return rc; |
199 | } | 199 | } |
200 | 200 | ||
201 | EXPORT_SYMBOL_GPL(ir_nec_decode); | 201 | static struct ir_raw_handler nec_handler = { |
202 | .decode = ir_nec_decode, | ||
203 | }; | ||
204 | |||
205 | static int __init ir_nec_decode_init(void) | ||
206 | { | ||
207 | ir_raw_handler_register(&nec_handler); | ||
208 | |||
209 | printk(KERN_INFO "IR NEC protocol handler initialized\n"); | ||
210 | return 0; | ||
211 | } | ||
212 | |||
213 | static void __exit ir_nec_decode_exit(void) | ||
214 | { | ||
215 | ir_raw_handler_unregister(&nec_handler); | ||
216 | } | ||
217 | |||
218 | module_init(ir_nec_decode_init); | ||
219 | module_exit(ir_nec_decode_exit); | ||
220 | |||
221 | MODULE_LICENSE("GPL"); | ||
222 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
223 | MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); | ||
224 | MODULE_DESCRIPTION("NEC IR protocol decoder"); | ||