Search This Blog

Loading...

Popular Posts

Sunday, 2 January 2011

Fedora 14 - How to make Samsung Fn Brightness buttons work

If you own a Samsung R510 the most important feature that does not work in Fedora 14 are the brightness buttons. Ubuntu users are fortunate to have a repository that enables Fn functionality, please see https://launchpad.net/~voria/+archive/ppa

I will be using files provided by this repository to enable brightness control in Fedora 14 on my Samsung R510.

Please make sure your Fedora system is fully up to date before proceeding. If you are not sure open a terminal and run the following command,

su -c 'yum -y update'

If advised to reboot, please do.

Are you ready?

Open a terminal and type the following,

su -c 'yum install kernel-devel gcc'

This will download some required tools. Next, edit the 95-keyboard-force-release.rules file.

su -c 'nano /lib/udev/rules.d/95-keyboard-force-release.rules'

Look for the following line

ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*E252*|*N120*|*N128*|*N130*|*N140*|*N148/N208*|*N150*|*N150/N210/N220*|*N220*|*N308*|*N310*|*N510*|*NB30*|*NC10/N110*|*ND10*|*Q210/P210*|*R410P*|*R425/R525*|*R428/P428*|*R460*|*R463*|*R468/R418*|*R480/R431/R481*|*R509*|*R518*|*R519/R719*|*R520/R522/R620*|*R528/R728*|*R530/R730*|*R530/R730/P590*|*R560*|*R580*|*R580/R590*|*R59/R60/R61*|*R59P/R60P/R61P*|*R710*|*R720*|*R780/R778*|*SR58P*|*SR700*|*SR70S/SR71S*|*SX22S*|*X118*|*X120*|*X460*", RUN+="keyboard-force-release.sh $devpath samsung-other"

Add R510/P510 as highlighted

ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*R510/P510*|*E252*|*N120*|*N128*|*N130*|*N140*|*N148/N208*|*N150*|*N150/N210/N220*|*N220*|*N308*|*N310*|*N510*|*NB30*|*NC10/N110*|*ND10*|*Q210/P210*|*R410P*|*R425/R525*|*R428/P428*|*R460*|*R463*|*R468/R418*|*R480/R431/R481*|*R509*|*R518*|*R519/R719*|*R520/R522/R620*|*R528/R728*|*R530/R730*|*R530/R730/P590*|*R560*|*R580*|*R580/R590*|*R59/R60/R61*|*R59P/R60P/R61P*|*R710*|*R720*|*R780/R778*|*SR58P*|*SR700*|*SR70S/SR71S*|*SX22S*|*X118*|*X120*|*X460*", RUN+="keyboard-force-release.sh $devpath samsung-other"

Press 'Ctrl-X' to exit nano, followed by ''Y' to save the file.

Edit your kernel grub entry,

su -c 'nano /boot/grub/grub.conf'

and add the following, acpi_backlight=vendor as illustrated below.

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda1
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.35.10-74.fc14.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.35.10-74.fc14.x86_64 acpi_backlight=vendor ro root=UUID=........... rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=uk rhgb quiet
initrd /boot/initramfs-2.6.35.10-74.fc14.x86_64.img
title Fedora (2.6.35.6-45.fc14.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.35.6-45.fc14.x86_64 ro root=UUID=............ rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=uk rhgb quiet
initrd /boot/initramfs-2.6.35.6-45.fc14.x86_64.img
title Other
rootnoverify (hd1,0)
chainloader +1

Press 'Ctrl-X' to exit nano, followed by ''Y' to save the file.

Now we are going to download and compile the kernel module responsible for making the brightness buttons work.

mkdir samsung

cd samsung

wget http://dl.dropbox.com/u/16953763/samsung-backlight.c

wget http://dl.dropbox.com/u/16953763/Makefile

make

This will compile the samsung-backlight kernel module. The next step is to copy the module to your kernel.

su -c 'cp samsung-backlight.ko /lib/modules/$(uname -r)/kernel/'

su -c 'depmod -a'

su -c 'modprobe samsung-backlight'

Reboot your laptop and try out the FN brightness buttons.

Note:  You will have to rebuild / insert the samsung-backlight kernel module every time your kernel is updated.

57 comments:

  1. I have FC14 on Samsung N220. Many thanks for this!

    ReplyDelete
  2. I have a probelem in make for the downloaded samsung-backligh.c

    The make output says:
    make: *** /lib/modules/2.6.35.10-74.fc14.i686.PAE/build: No such file or directory. Stop.
    make: *** [all] Error 2

    Kindly help.

    ReplyDelete
  3. You need to install the kernel-PAE-devel-2.6.35.10-74.fc14.i686 since you are using the PAE kernel.

    ReplyDelete
  4. @Adam: Thanks. The make was successful.

    Now i can use the fn + brightness key, but when i press it just once, the brightness keeps on changing as if the key were physically stuck, and no other keypad input is taken until i restart fedora.

    Thanks in advance.

    ReplyDelete
  5. To overcome this you need to add an entry in the 95-keyboard-force-release.rules for your laptop model, as described above.

    What laptop model do you have?

    ReplyDelete
  6. I have a Samsung N148 , full model no: NP-N148-DPS1 IN

    ReplyDelete
  7. According the the force release rules your laptop is already included.

    Lets assume it was wrong, can you open a terminal and type

    su -c 'dmidecode -s system-product-name'

    This will print out what fedora / linux identifies your laptop as.

    Can you confirm that you added acpi_backlight=vendor to your grub?

    ReplyDelete
  8. @Adam: i too thought my laptop model was included in acpi_backlight=vendor list, but the displayed modle no. was N148P

    I added that to the list and now the backlight function keys work like a charm. Thank you very much for your help.

    ReplyDelete
  9. Thats good to hear, thanks for keeping me informed.

    ReplyDelete
  10. Perfect. It's working on my Samsung N210. Thanks :)

    ReplyDelete
  11. the brightness button work, but it doesnt change the brightness, i cant change it even throught Power Managment panel (i am using kde), any tips ?

    ReplyDelete
  12. This is because you are using KDE 4.5 which relies on HAL as oppose to udev.

    You could upgrade to KDE 4.6, http://rdieter.livejournal.com/18374.html

    However, this is not considered stable. Use at your own risk.

    Another option is to use Gnome instead :-)

    Or investigate how to add your laptop to the HAL policy rules.

    ReplyDelete
  13. I am guessing it should be doable, because it worked (not perfect, but still) before I switched from nouveau driver to nvidia one.

    cat /proc/acpi/NVID/../brightness
    says
    ""

    Are you sure it's HAL policy problem?

    ReplyDelete
  14. I am installing Fedora 14 and KDE as I type. I will have a poke about and see if I can get mine working.

    ReplyDelete
  15. Kamil, Fedora 14 + KDE and my Samsung brightness buttons are working perfectly well once I have done the steps detailed above.

    So I was wrong about HAL being the culprit. My R510 has Intel gfx, so perhaps the issue you have is related to your nvidia gfx.

    What laptop model do you have?

    ReplyDelete
  16. Thanks Adam for your help so far,

    My model is NP-R510H.

    Could you just point me in the right direction, because i am thinking of two possible reasons - ACPI not being able to provide brightness support and graphics driver not providing that functionality.

    Nvidia driver reports in Xorg.log that it cannot find the appropriate brightness file, so maybe its rather ACPI thing, I am not familiar with architecture of these systems. Maybe your knowlegde will help :)

    ReplyDelete
  17. Try adding,

    Option "RegistryDwords" "EnableBrightnessControl=1"

    in the Device section of your /etc/X11/xorg.conf file.

    If you need to generate the xorg.conf file, boot into run level 3 and run the command nvidia-xconfig as root.

    Then you can edit the file and add the above option.

    ReplyDelete
  18. I have installed Fedora 14 on my Dell Inspiron 17R, and my Fn key doesn't work either. Unfortunately, I don't have the file: nano /lib/udev/rules.d/95-keyboard-force-release.rules, so I'm stuck at the very beginning. Could you help me out?

    ReplyDelete
  19. Sorry but I cant provide much help, I have no experience with your laptop or a similar Dell. However I would strongly suggest trying Ubuntu 10.10 which generally has much better hardware support out of the box and for Dell laptops.

    From the random bits and pieces I am finding via google, it looks like Ubuntu 10.10 may just work with your laptop. Give the 10.10 LiveCD a go.

    ReplyDelete
  20. Brilliant guide, thankyou. Worked great for my Q530

    ReplyDelete
  21. Great how to, worked for my Samsung n210 even on Fedora 15 thanks a lot :)

    ReplyDelete
  22. Adam, your solution sounds great - but I get the following error on my NC210 with Fedora 14: I'm running this from /usr/src/samsung/

    [root@alba samsung]# make
    make -C /lib/modules/2.6.35.6-45.fc14.x86_64/build M=/usr/src/samsung modules
    make: *** /lib/modules/2.6.35.6-45.fc14.x86_64/build: No such file or directory. Stop.
    make: *** [all] Error 2

    Appreciate any suggestion (I'm sort of wondering whether there's already a 'compile' problem with modules, as I see a 'failed' come up during boot-up process. How do I force a 'recompile' on Fedora 14?)

    TIA

    Bogo

    ReplyDelete
  23. Follow the guide!

    Your current Kernel is the version released with F14, therefore it seems you havent updated your system as advised.

    Your kernel source files are more than likely for a new kernel version which is why the make is failing.

    ReplyDelete
  24. Thanks for response, Adam. Yes, I did follow every step (yum -y upgrade etc) - but some 'kmod' corruption is indicated by boot messages: can't find relevant one in logs, I just see on console. Guess I'll have to wait for upgrade to newer kernel, which I hope will correct this. Look forward to using your 'HowTo" again then.

    Bogo

    ReplyDelete
  25. After performing the update, a reboot should load the newer kernel.

    Did you upgrade a F13 installation to F14?

    ReplyDelete
  26. Thanks for 'heads-up', Adam. Another distro has taken over Grub and stuck with the old kernel: I'll try to get Fedora's Grub back again. And no, this F14 was a new install: really like Fedora and want to keep it as my main distro. Will report back.

    ReplyDelete
  27. I'm using Fedora 15 on a Samsung NF310.

    If I apply the changes to the 95-keyboard-force-release.rules file, then apparently some automatic brightness cycling kicks in, randomly. Pressing the FN keys stops it again for a minute or two.

    So I undid these changes to that file, and everything now works flawlessly! I guess that these changes are only needed for Fedora 14?

    Many thanks for this blog post!

    ReplyDelete
  28. Hi there. Earlier i made my N210 brightness control work with your how to with no problems. But then i need to partition my disk and install Fedora again [15] and now i have this problem:

    make -C /lib/modules/2.6.38.6-26.rc1.fc15.i686/build M=/home/digger/samsung modules
    make: *** /lib/modules/2.6.38.6-26.rc1.fc15.i686/build: No such file or directory. Stop.
    make: *** [all] Error 2

    System is up to date.

    ReplyDelete
  29. 2.6.38.6-26.rc1.fc15 is not the latest Fedora 15 kernel.

    Your kernel devel is therefore probably for a newer kernel.

    Run yum -y update again and reboot.

    Then su -c 'yum install kernel-devel gcc'

    BTW if you are using F15 you may not need to edit the 95-keyboard-force-release.rules file.

    ReplyDelete
  30. Yes, I updated fedora but didn't reboot and that was the roblem :) And yes it works without editing that file. But there's another problem as posted by Diederick.

    When you set in screen settings to darken when not in use (i have it in my language so i guess the names in english), then after few minutes screen starts to blink and to stop it you must change brightness or sound volume.

    When it's disabled i haven't noticed screen blinking, maybe sometimes short after login but i'm not sure it was diabled then. Is there a way to fix it or just don't use this "darken when iddle" option?

    Thanks for help :)

    ReplyDelete
  31. Just tested with F15 KDE 4.6.x, no problems with automatic screen dimming when idle.

    I assume you are using Gnome Shell?

    What Laptop model do you have and what graphics device does it feature, Intel, Nvidia?

    If it has Nvidia graphics, are you using the nouveau driver or proprietary?

    ReplyDelete
  32. Followed the exact instructions in a Samsung N145 Plus with Fedora 15, except for the " su -c 'nano /lib/udev/rules.d/95-keyboard-force-release.rules'... " part (keyboard layout wasn't needed). Works perfect! Thank you very much!

    ReplyDelete
  33. Yup, Fedora 15 with Gnome (3) Shell. My laptop is Samsung N210 with integrated Intel GMA 3150 graphics.

    ReplyDelete
  34. Seems like a Gnome Shell / Samsung related issue as you are not alone.

    http://forums.fedoraforum.org/showthread.php?t=265830

    ReplyDelete
  35. Hello Adam, thanks for posting this guide. It worked perfectly for me on F14 but doesn't work for me on F15, although I can see it has for some people above on the N210. My line in the 95-keyboard-force-release.rules was very short (didn't contain any of the usual product names), so I copied and pasted yours. Added the acpi_backlight=vendor in grup and rebooted. The backlight keys now make the icon appear, but nothing happens. Any thoughts where I have gone wrong?

    ReplyDelete
  36. In Fedora 15 you do not need to edit the 95-keyboard-force-release.rules file.

    ReplyDelete
  37. Yep never mind, it was working after all. Thanks!

    ReplyDelete
  38. Hello, Adam!

    Thanks a lot for your module, it works perfectly here :)
    I just updated my kernel (2.6.40-4.fc15.x86_64) and my brightness stopped working. Took me a while to remember I had to reinstall the module!

    Anyway, when I was reinstalling it, it died with this message:
    /root/samsung/samsung-backlight.c: In function ‘sabi_exec_command’:
    /root/samsung/samsung-backlight.c:105:5: error: implicit declaration of function ‘msleep’ [-Werror=implicit-function-declaration]


    The patch used to fix is this:
    --- a/samsung-backlight.c
    +++ b/samsung-backlight.c
    @@ -18,6 +18,7 @@
    #include
    #include
    #include
    +#include

    #define MAX_BRIGHT 0xff
    #define OFFSET 0xf4


    Hope it helps!

    ReplyDelete
  39. This comment has been removed by the author.

    ReplyDelete
  40. I had the same problem as André. I just added

    #include (linux/delay.h)

    (but change the parentheses to less than and greater than) after the others in the samsung-backlight.c file, and then ran make.

    screen shot: http://a6.sphotos.ak.fbcdn.net/hphotos-ak-snc6/284031_264406473570978_100000048824458_1189408_8325662_n.jpg?dl=1

    ReplyDelete
  41. I have a Samsung RV411 with Fedora 15. I followed every instruction and all i get is that now when i press Fn+UP or Fn+Down the display of brightness but the keys doesn't modify the state of the brightness. I tried modifying the rules file but it didnt work either... Any suggestion?

    ReplyDelete
  42. The kernel module from https://launchpad.net/~voria/+archive/ppa used in this guide is quite old, I doubt it supports the RV411

    su -c 'modprobe samsung-backlight'
    dmesg

    The above will give you some feedback.

    Fedora 15 users may find this interesting, http://forums.fedoraforum.org/showthread.php?t=263942

    I do not suggest following it to the letter, for example there is no need to use the rawhide kernel.

    ReplyDelete
  43. This comment has been removed by the author.

    ReplyDelete
  44. You sir are a genuis! Thank you SO much, I have a Samsung Q430 with Nvidia graphics and openSUSE 11.4 and I wasn't able to adjust the brightness! Now I added the acpi_vendor, this then fixed the 'locked' brightness (the brightness would jump to 100% while the OS was loading up!), and added the EnableBrightness=1 to the xorg.conf under device (see post above) and added the Q430 to the rules file (however the keys still don't work - but that probably because the rules file for samsung had NO laptop model numbers in it - and I'm guessing I can't just add my model number without making changes elsewhere in the system).

    HOWEVER the following WILL adjust the brightness:

    echo 5 > /sys/class/backlight/samsung/brightness

    Change the number 5 where >4 is brightness up and less than 4 is brightness down!

    ReplyDelete
  45. EDIT:::::::::::::::::

    You NEED to add Q430/Q530 to the rules file then the keys work!!!!

    ReplyDelete
  46. Hi, Samsung N145P and Fedora 15.

    I followed your guide to the letter, including editing the keyboard rules, though I've since undone that.

    When I try the final 'cd samsung', 'make' bit though, I get some errors.

    make -C /lib/modules/2.6.40.4-5.fc15.i686/build M=/home/alex/samsung modules
    make[1]: Entering directory `/usr/src/kernels/2.6.40.4-5.fc15.i686'
    CC [M] /home/alex/samsung/samsung-backlight.o
    /home/alex/samsung/samsung-backlight.c: In function ‘sabi_exec_command’:
    /home/alex/samsung/samsung-backlight.c:105:5: error: implicit declaration of function ‘msleep’ [-Werror=implicit-function-declaration]
    cc1: some warnings being treated as errors

    make[2]: *** [/home/alex/samsung/samsung-backlight.o] Error 1
    make[1]: *** [_module_/home/alex/samsung] Error 2
    make[1]: Leaving directory `/usr/src/kernels/2.6.40.4-5.fc15.i686'
    make: *** [all] Error 2



    Any advice?

    Also, somewhat bizarrely, while previously the brightness setting appeared both in the System settings window and when I pressed fn+up/down, it now doesn't appear in the settings and doesn't change with the key combination. It never actually DID anything, but its disappearance is a little unsettling!

    ReplyDelete
  47. The kernel module used in this guide is old an not compatible with the newer F15 kernels.

    Please refer to the comment by André Walker.

    ReplyDelete
  48. Thank you! This makes the backlight control work for my Samsung QX411 on OpenSuse 11.4 (2.6.37.6-0.7-desktop x86_64). Note I didn't need to edit 5-keyboard-force-release.rules because there was no ATTR parameter for the Samsung vendor line.

    ReplyDelete
  49. Can anyone direct me as to how to do this for the X460 and Ubuntu 11.10? Thanks. I got some errors trying to adapt it, since I'm not using Fedora etc.

    ReplyDelete
  50. @heelio, I will post a new blog entry detailing the steps for Ubuntu 11.10.

    ReplyDelete
  51. Ok heelio, try this and let me know how you get on.

    http://linuxtweaking.blogspot.com/2011/11/enabling-samsung-laptop-backlight.html

    ReplyDelete
  52. I have a samsung N148; full model number NP-N148-DA01IN. Fn key has stopped working all of a sudden and i'm unable to increase/decrease volume/brightness etc... Please help! Thanks in advance :)

    ReplyDelete
  53. What Linux distribution are you using?

    ReplyDelete
  54. Thanks for the tip.

    I have Ubuntu 11.10 with Xfce4, the controls Fn+up/down where working but the screen brightness wasn't changing. After adding

    Option "RegistryDwords" "EnableBrightnessControl=1"

    at "Device" Section in /etc/X11/xorg.conf, the brightness Fn keys began to change the brigtness as it should. I didn't have to compile anything, neither add smth in grub.cfg

    ReplyDelete
  55. Samsung q210 brightness problems!
    Help guys! I did this guide till the crash at ¨Make¨ command.
    --------------------------------------------------------------
    [root@v samsung]# make
    make -C /lib/modules/3.4.4-5.fc17.i686/build M=/home/vincas/samsung modules
    make[1]: Entering directory `/usr/src/kernels/3.4.4-5.fc17.i686'
    CC [M] /home/vincas/samsung/samsung-backlight.o
    /home/vincas/samsung/samsung-backlight.c: In function ‘__check_debug’:
    /home/vincas/samsung/samsung-backlight.c:37:1: warning: return from incompatible pointer type [enabled by default]
    /home/vincas/samsung/samsung-backlight.c: In function ‘__check_use_sabi’:
    /home/vincas/samsung/samsung-backlight.c:40:1: warning: return from incompatible pointer type [enabled by default]
    /home/vincas/samsung/samsung-backlight.c: In function ‘__check_force’:
    /home/vincas/samsung/samsung-backlight.c:43:1: warning: return from incompatible pointer type [enabled by default]
    /home/vincas/samsung/samsung-backlight.c: In function ‘sabi_exec_command’:
    /home/vincas/samsung/samsung-backlight.c:105:5: error: implicit declaration of function ‘msleep’ [-Werror=implicit-function-declaration]
    cc1: some warnings being treated as errors
    make[2]: *** [/home/vincas/samsung/samsung-backlight.o] Error 1
    make[1]: *** [_module_/home/vincas/samsung] Error 2
    make[1]: Leaving directory `/usr/src/kernels/3.4.4-5.fc17.i686'
    make: *** [all] Error 2
    [root@v samsung]#

    ReplyDelete
  56. This guide is specific to F14 only and will not work with F17.

    ReplyDelete

Note: only a member of this blog may post a comment.