Sony VAIO brightness control script for Ubuntu (Geforce cards)

This evening I want to share with you this little script that I wrote for my personal use.
This script need the module “smartdimmer” (Change LCD brightness on Geforce cards), you can found it on the Ubuntu repository, than it’s enough to write on console

$ sudo apt-get smartdimmer

For test if the module works just try to set a new brightness value by typing

$ smartdimmer -s 50

If the module works for your laptop you can use the following script for change brightness directly from your keyboard.


File: brightness.sh

#!/bin/bash
maxbrightness=95
curbrightness=$(smartdimmer --get | grep -o [0-9][0-9][0-9]*)
let brightness=$curbrightness
let factor=5

if [ $# -gt 0 ]; then
 if [ $1 = "+" ]; then
 if [ $curbrightness -lt $maxbrightness ]; then
 let brightness=$brightness+$factor;
 fi
 fi

 if [ $1 = "-" ]; then
 if [ $curbrightness -gt 20 ]; then
 let brightness=$brightness-$factor;
 fi
 fi
fi

smartdimmer --set $brightness

Now put this script in your home directory and use the tool Preferences -> Keyboard Shortcut for associate the preferred keys to the following commands.

Increase brightness: brightness.sh +
Decrease brightness: brightness.sh –

  • Pingback: MY-TAG » Sony VAIO brightness control script for Ubuntu (Geforce cards …()

  • Pingback: MY-TAG » Sony VAIO brightness control script for Ubuntu (Geforce cards …()

  • Akhil

    My Grpics Card is Nvidia G210M.
    I installed Smartdimmer.but when i ran a test run wat i gt was as follows:

    Unable to shadow the video bios
    Error!
    Smartdimmer is only supported on certain (HP/SamsungSony/Zepto) laptops using a Geforce 6200/7x00Go/8x00Go. If you want support on your laptop contact the author.

    can you help me??. Thanks in advance..:)

  • Mauro Rocco

    Maybe if you tell me your OS version I can try to help you 😉

  • euge

    Man!

    +1000 to your karma! Thanx a lot!

  • pustak

    after running second cmd, i got response as : init_nvclock() failed!
    after creatin d .sh file , it doesnt run…wht shud i do???

  • Mauro Rocco

    @pustak this depends from the exact configuration of your system. As you can see here
    http://ubuntuforums.org/showthread.php?t=1588980 you are not the only one with this issue.

  • Pedram

    Try setuid on smartdimmer to run the command as root:
    chmod +s /usr/bin/smartdimmer