View Single Post
Old 11-04-07, 08:01 AM   #17
NvFuchs
Registered Fox
 
NvFuchs's Avatar
 
Join Date: Oct 2007
Location: Confoederatio Helvetica
Posts: 530
Default Re: Brightness control not working with nVidia driver

Just as a note to people having this problem:

You can at least set the brightnes with
nvidia-settings, and as the fn+end/home
combinations generate key events you can
set a command to this keys.

I wrote this script:

Code:
#!/bin/bash
brightnes=`head -n 1 /proc/acpi/ibm/brightness | awk '{print $2}'`
case "$brightnes" in
    7)
    bright=0;
    ;;
    6)
    bright=-0.1;
    ;;
    5)
    bright=-0.2;
    ;;
    4)
    bright=-0.3;
    ;;
    3)
    bright=-0.4;
    ;;
    2)
    bright=-0.5;
    ;;
    1)
    bright=-0.6;
    ;;
    1)
    bright=-0.7;
    ;;
    0)
    bright=-0.8;
    ;;
    *)
    ;;
esac
nvidia-settings -a brightness=$bright
exit 0
and xmodmap to bind the keycodes generated
to a key (F14,F15...).

I haven't tested yet wheter battery lifetime
increases with this, as the brightness is
set via software, not the hardware backlight
of the LCD screen. But at least you have some
brightnes adjusting functionality.

Sidenotes:
The script might as well work with /bin/sh
(so it is not bash/linux dependant)
but I haven't tested so far whether sh
provides the case statement.

I don't provide the display as an argument
to nvidia-settings either, so you might want
to add this depending on your setup.

There is still a "bug" in it: the ibm driver
goes twice through all brightness levels,
0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7.
So the display will go to 0 brightnes after full brightnes
and vice versa.


For those who are not familiar with Xmodmap or keycodes:

Use the application xev to print the keycode the fn combination
provides, so just run xev then hit FN+End or FN+Home.
Write down the keycode. Then add these two lines to a file,
let's call it .xmodmap as an example, in any directory:

keycode 101 = F28
keycode 212 = F29

with the keycodes you got from xev. On a R61 they are 101 and 212.
Make sure that the command xmodmap ~/.xmodmap runs
on login, so use the autostart of your DE/WM or the .xinitrc file.

Afterwards you can use the F28 and F29 keys to set them as shortcuts
for your windowmanager / desktop environment.


hth, Fuchs
NvFuchs is offline   Reply With Quote