14 October 2010

Fixing brightnes control, etc. on a Samsung R510 with Debian Squeeze

I finally got around to installing Linux on my Samsung R510 laptop. One of the problems with Samsung laptops is that they don't play well with some Linux standards. One example is the brightness control--it just doesn't work. There are some other issues that are less irritating, but this one is the worst for me.

There is a fix for these ails that was developed for Ubuntu (some of which is also at Google code.). The problem is that my current distribution of choice is Debian Testing (Squeeze). The good news is that these bits developed for Ubuntu can be used in Squeeze as well.

We need to install three different packages: easy-slow-down-manager, samsung-backlight, and samsung-tools. Here's what I did after installing Squeeze with Gnome on the R510:

easy-slow-down-manager
Download the Maverick *.deb for easy-slow-down-manager from from https://launchpad.net/~voria/+archive/ppa and install it directly with gdebi or your favorite package installer. It's all DKMS source code, so installing the package in Squeeze should be ok.

samsung-backlight
Downloaded the Maverick *.deb for samsung-backlight from from https://launchpad.net/~voria/+archive/ppa and install it directly with gdebi or your favorite package installer. Like easy-slow-down-manager, it's all DKMS source, so installing the package in Squeeze should be ok.

With a lot of Samsung laptops, we'd be done with these two packages. Sadly, the R510 needs some extra love. The following is taken almost verbatim from http://www.voria.org/forum/viewtopic.php?f=3&t=516&start=0&hilit=r510

First (as root):
# gedit /lib/udev/rules.d/95-keyboard-force-release.rules

In the Samsung section you will see a line with *N130*|*N140* etc. Add |*R510* there

Do the same for:
# gedit /lib/udev/rules.d/95-keymap.rules

Next, add "acpi_backlight=vendor" to grub:
# gedit /etc/default/grub

and add "acpi_backlight=vendor" to the line GRUB_CMDLINE_LINUX_DEFAULT so it looks like
GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_backlight=vendor"

Save the file and then update grub:
# update-grub

samsung-tools
It may or may not be ok to install the Ubuntu package for samsung-tools on Squeeze, but since it's got binaries in it, this is risky. I decided to download the sources and build a package on the Squeeze-equipped R510 instead. Start by getting some build tools:
# apt-get install build-essential devscripts fakeroot

Then from https://launchpad.net/~voria/+archive/ppa get the Maverick *.tar.gz sources for samsung-tools. Expand the *.tar.gz and inside the directory that has the debian directory (i.e., not in the debian directory, but in the directory immediately above), open a term and:

dch -l {your initials}

and add comment like "Compiled for Debian." Close the editor and in the term build the package with:
dpkg-buildpackage -rfakeroot -us -uc

You may need to add additional dependencies if it fails. Pay attention to the error messages. Assuming it completes, this will generate a *.deb package file. Install it using gdebi or whatever.

After rebooting, you should now have working brightness buttons and a host of other working {Fn}-{Fsomething} keys. You will also have a new app under System->Preferences->Samsung Tools Preferences that you can use to change keybindings, etc and/or run as a Gnome panel app.

If it doesn't work
If the above doesn't work, you may be interested in playing with brightung. I haven't played with it except to confirm that (as root)

# setpci -s 00:02.0 F4.B={some-hex-number}

changes the brightness on my R510.

2 comments:

Henning said...

Thank you so much!!
This has been the one thing which has bugged me since I've switched to Debian.

btw: I have the N140 so there is no need to change udev-rules, but I noticed that on my machine there is no samsung-section in this file. Any idea why not? Just interested, everything works great!

Mithat said...

The Samsung sections can be easy to miss. They start with:

ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*"

to make it case insensitive. I see this both on my Maverick and Squeeze machines.