Philippines, Technology, Mobile, Android, Games, Mac, Linux, WordPress
Google+TwitterLinkedinFacebook
Subscribe
HomeLinux / UbuntuHow to setup brightness keys on Ubuntu based Compaq C700

How to setup brightness keys on Ubuntu based Compaq C700

I’ve been using my Ubuntu-based Compaq C700 (specifically the C793TU) for a while now. For some reason during one of my updates, the brightness special function keys stopped working. I’ve never really gotten to fix the problem until now.

An idea of how to do it actually came from Valdir Silveira Jr’s “Ubuntu in Notebook” post (the post is in Portuguese but I used the ever so useful Google translation service) which did a trackback to my post about installing Ubuntu Linux on Compaq C700. Valdir showed how to adjust the brightness using a terminal session:

echo -n 50 > /proc/acpi/video/OVGA/DD03/brightness

I decided to concoct a couple of bash scripts and map them to the “increase brightness” and “decrease brightness” function keys to allow me to adjust the brightness again.

I’m using Ubuntu Hardy Heron (version 8.04) on my notebook. The function keys for brightness is actually handled by the ACPI kernel modules. Under Ubuntu different shell scripts are called when certain special keys like sleep, volume mute and brightness. The shell scripts are located in the /etc/acpi directory.

Two scripts control the brightness up and brightness down keys. The video_brightnessdown.sh file is for the latter while the video_brightnessup.sh file is for the former.

Note: Create backups of the files so that you can go back to them in case the scripts doesn’t work in your system.

Now replace the contents of the video_brightnessup.sh file with the following:

#!/bin/bash

# set a maximum value
max="`cat /proc/acpi/video/OVGA/DD03/brightness | grep levels | awk '{print $13;}'`"

# get the current value
curr_brightness="`cat /proc/acpi/video/OVGA/DD03/brightness | grep current | awk '{print $2;}'`"

# add 10 to change brightness to next lower setting
brightness=`expr $curr_brightness + 10`

# don't allow a value larger than $max
if [ ${brightness} -ge ${max} ]
then
brightness=${max}
fi

# now set the proc variable to the new value
echo ${brightness} > /proc/acpi/video/OVGA/DD03/brightness

Replace the contents of the video_brightnessdown.sh with the following:

#!/bin/bash

# set a minimum value
min="`cat /proc/acpi/video/OVGA/DD03/brightness | grep levels | awk '{print $4;}'`"
max="`cat /proc/acpi/video/OVGA/DD03/brightness | grep levels | awk '{print $13;}'`"

# get the current value
curr_brightness="`cat /proc/acpi/video/OVGA/DD03/brightness | grep current | awk '{print $2;}'`"

# subtract 10 to change brightness to next lower setting
brightness=`expr $curr_brightness - 10`

#   don't allow a value smaller than $min
if [ ${brightness} -le ${min} ]
then
   brightness=${min}
fi

# now set the proc variable to the new value
echo ${brightness} > /proc/acpi/video/OVGA/DD03/brightness

After saving the files, your brightness keys should now start working.

Thanks Valdir. Enjoy!

Responses

  1. arcanedata says

    leet
    you own my brightness keys
    well done

Leave a Reply

  • Hi, I'm Gerry. Welcome to my blog and sites about mobile, technology, The Pinoy, #crazyidea, games, WordPress, Ubuntu, Mac, iOS, Android, Symbian... I started sites like Ortigas Online and iMakati which focuses on local community information. Read more about Gerry
    Status (Twitter, Linkedin, Facebook...)

    Just found out that the Android-based HTC Sensation XL phone is now in the Philippines for about Php 28,000.

  • Visit my other sites

    • Apps & Games

      Reviews, news of mobile apps & games for Android, iOS, Blackberry, Symbian...

    • Connected Phone

      The computer is the mobile phone. The always connected phone evolution.

    • Mobile/Web Development

      Mobile/Web apps, development, services for Android, iPhone & WordPress.

    • Pinoy Me

      Pinoy businesses, enterprises, startups, professionals all over the world

    • Java Midlet

      Java mobile apps & games - news, reviews, tips, mobile phone & devices

  • PINOI Sites

    Are you interested in putting up your own PINOI-enabled local community site? Contact me

    • PINOI

      Enabling local communities on the Internet

    • Makati

      iMakati.com is a site that provides information about Makati City.

    • Ortigas

      Community site that provides information about the Ortigas Center.