Feed Icon RSS 1.0 XML Feed available

Workaround for Broken Keys In TeamViewer with VirtualBox

Date: 26-Jun-2012/10:32

Tags: , ,

Characters: (none)

Having a remote desktop is pretty cool, although it can be a bit of a pain to set up. Especially if you're dealing with multiple platforms. So I was pleased to find a free (for non-commercial use) turnkey solution called TeamViewer. You don't even have to install the client or the host software...it runs straight out of the package, so administrative privileges aren't required.
In a matter of minutes I was controlling my quad-core i7 server from my little netbook. It wasn't blazingly fast even though the data is only carried on the local WiFi network, and I doubt their protocol is all that efficient under the hood. But for free I was happy.
Only problem is that one of my big things to do on the server is run lots of virtual machines, and number keys weren't getting fed properly into VirtualBox machines on the host. I wasn't the first person to hit this, and hk42 on experts-exchange tried a list of suggestions that didn't resolve the issue.
Note I will continue to urge everyone to NOT use ExpertSexChange...popups and login nonsense, the StackExchange network is more elegant by far, although it does have its own problems...
So I decided to try using the event-monitoring program xev to see what was going on. It turned out that pressing ordinary number keys on the client generated numeric keypad events inside the virtual machine. Since there were no such problems in ordinary programs on the host, it must be some kind of impedance mismatch between the virtualized keyboard and the remote keyboard. (Neither my client nor my host have a hardware numeric keypad.)
To fix this, I used a little set of xmodmap commands. I didn't bother making it a permanent thing in an .xmodmap file, because I don't know if I'm always going to want to do this remapping.
# teamviewerkeys.sh

# KP_End
xmodmap -e "keycode 87 = 1"

# KP_Down
xmodmap -e "keycode 88 = 2"

# KP_Next
xmodmap -e "keycode 89 = 3"

# KP_Left
xmodmap -e "keycode 83 = 4"

# KP_Begin
xmodmap -e "keycode 84 = 5"

# KP_Right
xmodmap -e "keycode 85 = 6"

# KP_Home
xmodmap -e "keycode 79 = 7"

# KP_Up
xmodmap -e "keycode 80 = 8"

# KP_Prior
xmodmap -e "keycode 81 = 9"

# KP_Insert
xmodmap -e "keycode 90 = 0"

# KP_Delete
xmodmap -e "keycode 91 = period"
Hopefully the authors of the products involved will fix this issue in a less hacky way. But for now this works for me!
Business Card from SXSW
Copyright (c) 2007-2018 hostilefork.com

Project names and graphic designs are All Rights Reserved, unless otherwise noted. Software codebases are governed by licenses included in their distributions. Posts on blog.hostilefork.com are licensed under the Creative Commons BY-NC-SA 4.0 license, and may be excerpted or adapted under the terms of that license for noncommercial purposes.