From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1LhZpl-0001Wm-M4 for garchives@archives.gentoo.org; Thu, 12 Mar 2009 01:35:41 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 79853E034D; Thu, 12 Mar 2009 01:35:40 +0000 (UTC) Received: from mail-qy0-f125.google.com (mail-qy0-f125.google.com [209.85.221.125]) by pigeon.gentoo.org (Postfix) with ESMTP id 540B6E034D for ; Thu, 12 Mar 2009 01:35:40 +0000 (UTC) Received: by qyk31 with SMTP id 31so491873qyk.32 for ; Wed, 11 Mar 2009 18:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=WhQ9zhx+j4+0rZ9HFiwLinRVF1lxGS3tjI//QGeRtoM=; b=bqttwK2vy3iSRSwW9xaJQY1qiSQDDJ6862ID4l84EJmxdIimlnsgh8epADEFINwAtx DnSVDyi+hklrbR8VmdoBySZEqr0V8zb6JTSLnB7OpVhHWV/fzFOS/+/J9SqQSj2APLg+ YIQYByOKt5K1TQH9DIsXGmN1yurPUuzteDLS8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=IYow6+snBWSW8QkFQmHs2HU6bxdAgmruTI6pENti1oNMkkdYgz6lOTJjlWiq0Vp2np 2XzzVCTOx/+V5Sg0qWLjm5MZyJuRzfRrbfGi1nwGNKCpZUKhW0CCgLIoUDl7gTQl1pIS jt+32UXjb9YwT/0EsiHof3G+9OGjDZNtsKdeI= Received: by 10.224.19.202 with SMTP id c10mr12315368qab.30.1236821740004; Wed, 11 Mar 2009 18:35:40 -0700 (PDT) Received: from gentoo-everex.local (cpe-72-185-51-230.tampabay.res.rr.com [72.185.51.230]) by mx.google.com with ESMTPS id 4sm325194yxd.10.2009.03.11.18.35.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 11 Mar 2009 18:35:39 -0700 (PDT) Message-ID: <49B866EA.9060003@gmail.com> Date: Wed, 11 Mar 2009 21:35:38 -0400 From: Saphirus Sage User-Agent: Thunderbird 2.0.0.19 (X11/20081231) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Bash and ACPI issue - laptop lid References: <49B83E34.6070108@gmail.com> <20090312054250.25aca3d3@coercion> In-Reply-To: <20090312054250.25aca3d3@coercion> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Archives-Salt: 521059fc-2d5d-410e-857f-e9e75ed581af X-Archives-Hash: e585df078e6a82576066fbb8487a9ea1 Mike Kazantsev wrote: > On Wed, 11 Mar 2009 18:41:56 -0400 > Saphirus Sage wrote: > > >> 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? >> > > This one seem to be working for me: > > #!/bin/sh > if grep closed /proc/acpi/button/lid/LID0/state &>/dev/null > then echo "Lid closed, suspending..." > else echo "Lid is open, doing nothing" > fi > > > Then, you can just put it to, say, crontab, with a line like this: > > */5 * * * * /path/to/script.sh > > ...which'll make it run every five minutes, so the laptop will be > suspended within five mins of closing the lid, which should also > prevent accidental closing events. > > > Of course, you should put your actions to the aforementioned script, if > you want it to do something useful, instead of just experimental echo I'd considered using a crontab entry, it just seemed so inefficient in comparison. However, I used the little chunk you provided as you've suggested and it works well enough now, thanks. Apparently, after researching it a bit, there are numerous bugs with acpi, which may explain why the state in /proc/acpi/buttons/lid/LID/state would seem to hang for a couple minutes, or until a restart. Still, thanks again.