public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancockr@shaw.ca>
To: Pioz <pioz84@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Keyboard interrupt - request_irq()
Date: Thu, 21 Feb 2008 22:04:45 -0600	[thread overview]
Message-ID: <47BE49DD.6070404@shaw.ca> (raw)
In-Reply-To: <fa.Q5fldlauC9khAhVFQXr2Stx54+I@ifi.uio.no>

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.

       reply	other threads:[~2008-02-22  4:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.Q5fldlauC9khAhVFQXr2Stx54+I@ifi.uio.no>
2008-02-22  4:04 ` Robert Hancock [this message]
2008-02-21 16:04 Keyboard interrupt - request_irq() Pioz
2008-02-22  9:28 ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47BE49DD.6070404@shaw.ca \
    --to=hancockr@shaw.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pioz84@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox