lkml.org 
[lkml]   [2008]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Keyboard interrupt - request_irq()
Pioz wrote:
> Hi all,
> I have a problem.
> I want handle the keyboard interrupt and for this purpose I have write
> this module (I have kernel 2.6.23):
>
>
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/interrupt.h>
>
> [...]
>
> irqreturn_t
> irq_myhandler (int irqn, void *dev)
> {
> printk (KERN_INFO "Key pressed...\n");
> return IRQ_HANDLED;
> }
>
> int
> init_module ()
> {
> int res;
> printk (KERN_INFO "Hello World!\n");
> free_irq (1, NULL);
> res = request_irq (1, irq_myhandler, IRQF_SHARED, "bao", dev_id);
> printk (KERN_INFO "res: %d\n", res);
> return 0;
> }
>
> void
> cleanup_module ()
> {
> free_irq (1, NULL);
> printk (KERN_INFO "Goodbye World!\n");
> }
>
>
> The return value of request_irq() function is -EBUSY. Why? Is the
> default handler? How can I do to change handler with my function?
> Thanks...

Normally one doesn't register multiple interrupt handlers for the same
device. For a PCI level-triggered interrupt one can do it (for the case
where multiple devices share the IRQ), but the PC keyboard interrupt is
edge-triggered and isn't sharable.


\
 
 \ /
  Last update: 2008-02-22 05:07    [W:0.027 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site