I-Appliance BBS
The Official Source for Internet Appliance Upgrades and Mods
Amazon Honor System Click Here to Pay Learn More
BBS Main List | Sign In | Sign Up | Search | Help | Linux-Hacker.netReply to Thread | Printer |

Home / Other I-Appliances / MSN Companion
Useful keyboard remapping under Linux

New MessageUseful keyboard remapping under Linux (modified 0 times) haniam
Profile
Here's a script you can use as a starting point to remap your keyboard. In this
configuration, I have mapped all the extra keys at the top of the keyboard to the
typical top row of an IBM keyboard (ESC,F1,F2,F3...) All are remapped except the power
key.

I wanted this so I could use virtual terminals (CTRL-ALT-F1,F2,F3,F4). You might want
to adjust the getty lines for tty3 and tty4 in /etc/inittab in the jailbait image if
you also want to do this.

#!/bin/sh

K=/usr/bin/setkeycodes

## Keyboard remapping for Compaq IA-1 keyboard
## Top row "extra" keys, left to right, starting with "-" and ending with "$"
$K e02e 01 # ESC
$K e030 59 # F1
$K e020 60 # F2
$K e016 61 # F3
$K e013 62 # F4
$K e01e 63 # F5
$K e015 64 # F6
$K e057 65 # F7
$K e01f 66 # F8
$K e014 67 # F9
$K e023 68 # F10
$K e021 87 # F11
$K e032 88 # F12

12-18-2001 06:50:18

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) Root
Profile
Can you post more specific instructions on what files should be modified to include these defintions?

Root©

12-18-2001 08:08:32

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) bballctaulbee
Profile
- correct me if i'm wrong, but this little script can be used to dynamically change the keyboard mapping upon booting... i'd type the script into a text file (after mounting / read-write):

vi mykeys

- enter the text, then :wq! to save, then use the chmod command to make executable and copy to /usr/bin or /bin:

chmod +x mykeys ; mv mykeys /bin

- next, i'd add the entry to the boot script /etc/init.d/bootmisc.sh

vi /etc/init.d/bootmisc.sh

/bin/mykeys

- save the file :wq! and run the script (it will be run the next time you boot):

/bin/mykeys

- this is only one approach, mind you, but i assume the mappings also work under X?

hth,

bball

12-18-2001 09:47:52

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) haniam
Profile
I haven't gotten the keyboard mappings to work under X yet. I can switch to the virtual
terminals using the chvt utility, but that's not ideal. I will post a solution if I find one.
12-18-2001 19:35:19

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) TheRogue0829
Profile
I think getting X to recognize them requires xmodmap, or hacking some file that defines the X keyboard map. I know that xmodmap is not in the default Jailbait image and I don't know where the mapfile is. If I find it I'll post the location here.

=TheRogue

12-23-2001 01:20:18

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) Doogman
Profile
As someone who has done this keyboard remapping with my I-Opener, perhaps I can help you a bit.

You have 2 different "keyboard" modes in Linux (actually 3 if you count SVGAlib), one for the console and one for X. You already got the console working, so the next is for X. As Rogue said, you need to modify the Xmodmap file. It should be located: /etc/X11/Xmodmap. I believe you can also have a personal .Xmodmap file in your home directory.

Note: Just to keep things interesting, the key codes are not the same for the console and X! Here's the files I used for my Iopener:

[doug@celeron iopener]$ cat Xmodmap
keycode 22 = BackSpace
keycode 97 = Insert
keycode 106 = Home
keycode 115 = Escape

[doug@celeron iopener]$ cat iokeys_console
/usr/bin/loadkeys << EOF
keycode 125 = Escape
keycode 102 = Insert
keycode 110 = Find
EOF

Notice the different keycodes! Also notice you only need the codes you want to change from the default. You can use the program xev to get the X keycode numbers.

12-25-2001 19:26:33

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) iderdik
Profile
How would we get this to work in Midori where we don't have write access to anything but /tmp ?
02-20-2002 09:10:19

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) wildwildwes
Profile
There's a file /tmp/config/local/sbin/init that runs at startup. You can edit it and freeze the configuration to add your own commands, but the key mappings will be in the next version if you'd rather wait.
02-20-2002 13:46:11

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) iderdik
Profile
I know that but there seems to be a different place to get these keys to work under X. I'm still very new to Linux as a whole, let alone Midori and I'm soooooooo confused. BTW great work on the current images wildwildwest, i find it much more usable then anything else out there!!!
02-20-2002 14:01:51

New MessageRE:Useful keyboard remapping under Linux (modified 0 times) wildwildwes
Profile
Thanks for the compliment.

I haven't tried using it yet, but xmodmap is included in the image. See the man page for usage instructions: http://www.xfree86.org/4.2.0/xmodmap.1.html

But unless it's urgent or you have specific key needs, I will be putting out a new one in a few days using the top buttons.

02-20-2002 23:45:07

Reply to Thread | Printer |
All times are PSTPowered by UltraBoard v1.62



Copyright © 2000, Netmake Inc. All Rights Reserved.
See Terms and Conditions for more information.




i-opener opener laptop notebook computer help drivers dll free windows dos repair fix linux mac macintosh 2000 95 98 nt pc configure hardware software sound video netscape explorer network networking lan wan software cmos fat bios printer card mouse modem ide scsi cd rom controllers scanner tape hard drive cgi scripts source code mp3