Solved

Keyboard interrupt

Posted on 2007-11-23
5
2,000 Views
Last Modified: 2008-02-28
Hi guys!
I need to modify the keyboard interrupt routine of the kernel to create a special command located at this level that shutdown the system.

Well, resuming I need:
1 - Discover what's the file to modify, I think the file is "keyboard.c" but the modifications that I do in this file don't take any effects;
2 - Discover what is the kernel functions to shutdown the system, I try this functions but they not work (kernel_hatl(), unlock_kernel(), do_exit(0))

Thanks for all.
0
Comment
Question by:zezons
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 20341560
Hi,

Since you are using linux, you nay use bash key binding feature. Bash reads .inputrc file upon starting, where you can defile keyboard keys binding. The .inputrc file should be in the user home dir.

bash will read the .inputrc from the home directory of the user, where you can put user specific key bindings.

In .inputrc file you may include a system wide inputrc file where you put global key bindings. This can be done by adding the line below to each user .inputrc :

$include      /etc/inputrc

(the $ is must)

You need to create the file /etc/inputrc

You may add to /etc/inputrc something like

Control-g: "clear \n"

The above is a key mapping of cntl-g to clear with enter. If you want shutdown, change it to your favorite shutdown command

Note: if you want to define control keys, make sure they are not used by stty (stty -a will give such info).
see man stty for more info. Please the links below:

http://www.gnu.org/software/bash/manual/bashref.html
http://unixhelp.ed.ac.uk/CGI/man-cgi?readline+3
0
 

Author Comment

by:zezons
ID: 20342801
Ok, but I need create a special command like "shutdown_my_system" where if type this sequence in any local console or kde the system should turnoff.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20342821
Hi,

If you noticed, it does not require typing such long command. It could be a control char to do so.

e.g. in ~/.inputrc add

Control-g: "init 0 \n"

0
 

Author Comment

by:zezons
ID: 20350924
But what I need is to modify the kernel code to create a long command, because I know how to create a bash command but I don't need of a bash command.
0
 

Accepted Solution

by:
zezons earned 0 total points
ID: 20936722
Hi.
I have been changed the "keyboard.c" kernel file.
The change made was in the "put_queue" procedure.

This works fine and give a good known about the kernel sources.

That's all folks.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now