public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sebastian Günther" <samson@guenther-roetgen.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Bash and ACPI issue - laptop lid
Date: Thu, 12 Mar 2009 13:13:32 +0100	[thread overview]
Message-ID: <20090312121332.GB7039@marvin.heimnetz.local> (raw)
In-Reply-To: <49B83E34.6070108@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]

* Saphirus Sage (saphirus497@gmail.com) [12.03.09 00:53]:
> 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

Looks normal.

> /etc/acpi/actions/lid.sh
>     #!/bin/bash
Maybe a 
      sleep 1 
will help with your issue (or more secs...)
>     for i in $(cat /proc/acpi/button/lid/LID/state | grep -o closed); do
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               This only has elements when the lid is closed, so the do 
               block will only be exexuted, if the lid is closed.
>         if [ $i = "closed" ]; then
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
          Therefor this is totally pointless, because we only come to 
          this point if the lid is closed and thus $i is always == "closed"
>         /usr/sbin/pm-suspend
>         fi
>         if [ $i != "closed" ]; then
>         sleep 5
>         fi
This whole block will never ever be reached, so you can easily erase it.

>     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?
> 

You should test if your Desktop Environment does the suspending for you. 
Then you have to tweak there, to get the behaviour you want.

HTH 
Sebastian

-- 
 " Religion ist das Opium des Volkes. "      Karl Marx

 SEB@STI@N GÜNTHER         mailto:samson@guenther-roetgen.de

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

      parent reply	other threads:[~2009-03-12 12:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 22:41 [gentoo-user] Bash and ACPI issue - laptop lid Saphirus Sage
2009-03-12  0:42 ` Mike Kazantsev
2009-03-12  1:35   ` Saphirus Sage
2009-03-12 12:13 ` Sebastian Günther [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090312121332.GB7039@marvin.heimnetz.local \
    --to=samson@guenther-roetgen.de \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox