2

In Debian Sqeeze, I created a script called /etc/init.d/capslock that contains this:

#!/bin/sh
echo "Remapping Caps Lock key to Escape"
setkeycodes 0x3a 1
echo " ...done"

I made it executable, and linked it to /etc/rc2.d/S95capslock. When I run it from the command line, it works. But it doesn't fire on a reboot for some reason. Am I missing a step?

2 Answers 2

2

That looks like a useful snippet, but when I try it, I get the error "KDSETKEYCODE: Invalid argument".

Anyway, for Squeeze, you should probably use insserv to manage your init scripts. Add a header to the script like so:

### BEGIN INIT INFO
# Provides:       capslock-remap
# Required-Start: $all
# Required-Stop:  
# Default-Start:  2 3 4 5
# Default-Stop:   
# Description:    Remap CapsLock to Escape
### END INIT INFO

And then run insserv:

insserv capslock
2
  • You must have posted right after I replied to my own question. In the spirit of points, you can have the answer. Nov 21, 2011 at 2:24
  • Yeah, I hit the post button and your answer showed up as "one minute ago"! Thanks for the points. :) Nov 21, 2011 at 16:52
0

I used the command insserv capslock and everything started working.

Also, I needed to add an LSB header:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          capslock
# Required-Start:    
# Required-Stop:     
# Default-Start:     1 2 3 4 5 6
# Default-Stop:      
# Short-Description: 
# Description:       Remaps Caps Lock key to Escape
### END INIT INFO
setkeycodes 0x3a 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .