<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://dev1galaxy.org/extern.php?action=feed&amp;tid=117&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / How to make the 'sleep' button work if yours doesn't]]></title>
		<link>http://dev1galaxy.org/viewtopic.php?id=117</link>
		<description><![CDATA[The most recent posts in How to make the 'sleep' button work if yours doesn't.]]></description>
		<lastBuildDate>Tue, 04 Apr 2017 20:37:34 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: How to make the 'sleep' button work if yours doesn't]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=1070#p1070</link>
			<description><![CDATA[<p><strong>A slightly more complete solution</strong></p><p>First, I commented out <em>/etc/acpi/events/powerbtn-acpi-support</em>:</p><div class="codebox"><pre><code>#event=button[ /]power
#action=/etc/acpi/powerbtn-acpi-support.sh</code></pre></div><p>This ensures that my laptop doesn&#039;t shutdown (or do anything special) when I press on the power button by mistake (it happens...).</p><p>Then I wrote a generic handler in <em>/etc/acpi/events/default</em>:</p><div class="codebox"><pre><code>event=.*
action=/etc/acpi/default.sh %e</code></pre></div><p>This is going to intercept every ACPI event and call a single script with all available arguments. I do not understand the design decision behind the ACPI daemon, with this concept of event files calling scripts, that tend to be so short and to multiply, so I prefer to put all the logic in a single script. Feel free to do it your own way <img src="http://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Finally, the file where the magic happens, <em>/etc/acpi/default.sh</em>:</p><div class="codebox"><pre><code>#!/bin/sh

# log every event in /var/log/messages (can be commented later on)
logger &quot;ACPI event $*&quot;

case &quot;$1&quot; in
    button/sleep)
        [ $2 = &quot;SBTN&quot; ] &amp;&amp; pm-suspend
    ;;
    button/lid)
        [ $2 = &quot;LID&quot; ] &amp;&amp; [ $3 = &quot;close&quot; ] &amp;&amp; pm-suspend
    ;;    
esac</code></pre></div><p>The actual values on someone else&#039;s system could be different, this is why it is convenient to log everything when testing the script.</p><p>Also, you do not need to restart your acpid service, you can just reload it (though I don&#039;t know whether that makes a real difference):</p><div class="codebox"><pre><code> # /etc/init.d/acpid reload</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (malinas)]]></author>
			<pubDate>Tue, 04 Apr 2017 20:37:34 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=1070#p1070</guid>
		</item>
		<item>
			<title><![CDATA[Re: How to make the 'sleep' button work if yours doesn't]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=511#p511</link>
			<description><![CDATA[<p>It&#039;s worth to note that some buttons generate many events, with different arguments. E.g., my lid button has &quot;open&quot; or &quot;close&quot; as (third) arguments . The script (or the recognition rule) will then need to distinguish appropriately, to get the right thing done for the right event(s).</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Mon, 23 Jan 2017 20:38:03 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=511#p511</guid>
		</item>
		<item>
			<title><![CDATA[How to make the 'sleep' button work if yours doesn't]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=502#p502</link>
			<description><![CDATA[<p><strong>How to make the &#039;sleep&#039; button work if yours doesn&#039;t</strong></p><p>One small issue that I&#039;d been having with Devuan Jessie since I first started using it last October was that the sleep button didn&#039;t do anything. The sleep button works fine in Debian Jessie, and I suspect that upower now expects some systemd component or other. BTW, this is an ancient (2008) Compaq Presario, Dual Pentium @ 2 GHz, 4 GB RAM rig. It runs beautifully.</p><p>Typing &#039;sudo pm-suspend&#039; in a terminal worked fine, so I knew that the basic sleep functionality was there. At the suggestion of ralph.ronnquist in the Hardware and System Configuration forum I decided to see if I could come up with an acpi event handler to invoke a script to run pm-suspend.</p><p>First I wanted to confirm that the sleep button was indeed generating an acpi event, so I ran acpi_listen and pressed the sleep button. Sure enough, it showed &#039;button/sleep SBTN 00000080 00000000 K&#039;.</p><p>Then I went to /etc/acpi/events to make a handler for this event. There was one there already for the power button (powerbtn-acpi-support), so I just copied and modified it for my sleep button, cleverly named &#039;sleepbtn-acpi-support&#039;, containing the following:</p><div class="codebox"><pre><code>event=button[ /]sleep
action=/etc/acpi/sleepbtn-acpi-support.sh</code></pre></div><p>Then I simply made the sleepbtn-acpi-support.sh script in /etc/acpi, to whit:</p><div class="codebox"><pre><code>#!/bin/sh

# This script calls pm-suspend when the sleep button has been
# pressed.

	# Normal handling.
	/usr/sbin/pm-suspend</code></pre></div><p>That&#039;s it. Reboot, or restart the acpi daemon, and voila! A press of the sleep button now sends my computer to sleep! I had the same issue with Devuan Ascii, and the same fix applies.</p><p>Of course, now you know how to make the sleep button do whatever you want ;-)</p>]]></description>
			<author><![CDATA[dummy@example.com (sgage)]]></author>
			<pubDate>Wed, 18 Jan 2017 18:13:48 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=502#p502</guid>
		</item>
	</channel>
</rss>
