You are not logged in.

#1 2009-07-30 01:04:01

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Laptop-mode not changing brightness, even with working script

I put this script in /etc/laptop-mode/batt-start/ so that it reduces the brightness to 15% in laptop mode and increases it to 90% after laptop mode stops.

#!/bin/bash
VIDEO=`/usr/sbin/lspci | grep -c nVidia`
case "$1" in
'start')
if [ "$VIDEO" = 1 ]; then
sudo nvclock -S 15
else
xbacklight -set 15
fi
;;
'stop')
if [ "$VIDEO" = 1 ]; then
sudo nvclock -S 90
else
xbacklight -set 90
fi
;;
'restart')
echo "Usage: $0 [start|stop]""
;;
esac

The reason it's so weird is that I have two graphics cards; I choose which one I want with a STAMINA|SPEED switch, with the nvidia card being the SPEED option and the intel being STAMINA. I am using both open source drivers, so xf86-video-nv and xf86-video-intel, so they don't conflict. sudo nvclock -S 15 sets the brightness to 15% when using the nvidia card, while xbacklight works with the intel card. What this script does is first check if I am using the nvidia card, and if I am, it uses the nvclock command. If not, it uses the xbacklight command to adjust the brightness. Laptop-mode-tools should run this script automatically upon entering laptop mode on battery. I know this script works because I tested it by running it manually, and it works perfectly. It is also written from the exact same framework as a script I use to switch xorg.conf's upon change in graphics cards, which works perfectly.


The problem is right now I'm using the intel card, so the script should run the xbacklight command, but when I unplug my laptop, the brightness does not change. conky tells me the battery is discharging (it is reading from acpi), but the brightness doesn't change automatically. I have to do that myself (which works just fine with xbacklight when I run it manually from the command line, or even when I bind it to a key combination). It  works perfectly with my nvidia card; nvclock changes the brightness only a few seconds after I unplug the laptop.

What could be going wrong? Why isn't laptop-mode running my script? It is executable and executable by my normal user.

Last edited by Allamgir (2009-07-30 01:07:03)


дɭɭɑӎɠїɾ

Offline

Board footer

Powered by FluxBB