Been meaning to work on this problem, but have only just got round to it. Anyway for anyone who wants a script to constantly monitor for AC changes here is what I now use:
#! /bin/sh
# Script to check for the AC status and update Powerdevil accordingly
ac_adapters="$(hal-find-by-capability --capability ac_adapter)"
PREVIOUS="false" # Start with a value
N=1 #Spurious string to ensure while loop continues
while [ $N ]; do
#Read in the state of the battery
STATE=`cat /proc/acpi/ac_adapter/ADP0/state | sed s/.*://`
#Convert on-line / off-line to true / false
if [ $STATE = "on-line" ]; then
BOOL="true"
else
BOOL="false"
fi
#Test whether the state has changed
if [ "$BOOL" != "$PREVIOUS" ]; then
sudo hal-set-property --udi "$ac_adapters" --key ac_adapter.present --bool "$BOOL"
fi
# REcord what the current state is to test on next cycle
PREVIOUS=$BOOL
#Sleep for 10 seconds until next round
sleep 10
done
Then just make a link so that it autostarts on boot-up.
Hope this helps somebody. Thanks ertain for your sterling work to get this sorted.........