LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-21-2008, 10:10 AM   #1
Pioz
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
Keyboard interrupt - request_irq()


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):


Code:
#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...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard interrupt handler and more john_crichton Programming 5 07-16-2009 10:30 AM
request_irq() handling. ksrinivas Linux - Kernel 0 08-07-2007 03:07 AM
Screensaver interrupt only by Keyboard. duffmckagan Linux - Software 0 02-18-2007 11:05 PM
simulating keyboard interrupt 03mcmt02 General 4 04-03-2005 08:27 PM
undefined reference to 'request_irq()' deimosSan Programming 2 11-10-2003 08:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration