You are not logged in.
Hey,
First off, I apologize if this was covered anywhere already, but I wasn't able to find a solution that worked for me yet. My problem is that I have an acpi handler.sh script configured to run xbacklight -set 15 on battery, and -set 100 on AC, yet it doesn't do so. The command works for me from my user account, and all the other settings from the handler.sh file are applied (as far as I can tell). Is it something simple I've overlooking? Is there a better way to do so without gnome-power-manager, or laptop-mode-tools (don't work for me)?
ACPI packages I have installed:
acpi
acpi-support
acpid
I also have acpid and acpi-support in my rc.conf daemons array.
Thanks in advance for any suggestions,
Lswest
Handler.sh file:
#!/bin/sh
# Default acpi script that takes an entry for all actions
# NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
# modify it to not use /sys
minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
set $*
case "$1" in
button/power)
#echo "PowerButton pressed!">/dev/tty5
case "$2" in
PWRF) logger "PowerButton pressed: $2" ;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
button/sleep)
case "$2" in
SLPB) echo -n mem >/sys/power/state ;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
ac_adapter)
case "$2" in
AC)
case "$4" in
00000000)
echo -n $minspeed > $setspeed;
xbacklight -set 15;
hciconfig hci0 down;
/etc/rc.d/bluetooth stop;
rmmod hci_usb;
ifconfig eth0 down;
echo min_power >> /sys/class/scsi_host/host0/link_power_management_policy;
echo 1500 >> /proc/sys/vm/dirty_writeback_centisecs;
;;
00000001)
echo -n $maxspeed > $setspeed;
xbacklight -set 100;
ifconfig eth0 up;
modprobe hci_usb;
hciconfig hci0 up;
/etc/rc.d/bluetooth start;
echo max_performance >> /sys/class/scsi_host/host0/link_power_management_policiy
echo 500 >> /proc/sys/vm/dirty_writeback_centisecs
;;
esac
;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
battery)
case "$2" in
BAT0)
case "$4" in
00000000) #echo "offline" >/dev/tty5
;;
00000001) #echo "online" >/dev/tty5
;;
esac
;;
CPU0)
;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
button/lid)
#echo "LID switched!">/dev/tty5
pm-suspend;
;;
*)
logger "ACPI group/action undefined: $1 / $2"
;;
esac
Last edited by lswest (2010-07-19 21:45:43)
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
Your script does not specify a fully qualified path to xbacklight.
I think your problem is that the path to xbacklight may not be in root's PATH, therefore the script cannot find it.
Either (1) add the path to xbacklight to root's PATH (Probably a bad idea) or
(2) change the script to provide an explicit, fully qualified name (example /usr/bin/xbacklight [I don't know if that is correct, so don't just use this example])
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Thanks for the response. Providing an absolute path doesn't change anything, but it was a good call on your part (and the path you provided is actually the correct one).
Would there be any way to see if the command is executed?
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
Would there be any way to see if the command is executed?
you can make a short script called backlight.sh and from there call xbacklight plus write a syslog entry with 'logger'. something like:
#!/bin/sh
xbacklight -set 15
logger "Backlight set to 15"
edit: actually that wouldn't help you much, you can also place a logger line below the current xbacklight call (and it doesn't tell you if xbacklight was actually executed)
Last edited by litemotiv (2010-07-19 20:26:22)
ᶘ ᵒᴥᵒᶅ
Offline
edit: actually that wouldn't help you much, you can also place a logger line below the current xbacklight call (and it doesn't tell you if xbacklight was actually executed)
Isn't there some way to check return signals of programs for successful execution or not? *tries to remember his bash scripting skills*
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
Isn't there some way to check return signals of programs for successful execution or not? *tries to remember his bash scripting skills*
you did test if you can actually run xbacklight -set 15 as root?
ᶘ ᵒᴥᵒᶅ
Offline
D'oh. Somewhere along the way today (installing acpid or acpi-support, or using the asus-laptop module) caused xbacklight to no longer recognize my monitor as having backlight properties. The brightness is still being adjusted by a script that is supplied with the acpi-support package (I believe) but not my custom script with xbacklight. The reason why it worked for me before was that I hadn't rebooted since making the changes. I'll be marking this solved and just try to figure out what made the change and undo it.
Thanks for the help (I feel silly now!),
Lswest
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
Have you tried:
DISPLAY=:0.0 xbacklight -set 15
?
Offline
Whatever variation of xbacklight I give in I get the following:
No outputs have backlight property.
I had the same issue originally with KMS and the intel driver.
Found a solution that works for me:
asus-laptop (kernel module) introduces a few new settings and features to the kernel for asus laptops. One of which is to create a brightness file for the LED Monitor (didn't exist for my Asus UL30A), where it then sets the brightness. Not sure if breaking xbacklight was intended or not, but for anyone experiencing the same problem, echo 0-15 (15=max brightness) in handler.sh (it should work, haven't yet gotten it to do so though) to this file: /sys/devices/platform/asus_laptop/backlight/asus_laptop/brightness, in order to automatically adjust brightness levels. Brightness keys work as before.
*EDIT...hopefully the last one* It seems acpi-support uses pm-powersave, meaning you need to add your custom actions to /etc/pm/power.d/ (haven't tried it yet, but for anyone who need the info, it's here).
Last edited by lswest (2010-07-19 22:04:59)
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
You could also try this code in your hander.sh:
export XAUTHORITY="$USERHOME/.Xauthority"
for x in /tmp/.X11-unix/*; do
DISPLAYNUM=$(echo $x | sed s#/tmp/.X11-unix/X##)
if [[ -f "$XAUTHORITY" ]]; then
export DISPLAY=":$DISPLAYNUM"
fi
done
I'm using the control file way too and it works for me (though on a thinkpad):
BRIGHT=/sys/class/backlight/acpi_video0/brightness
EVENT=$1\ $2\ $3\ $4
case "$EVENT" in
ac*0) [[ $(cat $BRIGHT) != 4 ]] && echo 4 > $BRIGHT;;
ac*1) [[ $(cat $BRIGHT) != 8 ]] && echo 8 > $BRIGHT;;
esac
no place like /home
github
Offline
I appreciate the response, but I've found using pm-powersave via acpi-support is actually working better than any acpi configuration I had, and it's fairly simple to configure and back up, so I'll be sticking with that solution.
I'll keep the info in mind if pm-powersave stops working for any reason.
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline