Welcome! Log In Create A New Profile

Advanced

Keyboard interrupt - request_irq()

Posted by Pioz 
Keyboard interrupt - request_irq()
February 21, 2008 03:09AM
Hi all,
I have a problem:
I want intercept hardware keyboard interrupt. To do this I have write this kernel module (my kernel version is 2.6.23)


#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>

[...]

irqreturn_t
irq_handler (int irqn, void *dev)
{
        printk (KERN_INFO "Press a key...\n"winking smiley;
        return IRQ_HANDLED;
}

int
init_module ()
{
        int res;
        printk (KERN_INFO "Hello World!\n"winking smiley;
        free_irq  (1, NULL) ;
        res = request_irq (1, irq_handler, 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"winking smiley;
}



So, the res value is -16 (EBUSY). Why? Is the default handler? How can handler interrupt with my function?
Thanks!
Possibly the flags on the standard keyboard driver are not set to "IRQF_SHARED"??
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 4 plus 2?
Message: