




|
Tech Tips8
How to make init receive fixed keyboard combination to implement commands?
Author: Ben|Date: 2007/06/07|Back to Tech Tips
If we want to make init receive fixed keyboard combination to implement commands, the following procedures interprets how to find out keyboard files and commands in system:
1. Find out related RPM, e.g. kbd-1.12-19.el5 in CentOS5 2. Understand kbrequest behavior in /etc/inittab 3. Change keyboard corresponding content 4. Run ‘loadkeys –d’ to start changed content Every system has corresponding keyboard files including the definition and code of each keyboard. In CentOS5 they are saved in /lib/kbd/keymaps/i386. We can use loadkeys to know the default keyboard configuration of current system. Next, there is an action named as kbrequest in /etc/inittab which can capture KeyboardSingnal to implement command. Thus, we can add the following line in /etc/inittab: kb::kbrequest:/sbin/shutdown -t3 -r now Then change the file ‘defkeymap.map.gz’. Add the following contents in Insert key definition: keycode 110 = Insert altgr control keycode 110 = KeyboardSignal control alt keycode 110 = KeyboardSignal So Alt+Ctrl+Ins will send KeyboardSingnal At last, restart init by running ‘init q’ and then mount new added keyboard combination by running ‘loadkeys –d’. The whole configuration completes! |