You are not logged in.

#1 2013-06-08 08:30:06

beitme
Member
Registered: 2013-05-24
Posts: 52

[SOLVED] how to prevent suspending/sleeping when closing laptop lid

Hi all,


My laptop, a Lenovo Thinkpad T430u, suspends whenever I close the lid. It's been doing this since I first installed Arch.  I want to turn this feature off.  How can I do it?

Relevant information:

acpid is installed
the configuration file /etc/acpi/handler.sh

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

case "$1" in
    button/power)
        case "$2" in
            PBTN|PWRF)
                logger 'PowerButton pressed'
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    button/sleep)
        case "$2" in
            SLPB|SBTN)
                logger 'SleepButton pressed'
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    ac_adapter)
        case "$2" in
            AC|ACAD|ADP0)
                case "$4" in
                    00000000)
                        logger 'AC unpluged'
                        ;;
                    00000001)
                        logger 'AC pluged'
                        ;;
                esac
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    battery)
        case "$2" in
            BAT0)
                case "$4" in
                    00000000)
                        logger 'Battery online'
                        ;;
                    00000001)
                        logger 'Battery offline'
                        ;;
                esac
                ;;
            CPU0)
                ;;
            *)  logger "ACPI action undefined: $2" ;;
        esac
        ;;
    button/lid)
        case "$3" in
            close)
                logger 'LID closed'
                ;;
            open)
                logger 'LID opened'
                ;;
            *)
                logger "ACPI action undefined: $3"
                ;;
    esac
	case $(cat /proc/acpi/button/lid/LID0/state | awk '{print $2}') in
    	closed) XAUTHORITY=$(ps -C xinit -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') xset -display :0 dpms force off ;;
    	open)   XAUTHORITY=$(ps -C xinit -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') xset -display :0 dpms force on  ;;
	esac
    ;;
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

# vim:set ts=4 sw=4 ft=sh et:

dmesg output:

[ 1530.790532] PM: Syncing filesystems ... done.
[ 1530.805678] PM: Preparing system for mem sleep
[ 1530.844445] Freezing user space processes ... (elapsed 0.01 seconds) done.
[ 1530.856658] Freezing remaining freezable tasks ... (elapsed 0.10 seconds) done.
[ 1530.963435] PM: Entering mem sleep
[ 1530.963572] Suspending console(s) (use no_console_suspend to debug)
[ 1531.123543] iwlwifi 0000:03:00.0: iwl_pcie_cmdq_reclaim: Read index for DMA queue txq id (9), index 207 is out of range [0-256] 208 208.
[ 1531.124216] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 1531.124579] sd 0:0:0:0: [sda] Stopping disk
[ 1531.360682] mei 0000:00:16.0: suspend
[ 1531.440517] ahci 0000:00:1f.2: power state changed by ACPI to D3hot
[ 1531.687309] PM: suspend of devices complete after 722.490 msecs
[ 1531.687784] PM: late suspend of devices complete after 0.469 msecs
[ 1531.688232] pcieport 0000:00:1c.3: System wakeup enabled by ACPI
[ 1531.714222] ehci-pci 0000:00:1d.0: System wakeup enabled by ACPI
[ 1531.727619] ehci-pci 0000:00:1a.0: System wakeup enabled by ACPI
[ 1531.754015] xhci_hcd 0000:00:14.0: System wakeup enabled by ACPI
[ 1531.767422] PM: noirq suspend of devices complete after 79.565 msecs
[ 1531.768301] ACPI: Preparing to enter system sleep state S3
[ 1531.797647] PM: Saving platform NVS memory
[ 1531.799282] Disabling non-boot CPUs ...
[ 1531.900721] smpboot: CPU 1 is now offline
[ 1532.004162] smpboot: CPU 2 is now offline
[ 1532.107554] smpboot: CPU 3 is now offline

I have pmutils and tlpinstalled

tlp config

# ------------------------------------------------------------------------------
# tlp - Parameters for power save
 
# Hint: some features are disabled by default, remove the leading # to enable them
 
# Set to 0 to disable/1 to enable TLP
TLP_ENABLE=1
 
# Seconds laptop mode has to to wait after the disk goes idle before doing a sync.
# Non-zero value enables, zero disables laptop mode.
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
 
# Dirty page values (timeouts in secs).
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60

# Select a cpu frequency scaling governor: ondemand/powersave/performance/conservative
# Important:  
# - You *must* disable your distribution's governor settings or conflicts will occur
# - ondemand is sufficient for *almost all* workloads, you should know what you're doing!
#CPU_SCALING_GOVERNOR_ON_AC=ondemand
#CPU_SCALING_GOVERNOR_ON_BAT=ondemand

# Set the min/max frequency available for the scaling governor.
# Possible values strongly depend on your cpu. For available frequencies see 
# tlp-stat output, Section "+++ Processor".
# Hint: Parameters are disabled by default, remove the leading # to enable them,
#       otherwise kernel default values are used.
#CPU_SCALING_MIN_FREQ_ON_AC=0
#CPU_SCALING_MAX_FREQ_ON_AC=0
#CPU_SCALING_MIN_FREQ_ON_BAT=0
#CPU_SCALING_MAX_FREQ_ON_BAT=0

# Set the cpu "turbo boost" feature: 0=disable / 1=allow 
# Requires an Intel Core i processor and kernel 3.7 or later.
# Important:
# - This may conflict with your distribution's governor settings
# - A value of 1 does *not* activate boosting, it just allows it
#CPU_BOOST_ON_AC=1
#CPU_BOOST_ON_BAT=0

# Minimize number of used cpu cores/hyper-threads under light load conditions
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1

# Kernel NMI Watchdog
# 0=disable (default, saves power) / 1=enable (for kernel debugging only)
NMI_WATCHDOG=0
        
# Change CPU voltages aka "undervolting" - Kernel with PHC patch required
# Freq:voltage pairs are written to /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
# CAUTION: only use this, if you thoroughly understand what you are doing!
#PHC_CONTROLS="F:V F:V F:V F:V"
 
# Hard disk devices, separate multiple devices with spaces (default: sda).
# Devices can be specified by disk id too (lookup with: tlp diskid).
DISK_DEVICES="sda sdb"

# Hard disk advanced power management level: 1(max saving)..254(off)
# Levels 1..127 may spin down the disk.
# Separate values for multiple devices with spaces.
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"

# Hard disk spin down timeout:
# 0:        spin down disabled
# 1..240:   timeouts from 5s to 20min (in units of 5s)
# 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
# (see 'man hdparm' for details)
#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"

# Select io scheduler for the disk devices: noop/deadline/cfq (Default: cfq) 
# Separate values for multiple devices with spaces.
#DISK_IOSCHED="cfq cfq"
 
# SATA aggressive link power management (ALPM):
# min_power/medium_power/max_performance
SATA_LINKPWR_ON_AC=max_performance
SATA_LINKPWR_ON_BAT=min_power

# PCI Express Active State Power Management (PCIe ASPM):
# default/performance/powersave
# Hint: needs kernel boot option pcie_aspm=force on some machines 
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave

# Radeon graphics clock speed (profile method): low/mid/high/auto/default
# auto = mid on BAT, high on AC; default = use hardware defaults
# (Kernel >= 2.6.35 only, not with fglrx driver!)
RADEON_POWER_PROFILE_ON_AC=high
RADEON_POWER_PROFILE_ON_BAT=low
 
# WiFi power saving mode: 1=disable/5=enable
# (Linux 2.6.32 and later, some adapters only!)
WIFI_PWR_ON_AC=1
WIFI_PWR_ON_BAT=5
 
# Disable wake on lan: Y/N
WOL_DISABLE=Y
 
# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
# A value of 0 disables / >=1 enables power save.
SOUND_POWER_SAVE=1
# Disable controller too (HDA only): Y/N
SOUND_POWER_SAVE_CONTROLLER=Y

# Set to 1 to power off optical drive in UltraBay (ThinkPads only) 
# when running on battery. A value of 0 disables this Feature (Default).
# Drive can be powered on again by releasing (and reinserting) the
# eject lever or by pressing the disc eject button on newer models.
# Note: an UltraBay hard disk is never powered off.
BAY_POWEROFF_ON_BAT=0
# Optical drive device to power off (default sr0)
BAY_DEVICE="sr0"
 
# Runtime Power Management for pci(e) bus devices 
# (Kernel >= 2.6.35 only): on=disable/auto=enable
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=auto

# Runtime PM for *all* pci(e) bus devices: 0=disable / 1=enable
# Warning: experimental option, could cause system instabilities
RUNTIME_PM_ALL=0

# Set to 0 to disable/1 to enable usb autosuspend feature
USB_AUTOSUSPEND=1
 
# Devices from the following list are excluded from usb autosuspend
# (separate with spaces). Use lsusb to get the id's.
# Note: input devices (usbhid) are excluded automatically
#USB_BLACKLIST="1111:2222 3333:4444"

# Set to 1 to disable autosuspend before shutdown/0 to do nothing 
# (workaround for usb devices that cause shutdown problems)
#USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1

# Restore radio device state (bluetooth, wifi, wwan) from previous shutdown
# on system startup: 0=disable/1=enable
# Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
#       are ignored when this is enabled!
RESTORE_DEVICE_STATE_ON_STARTUP=0
 
# Radio devices to disable on startup: bluetooth wifi wwan
#DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"

# Radio devices to enable on startup: bluetooth wifi wwan
#DEVICES_TO_ENABLE_ON_STARTUP="wifi"
 
# Radio devices to disable on shutdown: bluetooth wifi wwan
# (workaround for devices that are blocking shutdown)
#DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"

# Radio devices to enable on shutdown: bluetooth wifi wwan
# (to prevent other operating systems from missing radios)
#DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"

# Radio devices to enable when wireless radio switch is turned on:
# bluetooth wifi wwan (Ubuntu + ThinkPad only)
#DEVICES_TO_ENABLE_ON_RADIOSW="wifi wwan"
 
# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module required)
# Charging starts when the remaining capacity falls below the START_CHARGE_TRESH
# value and stops when exceeding the STOP_CHARGE_TRESH value.
# Main battery (values in %)
#START_CHARGE_THRESH_BAT0=75
#STOP_CHARGE_THRESH_BAT0=80
# Ultrabay or slice battery (values in %)
#START_CHARGE_THRESH_BAT1=75
#STOP_CHARGE_THRESH_BAT1=80

# Set to 1 to disable use of tpacpi-bat on Sandy Bridge or newer Thinkpads
# and force usage of tp-smapi instead
#DISABLE_TPACPIBAT=1

# ------------------------------------------------------------------------------
# tlp-rdw - Parameters for the radio device wizard
# Possible devices: bluetooth/wifi/wwan

# Hint: parameters are disabled by default, remove the leading # to enable them

# Radio devices to disable on connect 
DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"

# Radio devices to enable on disconnect 
DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""

# Radio devices to enable/disable when docked
#DEVICES_TO_ENABLE_ON_DOCK=""
#DEVICES_TO_DISABLE_ON_DOCK=""

# Radio devices to enable/disable when undocked
#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
#DEVICES_TO_DISABLE_ON_UNDOCK=""


thanks guys

I love arch

Last edited by beitme (2013-06-08 10:05:37)

Offline

#2 2013-06-08 08:55:09

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] how to prevent suspending/sleeping when closing laptop lid

beitme, please edit your post.
When pasting code, please use [ code ] tags not [ quote ] tags https://bbs.archlinux.org/help.php#bbcode

like this

It makes the code more readable and - in case of longer listings - more convenient to scroll through.

Offline

#3 2013-06-08 09:21:12

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: [SOLVED] how to prevent suspending/sleeping when closing laptop lid

Offline

#4 2013-06-08 09:36:18

beitme
Member
Registered: 2013-05-24
Posts: 52

Re: [SOLVED] how to prevent suspending/sleeping when closing laptop lid

@ Karol, done

@ 65kid, here's my logind.conf

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#Controllers=
#ResetControllers=cpu
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#IdleAction=ignore
#IdleActionSec=30min

Offline

#5 2013-06-08 09:39:00

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: [SOLVED] how to prevent suspending/sleeping when closing laptop lid

beitme wrote:

@ 65kid, here's my logind.conf

#HandleLidSwitch=ignore

Well, you may actually want to uncomment this line....

Offline

#6 2013-06-08 10:05:11

beitme
Member
Registered: 2013-05-24
Posts: 52

Re: [SOLVED] how to prevent suspending/sleeping when closing laptop lid

65kid wrote:
beitme wrote:

@ 65kid, here's my logind.conf

#HandleLidSwitch=ignore

Well, you may actually want to uncomment this line....


that did it

thanks

Offline

Board footer

Powered by FluxBB