The brightness scripts aren't working for me in Karmic, here's what I did, maybe I'm making a mistake somewhere:
-created an /etc/acpi/brightness.sh
-pasted in bill's script:
Originally Posted by
billl
Code:
#!/bin/bash
getXdisplay() {
console=`fgconsole 2> /dev/null`
DISPLAY=`ps ax | grep -m1 -e "[X] .* vt${console}" | sed -re "s,.*/X .*:([0-9]+).*,:\1,"`
export DISPLAY
}
getXuser() {
getXdisplay
USER=`finger | grep -m1 "${DISPLAY}" | awk '{print $1}'`
export USER
}
getBrightness() {
getXuser
sudo -u ${USER} dbus-send --session --type=method_call --print-reply --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Backlight org.freedesktop.PowerManagement.Backlight.GetBrightness | tail -n 1 | grep -ow "[[:digit:]]\+"
}
setBrightness() {
brn=${1}
[ ${brn} -ge 0 ] || brn=0
[ ${brn} -le 100 ] || brn=100
getXuser
sudo -u ${USER} dbus-send --session --type=method_call --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Backlight org.freedesktop.PowerManagement.Backlight.SetBrightness uint32:${brn}
}
incBrightness() {
level=`getBrightness`
if [ ${level} -lt 100 ]; then
setBrightness $((${level} + 5))
fi
}
decBrightness() {
level=`getBrightness`
if [ ${level} -gt 0 ]; then
setBrightness $((${level} - 5))
fi
}
BRIGHTNESS_FILE="/var/lib/acpi-support/brightness"
if [ -f "${BRIGHTNESS_FILE}" ]; then
BRIGHTNESS_OLD=`cat "${BRIGHTNESS_FILE}"`
fi
BRIGHTNESS_NEW=`echo "${3}" | tr "[a-f]" "[A-F]"`
if [ x"${BRIGHTNESS_OLD}" != x"" ]; then
if [ x"${BRIGHTNESS_NEW}" = x"${BRIGHTNESS_OLD}" ]; then
if [ x"${BRIGHTNESS_NEW}" = x"0000002F" ]; then
incBrightness
elif [ x"${BRIGHTNESS_NEW}" = x"00000020" ]; then
decBrightness
fi
else
res=`echo "ibase=16; ${BRIGHTNESS_NEW} > ${BRIGHTNESS_OLD}" | bc`
[ ${res} -eq 1 ] && incBrightness || decBrightness
fi
fi
echo "${BRIGHTNESS_NEW}" > "${BRIGHTNESS_FILE}"
-saved and exited
-made executable:
Code:
sudo chmod +x /etc/acpi/brightness.sh
-created a /etc/acpi/events/brightness
-paste in:
Code:
event=hotkey ATKD 0000002[0-9a-f]
action=/etc/acpi/brightness.sh
-save and exit
-reboot
I did the exact same thing with Leed's, (after deleting /etc/acpi/brightness.sh and /ect/acpi/events/brightness)
I tried:
Code:
dbus-send --session --type=method_call --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Backlight org.freedesktop.PowerManagement.Backlight.SetBrightness uint32:x
putting numbers between 0 and 100 in place of x, I also tried putting in the hexidecimals 00000020 and 0000002F as they were mentioned in bill's script, when testing leed's both a number that showed in the script (0,30,35...) and the corresponding hexidecimal.
also, I tried executing the following commands:
Originally Posted by
billl
To increase the brightness:
Code:
sudo brightness.sh hotkey ATKD 0000002f
To decrease the brightness:
Code:
sudo brightness.sh hotkey ATKD 00000020
but both always returned "command not found " even if i was in the same directory.
There were two other events (with there corresponding .sh files) which I thought might conflict, the events were:
asus-brightness-up:
Code:
event=hotkey (ATKD|HOTK) 0000001[0123456789abcdef]
action=/etc/acpi/asus-brn-up.sh
and
asus-brightness-down:
Code:
event=hotkey (ATKD|HOTK) 0000002[0123456789abcdef]
action=/etc/acpi/asus-brn-down.sh
the .sh files (asus-brn-down.sh and asus-brn-up.sh):
Code:
#!/bin/sh
test -f /usr/share/acpi-support/key-constants || exit 0
. /usr/share/acpi-support/key-constants
acpi_fakekey $KEY_BRIGHTNESSDOWN
and
Code:
#!/bin/sh
test -f /usr/share/acpi-support/key-constants || exit 0
. /usr/share/acpi-support/key-constants
acpi_fakekey $KEY_BRIGHTNESSUP
executing:
or
had no noticeable effect
So I deleted them, but it still didn't work...
Anyone got any ideas? Is this a Karmic thing, or am I doing it incorrectly?
Bookmarks