#!/bin/sh
# Default acpi script that takes an entry for all actions

set $*

case "$1" in
    button)
	case "$2" in
	    power)	/sbin/init 0
		;;
	    lid)
	#    	logger "ACPI $*"
		;;
	    *)	logger "ACPI action $2 is not defined"
		;;
	esac
	;;
    ac_adapter)
	case `cat /proc/acpi/ac_adapter/"$2"/status | awk '{print $2}' ` in
	    off-line) 			
		logger "ACPI Power state change offline"
		longrun -s 0 0
		longrun -f economy
		echo brightness:1 > /proc/toshiba/lcd
		;;
	    on-line) 			
		logger "ACPI Power state change online"
		longrun -s 0 100
		longrun -f performance
		echo brightness:4 > /proc/toshiba/lcd
		;;
	    *)	logger "ACPI ac_adapter $2 strange error"
		;;
	esac
	;;
    
    *)
	# enable here when debugging 
	#logger "ACPI group $1 / action $2 is not defined"
	;;
esac
