Frank Ridderbusch


About things, that are of interest to me (in English and in German).


Sun Type 6 Keyboard

I’ve written about my issues with my SUN Type6 keyboard in the company. I’ve finally found a 100% satisfactory solution. In the end, all fiddling with xmodmap and setxkbmap didn’t really help. To really fix my issues I needed to edit the file /usr/share/X11/xkb/keycodes/evdev to shuffle some keycodes around.

In the end I made these changes (relative to the directory /usr/share/X11/xkb/keycodes):

--- keycodes.dir.org    2009-09-03 08:31:32.000000000 +0200
+++ keycodes.dir    2009-10-06 12:58:54.000000000 +0200
@@ -46,6 +46,7 @@
 -------- -------- sony(nwp5461)
 -d------ -------- evdev(evdev)
 -------- -------- evdev(pc98)
+-------- -------- evdev(type6)
 -d------ -------- xfree86(xfree86)
 -------- -------- xfree86(basic)
 -------- -------- xfree86(102)
-- keycodes/evdev.org   2009-09-03 08:31:32.000000000 +0200
+++ keycodes/evdev  2009-10-06 12:59:32.000000000 +0200
@@ -311,3 +311,10 @@
     include "evdev(evdev)"
 };

+// Sun Type 6
+xkb_keycodes "type6" {
+    include "evdev(evdev)"
+    <RCTL> = 108;
+    <RALT> = 134;
+    <RWIN> = 105;
+};
--- rules/evdev.org 2009-09-03 08:31:34.000000000 +0200
+++ rules/evdev 2009-10-06 13:00:04.000000000 +0200
@@ -105,6 +105,7 @@
 ! $dvoraklayouts = br ca de ee es fr gb no pl se us

 ! model        =   keycodes
+  type6        =   evdev(type6)
   pc98     =   evdev(pc98)
   *        =   evdev

With the above changes I was additionally able to modify the file /etc/hal/fdi/policy/10-x11-input.fdi so that HAL will do the right thing, once this keyboard is plugged in (see the line with input.product).

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keys">
      <merge key="input.xkb.rules" type="string">evdev</merge>
      <merge key="input.xkb.layout" type="string">de</merge>
      <match key="input.product" contains="HID 0430:0005">
        <merge key="input.xkb.model" type="string">type6</merge>
      </match>
    </match>
  </device>
</deviceinfo>

Make sure, that your desktop environment uses the system settings and doesn’t override it with session local settings, when you log into your desktop. If everything is correct, the /var/log/Xorg.0.log should contain something like this:

...
(II) config/hal: Adding input device HID 0430:0005
(**) HID 0430:0005: always reports core events
(**) HID 0430:0005: Device: "/dev/input/event0"
(II) HID 0430:0005: Found keys
(II) HID 0430:0005: Configuring as keyboard
(II) XINPUT: Adding extended input device "HID 0430:0005" (type: KEYBOARD)
(**) Option "xkb_rules" "evdev"
(**) Option "xkb_model" "type6"
(**) Option "xkb_layout" "de"
...

While the above changes may be the 100% solution, there is still the danger, that the changes are overwritten, when new keyboard tables are installed. For Gentoo Linux it is therefore advisable to extend the CONFIG_PROTECT variable in /etc/make.conf with the directories /usr/share/X11/xkb/keycodes and /usr/share/X11/xkb/rules.

The simplest solution however may be to copy the file /usr/share/X11/xkb/keycodes/evdev to a new file /usr/share/X11/xkb/keycodes/evdev-new, edit the keycode changes into this file and then load the keycodes by executing “setxkbmap -keycodes evdev-new(type6)” somewhere in the login process (.xprofile or .xinitrc or whereever).