Doesn't Not Compute

My log of experiences with GNU/Linux and computers in general.

Howto: Set Screen Brightness for Poulsbo Netbook from Terminal

Today’s memory dump should be helpful for those unfortunate to have purchased a netbook with the Poulsbo chipset, installed a GNU/Linux distribution, and then installed the “PSB” driver. By default, as soon as the PSB module is loaded, the screen brightness goes to its highest setting. According to PowerTOP, this alone causes a 2.3 Watt increase in power usage.

With my Acer Aspire One 751h and its 3-cell battery, which has lost 19.95% of its capacity (according to acpitool -B) over the past year, this means 36 minutes less battery life. Which is something of a problem when you only have about 2 and a half hours to start with.

The PSB driver exposes a setting to adjust the screen brightness, fortunately, so here’s a script (tested with both Bash and Dash) to set the backlight brightness to a number between 0 and 100. (Note: on my netbook, there is no difference between 0 and 20 brightness level.) Just copy-and-paste, and save as “brightness.sh”. Then set the permissions to be executable (chmod +x ./brightness.sh)

#! /bin/sh
sudo sh -c "echo $1 > /sys/class/backlight/psblvds/brightness"

Syntax to use:
./brightness.sh $1

where $1 is the level you want to set the brightness to.

Set to minimum brightness:
./brightness.sh 0

Set to half-brightness:
./brightness.sh 50

I suppose this could be used to bind the brightness keys to actually set the brightness, as well, but I’m not really sure how to do that yet. Besides, one trick per post! :mrgreen:

This “code” is released under the GPL v3 license. You can find this license on the Free Software Foundation’s website.

Advertisements

7 responses to “Howto: Set Screen Brightness for Poulsbo Netbook from Terminal

  1. Pingback: GMA500 Headaches on Arch « Doesn't Not Compute

  2. bryan August 27, 2010 at 10:08 am

    #! /bin/sh
    cur_brightness = `cat /sys/class/backlight/psblvds/brightness`
    direction = $1

    if direction == ‘up’:
    brightness = cur_brightness + 10
    sudo sh -c “echo $brightness > /sys/class/backlight/psblvds/brightness”
    elif direction == ‘down’:
    brightness = cur_brightness – 10
    else:
    echo ‘You’re doing it wrong.’

    ^ accounting for the fact that I’m terrible in shell scripting and there are probably a few syntax errors above (hopefully I’ve not made any logic errors 🙂 ), that should work if you use say, xbindkeys to bind that to your XF86BrightnessUp / Down key (or whatever they’re reported as)

    I’ve also found that Jolicloud is rather nice for my Asus 1101HA as far as support for hardware goes. I’ve ripped the diabetes inspired UI out of the install and installed Scrotwm, mocp and a host of other more appropriate software on there and I’m actually able to get things done on a GMA 500 wielding netbook.

    • mulenmar August 27, 2010 at 3:38 pm

      There are several syntax errors, yes.

      “line 2: cur_brightness: command not found
      line 3: direction: command not found
      line 7: syntax error near unexpected token ‘elif’
      line 7: `elif direction == ‘down’:’

      I’m not sure how to fix that atm, but it seems there’s a bigger problem: xbindkeys doesn’t register Fn+ BrightnessUp or Fn+BrightnessDown keys, even with acer_wmi module loaded.

      I’ve tried Jolicloud as well, and hated the GUI. I use Arch Linux with Openbox and compile my own kernel with a 100Hz timer and Atom optimizations to reduce power usage.

  3. bryan August 27, 2010 at 10:10 am

    whoops. Missed a line in that script. Need to move the ‘sudo sh’ line to the bottom. I assume you’re smart enough to figure out what that looks like though 🙂

  4. fluke September 4, 2010 at 1:13 am

    This is weird, but my Lenovo laptop has the same problem. All the special keys are recognized except for the brightness keys ( though they work in almost all distributions except for Slackware, which is my main).

    However, I am able to adjust the backlight brightness using the ‘xbacklight’ command. Usage is pretty simple :

    xbacklight -set 80 #sets the brightness to 80%

    xbacklight – inc 10 #increases brightness by 10%

    xbacklight – dec 10 # decreases brightness by 10%

    However, this works only if you have an active X session, and will not work on a tty.

    • mulenmar September 4, 2010 at 3:27 am

      That’s exactly the same situation as I find myself in with the netbook — all the other special keys are recognized by xbindkeys, and can be configured to work, and xbacklight works, but I can’t bind anything to the brightness keys.

      As for the xbacklight thing . . . I found that out later on. 😳 It doesn’t seem to require root privileges from the user, but I suspect it gets routed through the Xserver’s elevated privileges to the same place.

  5. mulenmar September 10, 2010 at 5:44 pm

    http://code.google.com/p/gma500/issues/detail?id=10#c14 may be related. It’s about the brightness keys being “broken” ie not recognized. I can no longer verify this because my netbook has ceased functioning.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: