OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: Antikx on January 13, 2006, 04:50:09 pm

Title: Reconfigure The Keys On A Usb Keyboard
Post by: Antikx on January 13, 2006, 04:50:09 pm
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 (http://www.adesso.us/product_details.asp?dept%5Fid=106&pf%5Fid=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.
Title: Reconfigure The Keys On A Usb Keyboard
Post by: desertrat on January 13, 2006, 11:42:01 pm
Quote
#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: [Select]
xmodmap /etc/X11/kb/XMODMAP_FILEThat'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
Title: Reconfigure The Keys On A Usb Keyboard
Post by: Antikx on January 14, 2006, 08:59:16 am
Thanks Desertrat. I'll give it a try and report back.
Title: Reconfigure The Keys On A Usb Keyboard
Post by: Antikx on February 01, 2006, 12:34:57 pm
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).
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?
Title: Reconfigure The Keys On A Usb Keyboard
Post by: anunakin on February 13, 2006, 10:42:36 am
I bought a mini USB Keyboard, and do some work at this, my solutions is here:
The keyboard
Title: Reconfigure The Keys On A Usb Keyboard
Post by: Antikx on February 13, 2006, 10:37:52 pm
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
Title: Reconfigure The Keys On A Usb Keyboard
Post by: anunakin on February 14, 2006, 11:18:08 am
Quote
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
[div align=\"right\"][a href=\"index.php?act=findpost&pid=114720\"][{POST_SNAPBACK}][/a][/div]


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)
Title: Reconfigure The Keys On A Usb Keyboard
Post by: Kondou on March 13, 2006, 12:15:14 am
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?
Title: Reconfigure The Keys On A Usb Keyboard
Post by: Drake01 on August 24, 2006, 10:49:07 am
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.
Title: Reconfigure The Keys On A Usb Keyboard
Post by: daniel3000 on August 26, 2006, 10:05:50 am
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