Saturday, October 27, 2007

GOD said "video.ko" and the LCD was BRIGHT :)

Just in case you are cursed with LCD brightness blues in Linux, here is some help. Please bear in mind that it is a very basic and general giude which is based on my own experience and digging while using GENTOO and SuSE. So here we go :


THE PROBLEM
You are unable to change your Laptop's display brightness

QUICK SOLUTIONS
There are custom ACPI packages for a number for laptop like acer,apple,thinkpad,etc. Search for them in your distro's package manager.

MANUAL (GENERAL) WAY
A more general (read as harder) way is to setup the necessary stuff manually. This is what this post is all about. So here we go...


PHASE A
  1. LCD brightness control needs acpi/video.ko module. Although it is an old approach and newer options are there, this one works most of the time.
  2. First make sure acpi/video module is loaded correctly. Run "lsmod" to see all the loaded modules. Look for the entry "video". If it is there, you are good to go. Skip to PHASE C. If not, you will have to load this module manually. Proceed to Step 3.
  3. Check for the availability of this module in your distro. Fo this, run "modprobe -l" as root to see all the available modules. Look out for an entry "/acpi/video.ko". If it is there, proceed to Setp 4. Although this is a very common module, but if in rare cases you did not find it, you will have to patch your kernel which is a long process and this beyond the scope of this guide (a nice way of saying that I DONT KNOW!!!). Anyways, you've got the module, you may proceed.
  4. Run "modprobe video" as root to load this module. Then run "lsmod" and you will see video listed at top. If you can not see the module listed here, goto Phase B, else skip to Phase C.
PHASE B
Before proceeding, please go thru Phase A once more and check that you haven't missed anything.
Now comes a catch. Introduced as a new "feature", xorg blocks "video" module from loading. As a workaround, do the following :
  1. Edit "/etc/modprobe.d/xorg-x11-driver-video" as root
  2. Comment the line "install video /bin/true"
  3. Run "modprobe video" as root to load the module. Then run "lsmod" and you will see video listed at top.
  4. If it fails again, then you will have to debug the issue thru dmesg. If this is the case, close this site and check your mails instead! If it loads fine, you have all the rights to proceed!

PHASE C
  • If you pass the above steps, there will be a "/proc/acpi/video/VGA/LCD/brightness" (exact path may change slightly)
  • Cat the file to see its contents. In my case, this file contains possible brightness values, as well as a place for new value. Note that you can only set brightness level to these predefined values.
  • And you are done! Use the command "echo NEW_BRIGHTNESS | sudo dd of=/proc/acpi/video/VGA/LCD/brightness" (run as root) for instant action :)

You can also make scripts/applets to set the brightness and if you do, please send a copy to me too, coz I am too lazy for that ;)

Feel free to critisize me, I dont read such posts anyways :D