Crusoe ACPI

Put in /etc/acpi/ac_adapter.sh

 # Switch longrun on and off depending on battery status

 if [ [ $1 == "ac_adapter ADP1 00000080 00000000" ] ]
 then
        # Running on battery
        /usr/bin/longrun -f economy
        /usr/bin/longrun -s 0 20
        /usr/bin/longrun -t 1

        /sbin/iwconfig eth1 power period 2
        /sbin/iwconfig eth1 power 500m unicast
        /sbin/iwconfig eth1 power timeout 300u all
        /sbin/iwconfig eth1 power unicast
        /sbin/iwconfig eth1 power min period 2 power max period 4

 else
        # Running on AC
        /usr/bin/longrun -f performance
        /usr/bin/longrun -s 0 100
        /usr/bin/longrun -t 8

        /sbin/iwconfig eth1 power off
 fi

And in /etc/acpi/events/ac_adapter

 event=ac_adapter
 action=/etc/acpi/ac_adapter.sh "%e"