Help - Search - Members - Calendar
Full Version: Reconfigure The Keys On A Usb Keyboard
OESF Forums > Distros, Development, and Model Specific Forums > Distro Support and Discussion > pdaXrom
Antikx
From doing a search there seems to be a bunch of people trying to figure out how to remap keys on USB keyboards under pdaXrom.

I have a sexy little Adesso USB keyboard and would like to get better use out of it:
http://www.adesso.us/product_details.asp?d...KA33KBAKB%2D901

Most keys work OK, but a few do not work at all, or aren't correct. The period on the USB keyboard works when I'm not in X... but in X it starts up XMMS.

I'm guessing that if someone wants to customize the key bindings for a USB keyboard we will have create a separate kernel.map file and swap it out when we want to use the USB keybaord. Please correct me if my train of thought is not correct.

If my train of thought isn't derailed then:
#1. What method do you use to find the keycode that matches the key you are pressing on the USB keyboard.
#2. Can the keybindings be updated in X without having to restart X. " /usr/bin/loadkeys /etc/sysconfig/keyboard/kernel.map" does not seem to work.

Thanks in advance for any help.
desertrat
QUOTE(Antikx @ Jan 13 2006, 09:50 PM)
#1. What method do you use to find the keycode that matches the key you are pressing on the USB keyboard.

For X, use xev (run it from a terminal).

QUOTE
#2. Can the keybindings be updated in X without having to restart X. " /usr/bin/loadkeys /etc/sysconfig/keyboard/kernel.map" does not seem to work.

X keybindings are stored in /etc/X11/kb/, and you need to use:
CODE
xmodmap /etc/X11/kb/XMODMAP_FILE

That's about the extent of my knowledge wrt to keybindings and such on pdaxrom. In fact I'm trying to figure out how to "unmap" the bindings for the 'Calender' and 'Address' buttons -- currently they're mapped to CTRL and ALT respectively, an unnecessary duplication IMHO. I would rather use these keys for launching programs.

-- cheers
Antikx
Thanks Desertrat. I'll give it a try and report back.
Antikx
Got some good news!
I've remapped all the key, setup some scripts to change the config and it works great now.
I want to post the instructions but I have one problem I would like to solve first.
When I press and hold down the left and up keys on the USB keyboard it does not repeat like the other two direction keys. I think it may have something to do with the keycodes, but I'm no X expert (no pun intended). smile.gif
The keycodes are 129 for LEFT and 130 for UP. Like I said DOWN (131) and RIGHT (132) do work.
All four direction keys (on the Zaurus keyboard) work when I switch back to the zaurus keyboard config.

Where are the config options for repeating keys in X?
anunakin
I bought a mini USB Keyboard, and do some work at this, my solutions is here:
The keyboard

http://www.hampton-technologies.com/WK-610.htm

1- A new .xinitrc file, one new IF to detect KEYBOARD and load layout map file:

QUOTE
#!/bin/sh
#
# Very simple session manager for matchbox tools
#

test -e /proc/power_key_off && echo "0" >/proc/power_key_off 2>/dev/null

test -f /etc/profile && . /etc/profile

# Uncomment below to enable parsing of debian menu entrys
# export MB_USE_DEB_MENUS=1

if [ -e $HOME/.matchbox/session ]
then
    exec $HOME/.matchbox/session
fi

if [ -e /etc/matchbox/session ]
then
    exec /etc/matchbox/session
fi

if [ ! -d $HOME/Choices/common ]; then
    mkdir -p $HOME/Choices/common
fi

if [ -f $HOME/Choices/lightnpower.cfg ]; then
    lightnpower.py --loadandquit
fi

if [ -f /usr/bin/gconfd-2 ]; then
    /usr/bin/gconfd-2 15 &
fi


test -f /proc/bus/usb/devices && KEYBOARD=`cat /proc/bus/usb/devices | grep keyboard`
if [ -z "$KEYBOARD" ]; then

MODEL=`cat /proc/deviceinfo/product`
echo 'MODEL:'$MODEL
case "$MODEL" in
    SL-C860|SL-C760|SL-C750|SL-7500|SL-C700)
        test -f /etc/X11/kb/corgi.xmodmap && xmodmap /etc/X11/kb/corgi.xmodmap
        ;;
    SL-6000)
        test -f /etc/X11/kb/tosa.xmodmap && xmodmap /etc/X11/kb/tosa.xmodmap
        ;;
    SL-C1000|SL-C3000|SL-C3100)
        test -f /etc/X11/kb/akita.xmodmap && xmodmap /etc/X11/kb/akita.xmodmap
        ;;
    *)
        cat /proc/cpuinfo | grep 'Sharp-Collie' 2>/dev/null >/dev/null && test -f /etc/X11/kb/collie.xmodmap && xmodmap /etc/X11/kb/collie.xmodmap
        ;;
esac

test -f /etc/X11/kb/userdefined.xmodmap && xmodmap /etc/X11/kb/userdefined.xmodmap

else
echo "KEYBOARD FOUND..."
test -f /etc/X11/kb/abnt2.map && xmodmap /etc/X11/kb/abnt2.map
fi


test -f /usr/bin/chkhinge && /usr/bin/chkhinge 2>/dev/null >/dev/null

openbox 2>/dev/null >/dev/null &

touch /tmp/.mb-restart

while [ -f /tmp/.mb-restart ];
do

rm -f /tmp/.mb-restart

if [ -f $HOME/.matchbox/mb-desktop-background ]; then
    MBBGND=`cat $HOME/.matchbox/mb-desktop-background`
else
    MBBGND=""
fi

if [ -f $HOME/.matchbox/mb-panel-orientation ]; then
    MBORIENT=`cat $HOME/.matchbox/mb-panel-orientation`
else
    MBORIENT="--orientation south"
fi
/usr/X11R6/bin/xset s 0

eval "matchbox-desktop $MBBGND" 2>/dev/null >/dev/null &
eval "matchbox-panel --no-flip $MBORIENT" 2>/dev/null >/dev/null

for PID in `ps x | grep "mb-applet-*" | grep -v "grep" | sed 's/^ *//' | cut -f1 -d' ' -`
do
    kill $PID 2>/dev/null >/dev/null
done

done

GCONF2_PID=`pidof gconfd-2`
if [ ! "$GCONF2_PID" = "" ]; then
    kill $GCONF2_PID
fi

test -e /proc/power_key_off && echo "1" >/proc/power_key_off 2>/dev/null


2- I build a complete map file, for use with ABNT2 Keyboard for use with Brazilian Keyboards.
/etc/X11/kb/abnt2.map
CODE
! ------------ User defined keys ------------
keycode   8 =
keycode   9 = a A ae AE
keycode  10 = b B
keycode  11 = c C copyright
keycode  12 = d D eth ETH
keycode  13 = e E EuroSign
keycode  14 = f F dstroke ordfeminine
keycode  15 = g G eng ENG
keycode  16 = h H hstroke Hstroke
keycode  17 = i I rightarrow idotless
keycode  18 = j J
keycode  19 = k K kra ampersand
keycode  20 = l L lstroke Lstroke
keycode  21 = m M mu
keycode  22 = n N
keycode  23 = o O oslash Ooblique
keycode  24 = p P thorn THORN
keycode  25 = q Q at Greek_OMEGA
keycode  26 = r R registered
keycode  27 = s S ssharp section
keycode  28 = t T tslash Tslash
keycode  29 = u U downarrow uparrow
keycode  30 = v V leftdoublequotemark grave
keycode  31 = w W lstroke Lstroke
keycode  32 = x X
keycode  33 = y Y leftarrow yen
keycode  34 = z Z
keycode  35 = Shift_L
keycode  36 = Return
keycode  37 = Insert
keycode  38 = F11
keycode  39 = BackSpace
keycode  40 = Num_Lock
keycode  41 = F1
keycode  42 = Escape
keycode  43 = Left
keycode  44 = Up
keycode  45 = Down
keycode  46 = Right
keycode  47 = F4
keycode  48 = F12
keycode  49 = 1 exclam onesuperior exclamdown
keycode  50 = 2 quotedbl at twosuperior
keycode  51 = 3 numbersign sterling threesuperior
keycode  52 = 4 dollar section onequarter
keycode  53 = 5 percent cent threeeighths
keycode  54 = 6 ampersand
keycode  55 = 7 slash braceleft seveneighths
keycode  56 = 8 parenleft bracketleft trademark
keycode  57 = 9 parenright bracketright plusminus
keycode  58 = 0 equal braceright degree
keycode  59 = apostrophe question
keycode  60 = less greater guillemotleft guillemotright
keycode  61 = backslash bar
keycode  62 = dead_acute dead_grave dead_doubleacute
keycode  63 = plus asterisk dead_diaeresis
keycode  64 = Control_L
keycode  65 = Alt_L
keycode  66 = F2
keycode  67 = minus at
keycode  68 = Caps_Lock
keycode  69 =
keycode  70 =
keycode  71 = slash comma
keycode  72 =
keycode  73 = Tab Caps_Lock
keycode  74 =
keycode  75 =
keycode  76 =
keycode  77 = Alt_L
keycode  78 = backslash bar
keycode  79 = KP_1
keycode  80 = KP_2
keycode  81 = KP_3
keycode  82 = KP_4
keycode  83 = KP_5
keycode  84 = KP_6
keycode  85 = KP_7
keycode  86 = KP_8
keycode  87 = KP_9
keycode  88 = KP_0
keycode  89 = Delete
keycode  90 = KP_Divide
keycode  91 = KP_Multiply
keycode  92 = Return
keycode  93 = KP_Subtract
keycode  94 = KP_Add
keycode  95 = KP_Enter
keycode  96 = F5
keycode  97 = F6
keycode  98 = F7
keycode  99 =
keycode 100 = space
keycode 101 = KP_Decimal
keycode 102 = F3
keycode 103 = ccedilla Ccedilla
keycode 104 = Insert
keycode 105 = dead_tilde dead_circumflex asciitilde asciicircum
keycode 106 = comma semicolon horizconnector multiply
keycode 107 = period colon
keycode 108 = minus underscore
keycode 109 = underscore
keycode 110 =
keycode 111 = period question
keycode 112 = Home
keycode 113 = End
keycode 114 = Prior
keycode 115 = Next
keycode 116 =
keycode 117 =
keycode 118 = F8
keycode 119 = Control_R
keycode 120 = Shift_R
keycode 121 = Mode_switch
keycode 122 =
keycode 123 = Print Sys_Req
keycode 124 =
keycode 125 = F9
keycode 126 =
keycode 127 =
keycode 128 = F10
keycode 129 = Left
keycode 130 = Up
keycode 131 = Down
keycode 132 = Right
keycode 133 =
keycode 134 =
keycode 135 =

!MOD KEYs
clear Shift
add Shift   = Shift_L Shift_R

clear Lock
add Lock    = Caps_Lock

clear Control
add Control = Control_L Control_R

clear Mod1
clear Mod2
clear Mod3
clear Mod4
clear Mod5

add Mod1 = Alt_L
add Mod2 = Num_Lock
add Mod3 = Mode_switch
add Mod5 = Meta_L


Insert key dont working, but all function key works and I remaped INSERT to another key.... cool.gif
Antikx
hee hee.
You beat me to it. Good job.
The repeating key problem I was having seemed to just go away. Strange.
It looks like you have a slicker setup than mine and I may borrow from it of that's OK.
My way is less automatic, you have to press a key on the keyboard to switch back and forth between the keyboards, although the Zaurus keyboard is almost entirely usable when you're using the USB kbd mapping.

Download the file attached in this post and take the ".txt" off of the end and extract it.
Here's the contents of the "install" file:

To get Adesso USB kbd working under pdaXrom:
================================
1. vi /etc/X11/kb/akita.xmodmap
remove the remarks from the number bindings
remark out the CE-RH1 Remote part
2. copy the adesso.xmodmap file into /etc/X11/kb/
3. copy the two files, zkbd and akbd into /usr/local/bin
4. run "chmod +x" on each file to make sure they are executable
5. assign zkbd and akbd to two of your application keys
6. vi /etc/sysconfig/keyboard/kernel.map amd make it look like this (make a backup of the file first if you want):
keycode 65 = Tab
alt keycode 65 = Caps_Lock
shift keycode 65 = Caps_Lock
control keycode 65 = Caps_Lock
keycode 27 = Shift
keycode 88 = Control
keycode 89 = Alt
keycode 112 = Shift
keycode 120 = Shift

***All done!***

special note:
1. special commands can be found here:
vi /usr/X11R6/lib/X11/XKeysymDB
2. the pipe/backslash key doesn't work
3. the fn key doesn't work
4. numlock doens't work properly
anunakin
QUOTE(Antikx @ Feb 14 2006, 03:37 AM)
hee hee.
You beat me to it. Good job.
The repeating key problem I was having seemed to just go away. Strange.
It looks like you have a slicker setup than mine and I may borrow from it of that's OK.
My way is less automatic, you have to press a key on the keyboard to switch back and forth between the keyboards, although the Zaurus keyboard is almost entirely usable when you're using the USB kbd mapping.

Download the file attached in this post and take the ".txt" off of the end and extract it.
Here's the contents of the "install" file:

To get Adesso USB kbd working under pdaXrom:
================================
1. vi /etc/X11/kb/akita.xmodmap
  remove the remarks from the number bindings
  remark out the CE-RH1 Remote part
2. copy the adesso.xmodmap file into /etc/X11/kb/
3. copy the two files, zkbd and akbd into /usr/local/bin
4. run "chmod +x" on each file to make sure they are executable
5. assign zkbd and akbd to two of your application keys
6. vi /etc/sysconfig/keyboard/kernel.map amd make it look like this (make a backup of the file first if you want):
keycode 65 = Tab
        alt    keycode 65 = Caps_Lock
        shift  keycode 65 = Caps_Lock
        control keycode 65 = Caps_Lock
keycode 27 = Shift
keycode 88 = Control
keycode 89 = Alt
keycode 112 = Shift
keycode 120 = Shift

***All done!***

special note:
1. special commands can be found here:
  vi /usr/X11R6/lib/X11/XKeysymDB
2. the pipe/backslash key doesn't work
3. the fn key doesn't work
4. numlock doens't work properly
*



Notes for my solution:
1- This needs restart Xfree
2- Insert, remaped to Windows Key
3- Numlock dont work too
4- Fn Works
5- TAB turn on Caps Light but back off when release
6- CapsLock working
7- AltGR works (all special characters, like €, £, ¢, ...)
8- Function Keys working (F1~F12)
Kondou
how to read & modify the keymap tab? have 4 column
and how to gat all key name table (eg. Lift, apostrophe, question)

exp:

keycode 14 = f F dstroke ordfeminine

14 is keycode, f F is show Character, dstroke ordfeminine is what?
Drake01
Can anyone explain how keyboards are handled on the Z? I understand that there are two levels of keymapping, and apparently xmodmap is layered on top of the basic keymapping. But there must be something else going on, as well.

I recently reverted my C1000 back to pdaxrom b3. My USB keyboard worked well enough in b4 that I haven't bothered spending a lot of time trying to perfect it. But b3 is mismapped enough that I really need to change some things.

One thing I noticed is that my keyboard can take on one of two underlying mappings. One corresponds to the Z keyboard and is nearly usable. But sometimes it is mapped like a standard US 101 keyboard, which is quite different from the keycodes assigned to the Z keyboard. It seems that I get the "standard" mapping if the Z discovers both the mouse and the keyboard at the same time. If the Z is awake and I plug in the keyboard first, the USB keyboard picks up similar keycodes to the Z keyboard.

So, if I do get the USB keyboard working, but the Z goes to sleep... I'd need to pull out the mouse before I wake it or the keymapping will change and become unusable. Does anyone know what controls this?

Also, I'm testing a simple script to use xmodmap to remap the keyboard so that I can switch between the Z keyboard and the USB. But when I try switching back to the Z from the USB mapping, it doesn't completely switch back. I'm telling it to map to the akita.xmodmap, because I'm pretty sure this is the default mapping and the file contents look right. This doesn't seem to be working, however. Am I doing something obviously wrong? A reboot corrects the situation, but I'm not sure where to start looking to find whatever got changed. Is it possible that it's the lower level keymapping (would this be kernel level?) that is changed at this point?

In the past I've tried a couple of things to change the keymapping, including some of the stuff from this thread. No luck so far, but I'm determined to get it working this time.

Thanks.
daniel3000
Well, and how about automatic switching of modmaps without xfree restart?
Couldn't a script in the hotplug config do this switching dependent on what keyboard is connected?
I don't know enough about this hotplug mechanism to solve this without much investigation.
And I don't know if an xmodmap MODMAPFILE changes the keyboard mapping even without restarting X.

Any ideas?

daniel
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.