Thank you for the information.

I've put some scripts in each of the directories that really make the laptop work well so far ;)

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.

#!/bin/sh
# 00-powermodes
case $1 in
    true)
tuned-adm profile laptop-battery-powersave
        ;;
    false)
tuned-adm profile balanced
;;
    *)  echo "ERROR: used incorrectly."
        ;;
esac

the file should name should start with 00 to 20 so I called my file 00-powermodes

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.

In order to fix this I put this script in /etc/brightness/fixbr.sh

#!/bin/sh
case $1 in
    awake)
echo "000" > /sys/class/backlight/intel_backlight/brightness
echo "200" > /sys/class/backlight/intel_backlight/brightness
echo "000" > /sys/class/backlight/intel_backlight/brightness
if [ -f /etc/brightness/brightness ]
then
br_val=`head --lines 1 /etc/brightness/brightness`
echo $br_val > /sys/class/backlight/acpi_video0/brightness
fi
        ;;
    suspend)
echo `cat /sys/class/backlight/acpi_video0/brightness` > /etc/brightness/brightness
;;
    *)  echo "ERROR: used incorrectly."
        ;;
esac

What this does is saves the current brightness value and restores it when the laptop is woken up or booted.. For some strange reason "poking" 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.
/
Ok one last thing to get this working was I had to put a script in  /lib/systemd/system-sleep called screenfix.sh 

It looks like this

#!/bin/sh
case $1 in
    pre)
/etc/brightness/fixbr.sh suspend
        ;;
    post)
/etc/brightness/fixbr.sh awake
;;
    *)  echo "ERROR: used incorrectly."
        ;;
esac

I also set a link in the /lib/systemd/system-shutdown to screenfix.sh

ln -s /lib/systemd/system-sleep/screenfix.sh /lib/systemd/system-shutdown/screenfix.sh

So now when the laptop is shut down or sleeps, it saves it's current screen brightness :)

TAGS FOR GOOGLE: fedora brightness backlight laptop notebook power save.

Hope this will save people a lot of googling. Is this something that could be submitted to the developers as patch?





On Fri, Mar 15, 2013 at 5:40 AM, Jaroslav Skarvada <jskarvad@redhat.com> wrote:


----- Original Message -----
>
>
> I need to run a script that fixes a problem with the backlight on my
> laptop..
>
>
> The script works when I suspend and resume using pm-suspend from the
> command line, but it does not work when I press the power button to
> suspend or when I close the laptop lid..
>
>
> Where are the event scripts for these events handled in the file
> system.. I've tried to look for gnome-power-manager scripts and acpi
> scripts, but I can't seem to find any information.
>
>

Hi Kevin,

on F18 the suspend/resume is handled by systemd and pm-utils scripts
are no more called. There was filled bug about it [1], but it was
rejected by systemd folks. Now you can put your scripts to
/usr/lib/systemd/system-sleep/, see
'systemctl help systemd-suspend.service' for more information,
hope this helps

regards

Jaroslav

[1] https://bugzilla.redhat.com/show_bug.cgi?id=904221
_______________________________________________
power-management mailing list
power-management@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/power-management



--
============================
Kevin Daly
(416) 953-8330