How to make keyboard backlight Fn buttons work in Samsung Series 9?

Solution 1:

I bought the exact same model (900X4C) a couple of days ago and I've successfully seen the F9/F10 keys work, and I didn't even had to install the Voria / samsung-tools package either - I just fiddled around with the /lib/udev/keymaps/samsung-other file and the corresponding force-release file.

Unfortunately, I messed up the install process (I wasn't running Ubuntu in UEFI mode and I had swap) and I decided to reinstall, since then I was unable to replicate the working keyboard backlight.

I just felt like that was something that may help others more knowledgeable to find a solution.


Here are a couple of (perhaps useful) resources I came across:

  • http://blog.nonobis.nl/?p=11
  • https://help.ubuntu.com/community/SamsungSeries9
  • http://www.rileybrandt.com/2012/11/18/linux-ultrabook/
  • https://bugs.launchpad.net/ubuntu/+source/udev/+bug/1203592
  • https://github.com/chris-martin/samsung-900x4c/tree/master/etc/udev
  • http://jablonskis.org/2011/fedora-16-linux-on-samsung-series-9-np900x3a/
  • http://everydaywithlinux.blogspot.pt/2012/10/samsung-np900x4c-and-fedora-17.html

Also, a couple of experiments and results...


Doing:

cat /sys/class/dmi/id/product_name

Returns:

900X3C/900X3D/900X3E/900X4C/900X4D (matched by samsung-other)

After a fresh install of Ubuntu 13.04 and update this is what I get:

  • F1 (Settings) - Doesn't Work
  • F2 (- Screen Brightness)
  • F3 (+ Screen Brightness)
  • F4 (Toggle Video Mode)
  • F5 (Toggle Clickpad)
  • F6 (Mute)
  • F7 (- Volume)
  • F8 (+ Volume)
  • F9 (- Keyboard Backlight) - Doesn't Work
  • F10 (+ Keyboard Backlight) - Doesn't Work
  • F11 (Fan / Toggle CPU Speed) - Doesn't Work
  • F12 (Toggle WiFi) - Doesn't Work

I also managed to get the correct keymap codes for this exact model by doing /lib/udev/keymap -i input/event3 and gathering the output when I pressed a FN + Fx key combination:

0xCE    prog1           # F1
0x89    brightnessdown  # F2
0x88    brightnessup    # F3
0x82    switchvideomode # F4
0xF7    f22             # F5
0xF9    f23             # F5
0xA0    mute            # F6
0xAE    volumedown      # F7
0xB0    volumeup        # F8
0x97    kbdillumdown    # F9
0x96    kbdillumup      # F10
0xB3    prog3           # F11, "silent" isn't recognized
0xD5    wlan            # F12

You can use showkey to get the decimal code representation for the combination pressed.

Remember to call the following commands afterwards:

sudo udevadm control --reload-rules
sudo /lib/udev/keymap input/event3 /lib/udev/keymaps/samsung-other

I'm sort of giving up on this for now but if anyone gets it right, let me know!


PS: While experimenting, I just noticed 2 interesting things:

  1. If you comment and reload all the default keymap rules, everything still works (why?)
  2. If you use the github rules I liked to, once you press F9/F10 you can't type anymore anywhere

The point #2 makes me suspect the keys are not being released.

# Set model specific atkbd force_release quirk
#
# Several laptops have hotkeys which don't generate release events,
# which can cause problems with software key repeat.
# The atkbd driver has a quirk handler for generating synthetic
# release events, which can be configured via sysfs since 2.6.32.
# Simply add a file with a list of scancodes for your laptop model
# in /usr/lib/udev/keymaps, and add a rule here.
# If the hotkeys also need a keymap assignment you can copy the
# scancodes from the keymap file, otherwise you can run
# /usr/lib/udev/keymap -i /dev/input/eventX
# on a Linux vt to find out.

The above was taken from /lib/udev/rules.d/95-keyboard-force-release.rules.

Solution 2:

Is it possible there is bios options/settings for light and fan?

Simply Googling your laptop model reveals results including pages that show your laptop will need a darkened room for keyboard back light to come on as there is a sensor to automatically switch keyboard back light accordingly to available light levels. This may be the cause of indicator showing brightness levels with no apparently working backlight . The settings for these are available through Windows after installing Easy Settings. Series 9 Easy Settings

You could download Easy Settings from manufacturers webite after making sure you have the exact model or are on the right page for your specific model. That is if you have a Windows to use to at least confirm everything does work as expected.

The Community Documentation confirms the scancodes at least are the same for 9 series and includes your model as being confirmed working after configuration i.e. installing kernel module and editing two files.
Here is quote from https://help.ubuntu.com/community/SamsungSeries9

Solution to Question

Try to methodically read the posted links given. try the other options. i.e. alternative instructions through which there is the linked previous post which are all in reversed chronological order so it may be worth trying to read links in this order:

  1. previous post

  2. alternative instructions

  3. https://help.ubuntu.com/community/SamsungSeries9

    It may be a good thing to go and add fuel to the fire at launchpad

So as windows has been preinstalled with UEFI following step 1 from above says

UEFI and Grub2

I knew my laptop had an option for UEFI firmware support, so I turned this on, because UEFI is cool, right? Then I discovered that if one uses UEFI subsystem, fedora falls back to use grub-0.9x rather than grub2, there were some compatibility issues as far as I know, so I went for the legacy BIOS option, because I really wanted to have grub2 booting my OS.

and the answer from @MrNice here quote;

You need to not load the samsung_laptop kernel module. This module in efi mode does not work as it goes and write to parts of memory making the kernel throw a check exception and panic. Have the same issue with arch. But then you lose the keyboard backlight. Imho if you need that you will have to reinstall both windows and ubuntu in bios mode.

or try different kernel parameters to get samsung-laptop module loading. Quote from http://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt

Kernel Parameters
2 ~~~~~~~~~~~~~~~~~
3
4 The following is a consolidated list of the kernel parameters as implemented
5 (mostly) by the __setup() macro and sorted into English Dictionary order
6 (defined as ignoring all punctuation and sorting digits before letters in a
7 case insensitive manner), and with descriptions where known.
8
9 Module parameters for loadable modules are specified only as the
10 parameter name with optional '=' and value as appropriate, such as:
11
12 modprobe usbcore blinkenlights=1
13
14 Module parameters for modules that are built into the kernel image
15 are specified on the kernel command line with the module name plus
16 '.' plus parameter name, with '=' and value if appropriate, such as:
17
18 usbcore.blinkenlights=1

which are not relative but thought it was funny when finding these!

Means it is decision time! UEFI or keyboard backlight?

Using the UEFI option will allow installation of recent releaes of Ubuntu.

samsung-laptop module only works with 12.04 3.2 kernel when installed in legacy mode or earlier releases with <=3.2 kernel. (source: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1170885) Another bug report (https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1012284) says

This bug was fixed in the package linux - 3.2.0-27.43

Solution 3:

In order to make the keyboard backlight function keys work on a Samsung Series 9 model NP900X4B with Ubuntu 14.04 (Trusty Tahr), run the following commands from a shell prompt:

sudo setkeycodes e017 229
sudo setkeycodes e016 230

If these commands work for you, then you might want to put them in a init script. I have a file set-kbdillum-keycodes.conf in /etc/init, with the following contents:

# set-kbdillum-keycodes - set keycodes for keyboard illumination up/down keys
#
# This task is a workaround for a key mapping bug 
# in the Samsung Series 9 notebook model NP900X4B

description "set keycodes for keyboard illumination up/down keys"

start on (startup 
          and started udev)

task
script
    /usr/bin/setkeycodes e017 229
    /usr/bin/setkeycodes e016 230
end script

The above solves the problem on the NP900X4B. If you have another model and this solution does not work on your notebook, you might want to know how I got the solution for the NP900X4B and perhaps adapt it for your notebook model.

Before issuing the two setkeycodes, if I looked at the kernel log (by saying "tail -f /var/log/kernel.log" in a shell window) and pressed the keyboard backlight function keys, I would see messages such as

Aug  5 20:24:59 ubuntu kernel: [  152.458145] atkbd serio0: Unknown key pressed (translated set 2, code 0x97 on isa0060/serio0).
Aug  5 20:24:59 ubuntu kernel: [  152.458158] atkbd serio0: Use 'setkeycodes e017 <keycode>' to make it known.
Aug  5 20:25:01 ubuntu kernel: [  154.248439] atkbd serio0: Unknown key pressed (translated set 2, code 0x96 on isa0060/serio0).
Aug  5 20:25:01 ubuntu kernel: [  154.248452] atkbd serio0: Use 'setkeycodes e016 <keycode>' to make it known.

The first pair of messages appeared when I pressed the keyboard backlight down key. The second pair of messages appeared when I pressed the keyboard backlight up key. This is how I got the "use setkeycodes" hint and the scancode values e017 and e017. These scancode values need to be mapped to keycode values. I got the corresponding keycodes from /usr/include/linux/input.h:

#define KEY_KBDILLUMDOWN        229
#define KEY_KBDILLUMUP          230

If you have another notebook model, you might need to use other scancode values. The corresponding keycode values should still be the same, as these are the values known by the Linux kernel.