If you’ve been following my attempts to get the brightness up/down and other fn-keys on my Samsung Q320 laptop to work in Linux, you might like to know the saga has reached a happy conclusion. Previously I published a hack to the atkbd kernel driver to get these problematic keys to send key release events. My attempt to get this included in the kernel failed, but I was told the 2.6.32 kernel would contain a new mechanism for fixing this from userspace.

Well, 2.6.32 is here so how can we fix the fn-key release problem? Documentation for the new sysfs attribute is a bit scanty as it’s intended to be used only by udev/HAL/DeviceKit, but you can set it yourself quite easily. The relevant file is /sys/devices/platform/i8042/serio0/force_release – this lets you manipulate a bitmap in atkbd.c indicating which scancodes don’t send key release events.

echo 130-132,134,136,137,179,247,249 \
    > /sys/devices/platform/i8042/serio0/force_release

The bitmap editing syntax is quite nice – done in lib/bitmap.c rather than the atkbd driver itself. I got those scancodes from the array atkbd_samsung_forced_release_keys in atkbd.c. They were originally intended for the NC20 but the Q320 keyboard seems to be the same. It works for me anyway.

You still need to map the brightness up/down keys to the correct X11 codes, which you can do like this:

setkeycodes e008 225 e009 224

Job’s a good’un.

All my Samsung Q320 coverage is here.