← Back to team overview

sony-vaio-z-series team mailing list archive

Re: Backlight with NVidia driver on Vaio Z11

 

I guess I found a solution for the backlight issue (I'm running ArchLinux 64bit Kernel 3.5.2 on a VGN-Z21VN with the NVidia 9300GS and driver version 304.37 ).

Steps that I did:
- adding acpi_backlight=vendor as a kernel parameter in Grub
- adding Option "RegistryDwords" "EnableBrightnessControl=1" in xorg.conf (as found on several nvidia-related forums. Still not sure if that was necessary, but I will figure that out later)
- installing nvidia-bl module (version 0.17.3-1)
- the brightness is a value between 0 and 2047 in the file /sys/class/backlight/nvidia_backlight/brightness

for convenience, I wrote the following script, which might be called e.g. with parameters "up" and "down" from your acpi-deamon (please forgive my bash-illiteracy :D )

#!/bin/bash
VALUES=( 0 30 80 200 400 600 2047 )

IndexOf(){
    local i=0 S=$1; shift
    while [ $S != $1 ]
    do    ((i++)); shift
        [ -z "$1" ] && { i=0; break; }
    done
    echo $i
}

cd /sys/class/backlight/nvidia_backlight
BRIGHTNESS=`cat brightness`
index=`IndexOf $BRIGHTNESS ${VALUES[@]}`

if [ "$1" = "up" ]
then
	# the number of brighness values minus 1
	if [ "$index" = "6" ]; then
		exit 0
	else
		DISPLAY=:0 xset dpms force on
		(( index++ ))
	fi
else
	if [ "$index" = "0" ]; then
		DISPLAY=:0 xset dpms force off
	else
		(( index-- ))
	fi
fi

NEW_BRIGHTNESS=${VALUES[index]}

echo $NEW_BRIGHTNESS > brightness
exit 0



if you have any improvements, don't hesitate to add :)

Carlchristian



Follow ups

References