You are not logged in.

#1 2012-04-16 04:19:29

amcollie
Member
Registered: 2011-06-22
Posts: 9

Dell Inspiron 9400 not suspending on lid closing

I am currently running arch linux 64 bit with LXDE.  I aslo have loaded modules acpid, howvever when I close the laptop lid it does not suspend to ram. After using google, I did not doscover any solution that worked for me.  According to one site, I added tthe following code to /etc/acpi/events/lid

event=button/lid
action=/etc/acpi/actions/lid.sh

/etc/acpi/actions/lid.sh contains:

#!/bin/bash

sleep &
sudo /usr/sbin/pm-suspend

acpid is runnig, however, when the lid is closed and acpi_listern is running there is printed to the terminal.

Would appreciate any help that help me solve this problem.

Offline

#2 2012-04-16 13:00:09

magicalChicken
Member
From: in the sky
Registered: 2012-03-03
Posts: 73
Website

Re: Dell Inspiron 9400 not suspending on lid closing

Ok you do not need the sudo in your script. The acpi event handler runs as root, and it would start the script as root. The reason the script is not running is that sudo is waiting for a password on a namespace that does not actually exist. Chances are you can just put /usr/sbin/pm-suspend straight into the /etc/acpi/handler.sh script. That reminds me of another thing, /etc/acpi/events/lid is sort of an old way of doing things. Look in your /etc/acpi/handler.sh script, you should see a case that is lid close or something like it. In that case just put the pm-suspend and it should work fine.

Offline

#3 2012-04-16 13:09:09

amcollie
Member
Registered: 2011-06-22
Posts: 9

Re: Dell Inspiron 9400 not suspending on lid closing

I tried that first, but it did not work. 
/etc/acpi/handler.sh contains:

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

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|SBTN)   echo -n mem >/sys/power/state ;;
            *)      logger "ACPI action undefined: $2" ;;
        esac
        ;;
    ac_adapter)
        case "$2" in
            AC|ACAD|ADP0)
                case "$4" in
                    00000000)
                        echo -n $minspeed >$setspeed
                        #/etc/laptop-mode/laptop-mode start
                    ;;
                    00000001)
                        echo -n $maxspeed >$setspeed
                        #/etc/laptop-mode/laptop-mode stop
                    ;;
                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)
       	case "$3" in
	    close)
		#echo "LID closed!">/dev/tty5
		sudo /usr/sbin/pm-suspend
		logger -s "ACPI lid closed";
		;;
	    open)
		#echo "LID opened!">/dev/tty5
		logger -s "ACPI lid opened"
        	;;
	esac
	;;

    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

According to one site I give member of the power group the ability to shutdown and restart the system without the requiring a password.

/etc/sudoers contains:

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias	WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias	ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias	PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
# 			    /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##
## Runas alias specification
##

##
## User privilege specification
##
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo	ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

%power ALL=(ALL) NOPASSWD: /usr/sbin/pm-hibernate
%power ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend
%power ALL=(ALL) NOPASSWD: /sbin/halt
%power ALL=(ALL) NOPASSWD: /sbin/reboot
%wheel ALL=(ALL) NOPASSWD: /usr/bin/yaourt -Sy
%jupiter ALL=NOPASSWD: /usr/lib/jupiter/scripts/bluetooth, /usr/lib/jupiter/scripts/camera, /usr/lib/jupiter/scripts/cpu-control, /usr/lib/jupiter/scripts/resolutions, /usr/lib/jupiter/scripts/rotate, /usr/lib/jupiter/scripts/touchpad, /usr/lib/jupiter/scripts/vga-out, /usr/lib/jupiter/scripts/wifi

The pm-suspend does work, I can suspend from lxde menu and the suspend button but not when the lid is closed.

Last edited by amcollie (2012-04-16 13:15:36)

Offline

Board footer

Powered by FluxBB