Gentoo Archives: gentoo-user

From: Saphirus Sage <saphirus497@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Bash and ACPI issue - laptop lid
Date: Wed, 11 Mar 2009 23:52:54
Message-Id: 49B83E34.6070108@gmail.com
I've been trying to setup my laptop to enter ACPI S3 (suspend to ram)
when I close the lid. I currently have the scripts setup as such:
/etc/acpi/events/lid
    event=button[ /]lid.*
    action=/etc/acpi/actions/lid.sh
/etc/acpi/actions/lid.sh
    #!/bin/bash
    for i in $(cat /proc/acpi/button/lid/LID/state | grep -o closed); do
        if [ $i = "closed" ]; then
        /usr/sbin/pm-suspend
        fi
        if [ $i != "closed" ]; then
        sleep 5
        fi
    done
The issue I've run into is that this will cause my laptop to suspend to
the RAM upon any change in the lid state, irregardless of if it is open
or closed. I tried to be more specific by utilizing the suffix of the
event, but it's incremental, which is a bit beyond my abilities. Any
suggestions to make this suspend only when the lid is closed?

Replies

Subject Author
Re: [gentoo-user] Bash and ACPI issue - laptop lid Mike Kazantsev <mike_kazantsev@×××××××.net>
Re: [gentoo-user] Bash and ACPI issue - laptop lid "Sebastian Günther" <samson@××××××××××××××××.de>