So I've been tooling with upgrading to the 3.12 kernel on my thinkpad T400, and I've discovered that my custom acpi scripts are now being run twice on lid events for some reason. Has anyone else run into this?
Code:
# /etc/acpi/events/lid
event=(button/lid)
action=/etc/acpi/actions/smartsleep.sh %e
Code:
/etc/acpi/actions/smartsleep.sh:
#!/bin/sh
BAT_DIR=/sys/class/power_supply/BAT0
FULL_BAT=`cat ${BAT_DIR}/energy_full`
CUR_BAT=`cat ${BAT_DIR}/energy_now`
AVG=`expr $(expr ${CUR_BAT} \* 100) / ${FULL_BAT}`
logger "Running smartsleep script"
if grep -q 1 /sys/class/power_supply/AC/online; then
/etc/acpi/actions/sleep.sh
exit 0
fi
if [ "$AVG" -le "20" ]; then
echo suspend > /sys/power/disk
/etc/acpi/actions/hibernate.sh
exit 0
else
/etc/acpi/actions/sleep.sh
fi
Here is the output to /var/log/messages when I close the lid:
Code:
# grep smartsleep /var/log/messages
Dec 19 14:13:03 6h057 logger: Running smartsleep script
Dec 19 14:13:19 6h057 logger: Running smartsleep script
This ACPI configuration works fine with the 3.10 kernel, and I know that they dropped the deprecated /proc/acpi/event interface in 3.12, but I didn't think I was using that anyway.