You are not logged in.

#1 2011-09-14 13:31:35

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Acpid settings at startup, after suspend [solved]

Hello all,

Consider the following situation.

Before suspending, my laptop was not connected to AC. After suspending, my laptop is now connected to AC. However the acpid daemon and handler.sh does not change to the settings defined for being connected to AC.

This is my handler.sh

#!/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
            PBTN|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
            AC0|ACAD|ADP0)
                case "$4" in
                    00000080)
                        echo -n $minspeed >$setspeed
                        #/etc/laptop-mode/laptop-mode start
			# System is connected to AC 

			# Set governor to performance level for both CPUs
			echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
			echo "performance" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

			# Set brightness to maximum
			echo "15" > /sys/class/backlight/acpi_video0/brightness
                    ;;
                    00000000)
                        echo -n $maxspeed >$setspeed
                        #/etc/laptop-mode/laptop-mode stop
			# System is not connected to AC 
	
			# Set governor to powersave level for both CPUs
			echo "powersave" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
			echo "powersave" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

			# Set brightness to a minimum level
			echo "5" > /sys/class/backlight/acpi_video0/brightness
                    ;;
                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
	# Suspend the system and lock the screen
	/usr/sbin/pm-suspend 
	DISPLAY=:0.0 su -c - robert /usr/bin/slimlock
        ;;
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

Is there any way to let acpid change to the new state after suspend?

Regards

Last edited by orschiro (2011-09-16 23:23:19)

Offline

#2 2011-09-16 23:23:00

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Acpid settings at startup, after suspend [solved]

To comment on this, I solved it through running a power management script with the help of the rc.local file.

More information can be found in the wiki.

Regards

Offline

Board footer

Powered by FluxBB