Saturday, 26 November 2011

Enabling Samsung Laptop Backlight Support in Ubuntu 11.10

Is your Samsung Laptop brightness buttons not working? Yep, mine isn't too. The Kernel in Ubuntu 11.10 includes support for a number of Samsung Laptops thanks to the efforts of Greg Kroah and if you are interested in improving this I suggest filing bug reports to your distribution vendor or upstream.

What to do in the meantime...

Follow these steps to make your Samsung Laptop's brightness buttons work / or to test if the samsung-laptop.ko works with your Samsung Laptop.

Open a terminal,

mkdir samsung
cd samsung
wget http://dl.dropbox.com/u/16953763/Ubuntu%2011.10%20Samsung%20Laptop/Makefile
wget http://dl.dropbox.com/u/16953763/Ubuntu%2011.10%20Samsung%20Laptop/samsung-laptop.c
sudo dmidecode -s system-product-name

Make a note of the product name / model, mine is identified as R510/P510

gedit samsung-laptop.c

Add your Samsung model to the dmi table or modify one of the existing entries, scroll down to line 504, you will see the table starts with the N128.
{
.ident = "N128",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR,
"SAMSUNG ELECTRONICS CO., LTD."),
DMI_MATCH(DMI_PRODUCT_NAME, "N128"),
DMI_MATCH(DMI_BOARD_NAME, "N128"),
},
.callback = dmi_check_cb,
},

I am going to modify the N128 entry and replace the "N128" with my Laptop model, the R510/P510.

{
.ident = "R510/P510",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR,
"SAMSUNG ELECTRONICS CO., LTD."),
DMI_MATCH(DMI_PRODUCT_NAME, "R510/P510"),
DMI_MATCH(DMI_BOARD_NAME, "R510/P510"),
},
.callback = dmi_check_cb,
},

Once you have edited the samsung-laptop.c file, save and exit. Now build the samsung-laptop.ko module.

make

Your modified samsung-laptop.ko module should have compiled successfully. The next step is to replace the existing module.

sudo cp samsung-laptop.ko /lib/modules/$(uname -r)/kernel/drivers/platform/x86/
sudo depmod -a

The final step, add acpi_backlight=vendor to grub

sudo gedit /etc/default/grub

Modify the line,


GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"

Save and exit, then update grub.

sudo update-grub

Now reboot and test your Fn Brightness buttons.