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

81,854

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:

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.

Share:
81,854

Related videos on Youtube

mmalmeida
Author by

mmalmeida

Updated on September 18, 2022

Comments

  • mmalmeida
    mmalmeida over 1 year

    I've just installed Ubuntu 12.10 on my Samsung 900X4C. However, I can't get the keyboard backlights to work.

    I added the keymaps as per community docs - Samsung Series 9 (section Function Keys). But regardless of pressing Fn+F9 or F10 (backlight decrease/increase), I get:

    1. No lights in keyboard
    2. Toggler in top right corner always pops-up as maxed out (i.e., "full light")

    How can you fix the keyboard backlight? The Fan button (Fn+F11) doesn't work either, if you also know about that one it would be great.

    • Admin
      Admin over 11 years
      I'm having the same issues after following the same instructions but with a Samsung Series 7.
    • Admin
      Admin almost 11 years
      Same for me, the strange thing is that it was working fine in older ubuntu instalations. Think it may have something to do with some changes in ubuntu.
    • Admin
      Admin almost 11 years
      Same still happens with 13.04 (I'm also on Samsung 900X4C).
    • Admin
      Admin over 10 years
      Also on 900X4C. Having trouble with wifi-button and keyboard increase/decrease. The keyboard backligt is set to maximum all the time but even when trying to decrease. Still, there is no light..
    • Admin
      Admin over 10 years
      The keyboard backlight only works when using F* keys after loading samsung-laptop module and after the keymaps have been edited. This is only possible on Legacy/BIOS installs at least until the module has been rewritten/patched for UEFI installs.
    • Admin
      Admin over 10 years
      Somebody over on Ubuntu Forums who can follow instructions and communicate in a efficient constructive manner recorded their experiences and observations in successfully getting keyboard backlight to work. Here post #278 from ubuntuforums.org/showthread.php?t=1737086&page=28 clearly gives basically same answer as Geezanansa's with more detail.
    • Admin
      Admin over 10 years
      @user420420: Ubuntuforums.org was hacked and was down for over a week when I was experimenting with this. I will check it out, thanks.
  • Gabriel
    Gabriel over 11 years
    I installed samsung-backlight and didn't help at all. I can't even run it. I can only run samsung-tools and it shows the key combinations (Fn+...) all mixed up. Pretty useless.
  • Mr. Robot
    Mr. Robot over 11 years
    @Gabriel Did you make a keymap table for specific fn keys???
  • Gabriel
    Gabriel over 11 years
    I tried following the instructions in the link you presented. When I type sudo /lib/udev/keymap -i input/event3 the terminal starts automatically scrolling down (as if the Enter key was pressed continually) and after I press Esc I can't see the output of the keys pressed because it won't scroll up. Any advice? Thanks.
  • Alix Axel
    Alix Axel almost 11 years
    -1, The OP is asking for the keyboard (not screen) backlight. Also, I tried everything you suggested and didn't helped anything.
  • Alix Axel
    Alix Axel almost 11 years
    I tried samsung-tools, it doesn't seem to provide any shortcut configuration for the keyboard backlight. Couldn't get anything to work besides of what was already working. I guess the Voira package is for the 7/900x3 series, I haven't read of a successful fix for the 900x4c version.
  • Alix Axel
    Alix Axel over 10 years
    @geezanansa: Like I said, I made the keymap table for the FN keys - doesn't work on 900X4C. As for the kernel, I didn't tried it, because I was unsure of which one to use. And the samsung-laptop module is also useless on this model version, don't ask me why as I don't know.
  • Alix Axel
    Alix Axel over 10 years
    Everything did work as expected in Windows 8. It has a sensor, but it also allows you to change the backlight manually. Wireless also works (on Windows 8). The second screenshot does not do it (tried by both the OP and myself), and like I said samsung-tools (mentioned in the linlap.com link) doesn't show anything related to keyboard backlight.
  • Alix Axel
    Alix Axel over 10 years
    @geezanansa: I guess it would be pretty easy to assume we tried changing the FN keymaps - the OP mentioned it explicitly and so did I (as well as providing the full keymap codes) - I'm not sure what's the point in repeating something for which the answer is so obvious.
  • Alix Axel
    Alix Axel over 10 years
    @geezanansa: Right... I know how the bounty system works, but I don't see any answer here that solves my and the OP problem. Sorry if that bugs you to the point that you have to report this attempted answer, but posting Windows 8 screenshots on AskUbuntu and the same basic thing the OP and me said that didn't worked isn't any better.
  • Alix Axel
    Alix Axel over 10 years
    @geezanansa: What I posted is not in the community wiki, but either way, I see rep as means to an end (solution) and not the end itself. If no solution presents itself why should I award the bounty? As for updating my answer with what I've tried, I think I did a comprehensive job at that, at least given my limited knowledge of Linux / Ubuntu. I'm not the only one here with the problem / lack of solution, just wanted to give some more attention to the problem the OP was having (and me too). Similarly, should he just mark a answer as accepted even though it doesn't solve the problem clearly?
  • geezanansa
    geezanansa over 10 years
    I searched Amras's link and Ubuntu Documentation for 'sudo /lib/udev/keymap -i input/event3' = no ctrl + f search results.
  • geezanansa
    geezanansa over 10 years
    @Alix Axel Do you have the CONFIG_SAMSUNG_LAPTOP kernel option enabled? I believe that this kernel option is required for full functionality out of the samsung-tools package, at least it was on my 740. You need to make sure that you have installed linux without uefi, as due to the current bricking potential of samsung laptops running uefi, the samsung-laptop module is blacklisted if uefi is detected. On Ubuntu, I believe you can check your kernel config for this option with:...
  • geezanansa
    geezanansa over 10 years
    @AlixAxel Code: cat /boot/config-$(uname -r) | grep CONFIG_SAMSUNG_LAPTOP Personally, my 740 is running gentoo ~amd64. I had a heck of a time navigating the google for good information on this model - it is just way too new. source: voria.org/forum/viewtopic.php?t=1204