Solved

Keyboard interrupt

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
understanding folder structure inside an rpm 2 68
how to run a command as a nologin user 7 348
Identify Linux loader 67 178
Linux Scripting 3 121
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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…

776 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