LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   How to disable Ctrl and Alt keys? (and maybe sysrq) (http://www.linuxquestions.org/questions/slackware-14/how-to-disable-ctrl-and-alt-keys-and-maybe-sysrq-251284/)

bigperk420 11-04-2004 07:00 PM

How to disable Ctrl and Alt keys? (and maybe sysrq)
 
I'm working with slackware, and trying to disable Ctrl and Alt keys. I am _not_ using X. The application I'm building is a prototype electronic voting machine. (yes, we have a paper trail! every state of the voting pannel is printed out in a hex-barcode on a grocery-style printer) We need to elminate most functionality of the keyboard while voting is in progress. I was wondering which way would be ideal (scancode or keymaps) and I'm pritty new with linux, having only about 5 months of experience. I'm fairly computer-able though, and a second year computer science major now. Any help or advice would be great, thanks for help! :)

-Justin Perkins:newbie:

Cedrik 11-04-2004 07:01 PM

What window manager do you use ?

gbonvehi 11-04-2004 07:04 PM

If you're under X you can try using xmodmap (take a look at it's man page).

bigperk420 11-04-2004 07:06 PM

wow, quick to the punch, I realized the second I posted that I didn't state "not in X" just in normal console or whatever the cmd line version is. (normal for me, since I have started using linux, I havn't used the gui nearly ever)

-Justin Perkins

Cedrik 11-04-2004 07:13 PM

take a keymap from /usr/share/kbd/keymaps/i386 directory then gunzip it and edit it to get
rid of any key you want, gzip it and make sure your /etc/rc.d/rc.keymap load it at boot

bigperk420 11-04-2004 07:23 PM

So I went looking for that /etc/rc.d/rc.keymap file which should load the keymap (right?) and all thats in the directory is: rc.0 rc.6 rc.M rc.acpid rc.local rc.serial rc.sysvinit rc.4 rc.K rc.S rc.hotplug rc.modules rc.syslog rc.udev
I'm using version 2.4.26 (gcc version 3.3.4) and I stripped down the size of the install as much as possible (it's < 60megs now) because we're using compact flash plugged into the IDE channel as a HD and a VIA-EPIA mobo (eden processor) which means it has (count em!) zero moving parts which is nifty... but I realize it isn't a great developing machine because so many utils are stripped out. I will reinstall (more fully) on a second machine tomorrow and see if I can use the previous advice to create the file I need and import it to the mini-install ... thanks for the quick help! :)

Cedrik 11-04-2004 07:32 PM

The rc.keymap just has to contains a few lines and be executable :

Code:

#!/bin/sh
# Load the keyboard map.  More maps are in /usr/share/kbd/keymaps.
if [ -x /usr/bin/loadkeys ]; then
 /usr/bin/loadkeys /path/to/keymap_file
fi

[edit]
Did you install kbd package ?

bigperk420 11-04-2004 07:50 PM

Doubtful on the kbd package. Do I need it? :) (clearly hehe) anyways, I stripped down the install: as many questions going through the step by step newb install script as I could I answered no to. If I need that ok, but, how is my keyboard mapped even if I didn't load that? I mean I don't even have the loadkeys util (so where is the keyboard map coming from?)

-Justin Perkins

bigperk420 11-05-2004 05:43 PM

update: I made a full install of slackware 10.0 with only the X and gnome stuff out... I installed the kbd package, and verified it was installed with pkgtool but I still don't have this rc.keymap file. Should I create it from your example? Shouldn't I just be able to edit the qwerty default keymapfile?

With no clue- Justin Perkins

AxeZ 11-05-2004 06:32 PM

Edit /etc/inittab and find the line that reads

# What to do at the "Three Finger Salute".
ca::ctrlaltdel:/sbin/shutdown -t5 -r now


Edit it to your likings...:)

bigperk420 11-05-2004 07:40 PM

hehe, good call, but: I was really trying to accually disable ctrl and alt keys themselves (which would have the effect of making the "three finger salute" un-doable but also disalow a slew of other meta cmds. . . Ctrl-C comes to mind and Alt-codes that would allow people messing around to screw stuff up. (input some of the symbols we are using for barcode-scanner which we need to be 'uncreatable' via the keyboard) so thanks, but no cigar, your leap of logic was slightly off, but makes perfect sense, thanx :)

-Justin PErkins

bigperk420 11-12-2004 03:00 PM

I have solved this problem to my satisfaction. I used the following advice to edit the keymap I want. I added a little shell script to my /etc/rc.d/rc.local file (last script to be run before login) that asks me which loadkeys file to load. This is how you edit that loadkey-file:

To modify the Control and Alt keys you can do the following:

At the root prompt:
(you must be root to do this)

# dumpkeys > keylist.txt

# vi keylist.txt

find the line that says "keycode 29 = Control" and edit it by pressing 'i'

you can change this to a number of values but leaving it blank will disable it.

do the same thing for:
keycode 56 and keycode 97 (or whatever keys you want to disable)

then save the file by typing ':wq!'

then type:

# loadkeys keylist.txt

which will add the edits you did.

scuzzman 11-12-2004 04:44 PM

Well congratulations on that... glad to see you worked it out. Thanks for making sure to put it here, too many people *don't* do that, so even if someone with the same questions does search, it doesn't do them any good.

jackjill 12-07-2004 05:53 PM

Disable Function keys
 
Hi all

i'm trying to diable Functions Keys, both Alt , Ctrl, Delete, and backspace keys. using X
using xmodmap but not working propery....please give ur professional ideaz...
i'm trying like this.
xmodmap -e 'clear Lock' \
-e 'keycode 0x42 = Control_L' \
-e 'add Control = Control_L' \
-e 'keycode 0x16 = BackSpace' \
-e 'keycode 0x6B = Delete' \
-e 'keycode 0x40 = ALT-L' \
-e 'keycode 0x7d = ALT-R' \
-e 'keycode 37 = F13' \
-e 'keycode 64 = F13' \
-e 'keycode 70 = F13' \
-e 'keycode 95 = F13' \
-e 'keycode 109 = F13' \
-e 'keycode 113 = F13'


is it seems to perfect ?


All times are GMT -5. The time now is 04:27 AM.