Solved

Keyboard interrupt

Posted on 2007-11-23
5
2,004 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

947 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

22 Experts available now in Live!

Get 1:1 Help Now