Tuesday, December 9, 2008

VMWare and key maps on Fedora 10

I am one of those poor souls who require Windows for some tasks. I wish, this weren't the case, but that's how things are. Fortunately, VMware Server comes to my rescue: A comparatively small VM of about 15GB is sufficient.

However, after my recent upgrade to Fedora 10, I suddenly noticed that some of my keys were no longer working in the VM: This included the arrow keys, but also some keys, which have been reachable via "Alt Gr" only, like '@', or '\'.

A quick search on Google revealed that I am far from being the only one bothered with that problem. In fact, the difficulties are more likely related to a Kernel upgrade. Users of Ubuntu 8.10 with a similar new kernel seem to suffer the same trouble. Fortunately, solutions were always at hand. For example, the VMware support suggests to use


xkeymap.usekeycodeMapIfXFree86 = true


or


xkeymap.usekeycodeMap = true


in ~/.vmware/config. Other sources proposed a list of explicit code settings instead, like


xkeymap.keycode.108 = 0x138 # Alt_R
xkeymap.keycode.106 = 0x135 # KP_Divide
xkeymap.keycode.104 = 0x11c # KP_Enter
xkeymap.keycode.111 = 0x148 # Up
xkeymap.keycode.116 = 0x150 # Down
xkeymap.keycode.113 = 0x14b # Left
xkeymap.keycode.114 = 0x14d # Right
xkeymap.keycode.105 = 0x11d # Control_R
xkeymap.keycode.118 = 0x152 # Insert
xkeymap.keycode.119 = 0x153 # Delete
xkeymap.keycode.110 = 0x147 # Home
xkeymap.keycode.115 = 0x14f # End
xkeymap.keycode.112 = 0x149 # Prior
xkeymap.keycode.117 = 0x151 # Next
xkeymap.keycode.78 = 0x46 # Scroll_Lock
xkeymap.keycode.127 = 0x100 # Pause
xkeymap.keycode.133 = 0x15b # Meta_L
xkeymap.keycode.134 = 0x15c # Meta_R
xkeymap.keycode.135 = 0x15d # Menu


In my case, none of these solutions worked completely. The hex codes were refused by VMware Server and the usekeycodemap stuff was fixing some keys, but not all. It turned out, that I had to convert the hex key codes to decimal in order to get it working. For the convenience of those who share my trouble, I post my settings here:


xkeymap.keycode.108 = 312 # Alt_R
xkeymap.keycode.106 = 309 # KP_Divide
xkeymap.keycode.104 = 284 # KP_Enter
xkeymap.keycode.111 = 328 # Up
xkeymap.keycode.116 = 336 # Down
xkeymap.keycode.113 = 331 # Left
xkeymap.keycode.114 = 333 # Right
xkeymap.keycode.105 = 285 # Control_R
xkeymap.keycode.118 = 338 # Insert
xkeymap.keycode.119 = 339 # Delete
xkeymap.keycode.110 = 327 # Home
xkeymap.keycode.115 = 335 # End
xkeymap.keycode.112 = 329 # Prior
xkeymap.keycode.117 = 337 # Next
xkeymap.keycode.78 = 70 # Scroll_Lock
xkeymap.keycode.127 = 256 # Pause
xkeymap.keycode.133 = 347 # Meta_L
xkeymap.keycode.134 = 348 # Meta_R
xkeymap.keycode.135 = 349 # Menu

2 comments:

Anonymous said...

Thanks a bunch! I've spent a couple of hours trying to figure this out.

A tip for those running Ubuntu 8.10:
If you have trouble with key mappings, and quick and easy fix is to add this to your /etc/vmware/config file:
xkeymap.noKeycodeMap = "TRUE"
This fixed everything but the "Alt Gr" and the "Page Up" and "Page Down" buttons.

Anonymous said...

Thanks a lot,
I made an upgrade from ubuntu 8.04 to 8.10 and finally 9.04 Jaunty.
I had the same trouble with a french keyboard and vmware server2.
Your tip is the best I found because other didn't work or worked partially.