<div dir="ltr">Thank you for the information.<div><br></div><div style>I&#39;ve put some scripts in each of the directories that really make the laptop work well so far ;)</div><div style><br></div><div style>Just in case others are having battery life problems with laptops installing tuned an tuned-profiles-compat on the laptop, and putting this script in the /etc/pm/power.d directory makes a big difference in battery life.</div>
<div style><br></div><div style><div>#!/bin/sh</div><div style># 00-powermodes</div><div>case $1 in</div><div>    true)<span class="" style="white-space:pre">                </span></div><div><span class="" style="white-space:pre">        </span>tuned-adm profile laptop-battery-powersave</div>
<div>        ;;</div><div>    false)</div><div><span class="" style="white-space:pre">        </span>tuned-adm profile balanced</div><div><span class="" style="white-space:pre">        </span>;;</div><div>    *)  echo &quot;ERROR: used incorrectly.&quot;</div>
<div>        ;;</div><div>esac</div><div><br></div></div><div style>the file should name should start with 00 to 20 so I called my file 00-powermodes</div><div style><br></div><div style>As well I had a suspend and resume problem with the backlight on my Dell XPS 13 (Intel GMA 4000).. after a suspend and resume, the backlight would could not be adjusted, and was set to max brightness.</div>
<div style><br></div><div style>In order to fix this I put this script in /etc/brightness/fixbr.sh</div><div style><br></div><div style><div>#!/bin/sh</div><div>case $1 in</div><div>    awake)</div><div><span class="" style="white-space:pre">        </span>echo &quot;000&quot; &gt; /sys/class/backlight/intel_backlight/brightness</div>
<div><span class="" style="white-space:pre">        </span>echo &quot;200&quot; &gt; /sys/class/backlight/intel_backlight/brightness</div><div><span class="" style="white-space:pre">        </span>echo &quot;000&quot; &gt; /sys/class/backlight/intel_backlight/brightness</div>
<div><span class="" style="white-space:pre">        </span>if [ -f /etc/brightness/brightness ]</div><div><span class="" style="white-space:pre">        </span>then</div><div><span class="" style="white-space:pre">                </span>br_val=`head --lines 1 /etc/brightness/brightness`</div>
<div><span class="" style="white-space:pre">                </span>echo $br_val &gt; /sys/class/backlight/acpi_video0/brightness</div><div><span class="" style="white-space:pre">        </span>fi</div><div>        ;;</div><div>    suspend)</div>
<div><span class="" style="white-space:pre">        </span>echo `cat /sys/class/backlight/acpi_video0/brightness` &gt; /etc/brightness/brightness</div><div><span class="" style="white-space:pre">        </span>;;</div><div>    *)  echo &quot;ERROR: used incorrectly.&quot;</div>
<div>        ;;</div><div>esac</div><div><br></div><div style>What this does is saves the current brightness value and restores it when the laptop is woken up or booted.. For some strange reason &quot;poking&quot; the brightness in the first 3 lines of the awake case statement seems to fix the brightness so that it can be then controlled by acpi_video0 properly.. Others might be able to modify this for other graphic chipsets by looking in the /sys/class/backlight directory and seeing what the graphics chipset that their laptop has uses.</div>
<div style>/</div><div style>Ok one last thing to get this working was I had to put a script in  /lib/systemd/system-sleep called screenfix.sh </div><div style><br></div><div style>It looks like this</div><div style><br></div>
<div style><div>#!/bin/sh</div><div>case $1 in</div><div>    pre)</div><div><span class="" style="white-space:pre">        </span>/etc/brightness/fixbr.sh suspend</div><div>        ;;</div><div>    post)</div><div><span class="" style="white-space:pre">        </span>/etc/brightness/fixbr.sh awake</div>
<div><span class="" style="white-space:pre">        </span>;;</div><div>    *)  echo &quot;ERROR: used incorrectly.&quot;</div><div>        ;;</div><div>esac</div><div><br></div><div style>I also set a link in the /lib/systemd/system-shutdown to screenfix.sh</div>
<div style><br></div><div style>ln -s /lib/systemd/system-sleep/screenfix.sh /lib/systemd/system-shutdown/screenfix.sh</div><div style><br></div><div style>So now when the laptop is shut down or sleeps, it saves it&#39;s current screen brightness :)</div>
<div style><br></div><div style>TAGS FOR GOOGLE: fedora brightness backlight laptop notebook power save.</div><div style><br></div><div style>Hope this will save people a lot of googling. Is this something that could be submitted to the developers as patch?</div>
</div><div style><br></div><div style><br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 15, 2013 at 5:40 AM, Jaroslav Skarvada <span dir="ltr">&lt;<a href="mailto:jskarvad@redhat.com" target="_blank">jskarvad@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
----- Original Message -----<br>
&gt;<br>
&gt;<br>
&gt; I need to run a script that fixes a problem with the backlight on my<br>
&gt; laptop..<br>
&gt;<br>
&gt;<br>
&gt; The script works when I suspend and resume using pm-suspend from the<br>
&gt; command line, but it does not work when I press the power button to<br>
&gt; suspend or when I close the laptop lid..<br>
&gt;<br>
&gt;<br>
&gt; Where are the event scripts for these events handled in the file<br>
&gt; system.. I&#39;ve tried to look for gnome-power-manager scripts and acpi<br>
&gt; scripts, but I can&#39;t seem to find any information.<br>
&gt;<br>
&gt;<br>
<br>
Hi Kevin,<br>
<br>
on F18 the suspend/resume is handled by systemd and pm-utils scripts<br>
are no more called. There was filled bug about it [1], but it was<br>
rejected by systemd folks. Now you can put your scripts to<br>
/usr/lib/systemd/system-sleep/, see<br>
&#39;systemctl help systemd-suspend.service&#39; for more information,<br>
hope this helps<br>
<br>
regards<br>
<br>
Jaroslav<br>
<br>
[1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=904221" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=904221</a><br>
_______________________________________________<br>
power-management mailing list<br>
<a href="mailto:power-management@lists.fedoraproject.org">power-management@lists.fedoraproject.org</a><br>
<a href="https://admin.fedoraproject.org/mailman/listinfo/power-management" target="_blank">https://admin.fedoraproject.org/mailman/listinfo/power-management</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>============================<div>Kevin Daly</div><div>(416) 953-8330</div>
</div>