LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-20-2012, 02:32 AM   #1
afsari
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
keyboard interrupt disabling


Hello,

How can I disable the regular keyboard interrupt handler?
 
Old 05-21-2012, 02:16 PM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Two ways, either uninstall the keyboard or (my favorite) redirect the interupt vector to a dummy routine...

But...why would you do that?

Just being nosy...

Thor
 
Old 06-04-2012, 09:26 PM   #3
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,959

Rep: Reputation: 271Reputation: 271Reputation: 271
It's a maskable interrupt. Just change the bit on the interrupt mask.

On a laptop that had 3 mouse buttons the middle stuck. I couldn't unstick it. So I rewrote the kernel's mouse driver to discard all interrupts caused by that button; I never used a middle mouse button anyway.

If one had a bad 8042 that fired randomly one could use a usb keyboard instead, bypassing the 8042, and want it ignored.

Last edited by RandomTroll; 06-04-2012 at 09:37 PM.
 
Old 06-05-2012, 11:43 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
It is most likely that you do not actually want to "disable" the hardware interrupt, even if you can. This is (only partly...) because, in the x86 architecture, there aren't enough interrupt channels to go around. Hardware interrupt channels are therefore necessarily shared. Ergo, you must deal with the matter in software.

The latter is the essence of Thor 2.0's approach: allow the interrupt to happen, then allow Linux to figure out (as it inevitably does...) that this is an interrupt coming from the "keyboard" device, then direct its response to a dummy routine.

Now ... having said all of that, do I seriously think that this is really what you intend to do or should do (even though you are discussing this on a "kernel" sub-forum)? N-O!

(As in: "not only 'no' but ...")

My guess is that you are probably "merely" concerned with suppressing the keyboard's effect on a particular user-land [i]process.[/o] And, if my guess is correct, that will translate to a signal that is presented to that process, and therefore you probably want to deal with it (only...!) there.

My caution is that, when you touch the kernel, you by definition affect the entire system. Do you seriously wish to do that? I doubt!

And there's more! What if the keyboard in question is a USB keyboard? Oops... the hardware interrupts are no longer involved at all, and yet, Linux will properly recogize it to be "a keyboard," and will present the same effects to your user-land program. If this possibility frustrates the effectiveness of your present approach, then it follows that your present approach is (as I politely expect that it is...) a gigantic red-herring.

Am I, in saying this, "making a fool of you in public?" Heck, no! Setting aside for the moment the very real possibility that I might be 150% wrong, "the digital computer doth make fools of us all."

Last edited by sundialsvcs; 06-05-2012 at 11:45 AM.
 
Old 06-05-2012, 11:59 PM   #5
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,959

Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by sundialsvcs View Post
It is most likely that you do not actually want to "disable" the hardware interrupt, even if you can.
Perhaps. If one has a built-in keyboard that has failed (as I have at the moment) and fires randomly (which mine does) and is happy to use an external keyboard (which I am not), then it makes sense. Occasionally the GPU interrupt on my computer fires randomly and the kernel disables it.

Quote:
Originally Posted by sundialsvcs View Post
This is (only partly...) because, in the x86 architecture, there aren't enough interrupt channels to go around. Hardware interrupt channels are therefore necessarily shared.
The x86 architecture limits the number of interrupts to 256 - at least that was the limit of the 8086-80386. The original PC and XT had 1 interrupt controller (PIC for programmable interrupt controller), which controlled 8 interrupts. The serial ports had 2 allocated to them; in order to have more than 2 serial ports they had to share interrupts. The AT added a second PIC, which added 7 interrupts (because it had to use 1 of the interrupts on the first PIC.) My cheapo laptop (eMachines e725) has 24 interrupts. According to /proc/interrupts I'm using 13 of them. I have never seen a machine that shared a keyboard interrupt. Even the ps/2 mouse, which shares a controller chip with the keyboard, uses a separate interrupt.

Quote:
Originally Posted by sundialsvcs View Post
My guess is that you are probably "merely" concerned with suppressing the keyboard's effect on a particular user-land process.
I wouldn't be surprised if OP doesn't really want to disable the interrupt of his keyboard. I answer people's questions if I can.


Quote:
Originally Posted by sundialsvcs View Post
My caution is that, when you touch the kernel, you by definition affect the entire system. Do you seriously wish to do that? I doubt!
Every now and then, as I mentioned before. When I first used Skype my audio hardware couldn't keep up with 48K audio. I didn't need 48K audio. It's not a Skype parameter. I can't rewrite Skype. So I rewrote the kernel to make the audio driver report that it couldn't handle more than 5K, perfectly good for phone calls, much better than not-working. (I made it an input parameter. I could change on the fly by unloading then reloading the module with a different maximum frequency.)

Quote:
Originally Posted by sundialsvcs View Post
And there's more! What if the keyboard in question is a USB keyboard? Oops... the hardware interrupts are no longer involved at all
USB ports use interrupts. Certainly masking interrupt 1 won't change how linux responds to a USB keyboard. That could be what user wants. At the moment I have the built-in keyboard of my laptop sitting on a shelf - healing, I hope. If I had it installed I couldn't use my computer.

Last edited by RandomTroll; 06-06-2012 at 04:00 AM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] disabling the keyboard interrupt handler Aquarius_Girl Linux - General 1 11-26-2009 11:52 PM
Keyboard interrupt handler and more john_crichton Programming 5 07-16-2009 10:30 AM
Keyboard interrupt - request_irq() Pioz Linux - General 0 02-21-2008 10:10 AM
Screensaver interrupt only by Keyboard. duffmckagan Linux - Software 0 02-18-2007 11:05 PM
RHEL4+Disabling Interrupt IRQ#11 hironbose Linux - Enterprise 1 07-29-2006 10:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:45 PM.

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