Touchpad Bluetooth Keyboard

Keycode/Scancode for Media/Specialty Keys
Hopefully this information will make it easier to implement support for the HP Touchpad Bluetooth Keyboard on other devices such as a Pre2 or Veer.

Using various tools under Ubuntu 11.04, I haven't been able to get info for Keyboard, Brightness Down, and Brightness Up. These keys may need a Touchpad device to get the information for, as the keys are known working there. --SineOtter 07:34, 9 September 2011 (UTC)

Keyboard layouts
The keymaps are located in the /usr/share/qt4/keymaps directory. There are 3 of them: keymap-us.qmap, keymap-de.qmap, keymap-fr.qmap. The keymap is loaded after the keyboard was successfully paired with the touchpad.

kmap2qmap is a tool to generate keymaps in qmap format (http://doc.qt.nokia.com/latest/qt-embedded-kmap2qmap.html). Original kmap2qmap source file was downloaded from http://svn.netlabs.org/repos/qt4/trunk/tools/kmap2qmap/main.cpp, then some changes from http://palm.cdnetworks.net/opensource/3.0.2/qt4-4.7.1-patches.gz were applied. Download the patched kmap2qmap.cpp and compile it:

gcc -o kmap2qmap kmap2qmap.cpp -I/usr/include/qt4 -I/usr/include/qt4/QtCore -lQtCore

Now grab the kmap file, modify it if you want and generate the qmap file with:

./kmap2qmap us.kmap keymap-us.qmap

The us.kmap file was generated with ckbcomp (it's in the console-setup package in Debian) and then the touchpad related keys were added:

ckbcomp -keycodes evdev -layout us -compact > us.kmap

There is also a modified kmap file with CapsLock changed to Control key, added AltGr and germanic umlauts mapped to AltGr+[aous]. You can take this kmap as a reference or just diff it with the us.kmap to see what should be changed.

It is possible to create new layouts (with dvorak, colemak, cyrillic or whatever you want), but there is still no way to switch layouts on the fly.

UK / US keyboard differences
UK keyboard has Alt Gr instead of Symbol key. To get that key work with the above kmap file you need to change the following line: keycode 100 = Alt Alt Alt Alt Alt Alt Alt Alt Alt Alt --> keycode 100 = AltGr AltGr AltGr AltGr AltGr AltGr AltGr AltGr AltGr AltGr Naturally the kmap needs some other changes as well if you want to make the us kmap into proper uk one, but at least with this change you get the Alt Gr working as it should (i.e. the secondary keys start to work such as Alt Gr+a).