Differences between revisions 7 and 12 (spanning 5 versions)
Revision 7 as of 2005-10-25 13:36:04
Size: 4967
Editor: MartinWilck
Comment:
Revision 12 as of 2009-03-16 03:33:18
Size: 1553
Editor: anonymous
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
Most of this works out-of-the-box. [http://faq.pathfinderteam.org/index.php/Samsung_X20 this page on the Samsung X20 (in German)] has many good hints. (!) <<Date(2007-10-28T15:50:24Z)>> updated this page because stuff has become a lot easier with etch final release. (!)

Most of this works out-of-the-box. [[http://faq.pathfinderteam.org/index.php/Samsung_X20|this page on the Samsung X20 (in German)]] has many good hints, too. 0% bightness, i.e. dark. It can be reactivated with the Kbd brightness keys.

Suspend-to-RAM works with the ati and fglrx VGA drivers. With fglrx, the display after resume is at
Line 7: Line 11:
== Emergency power off == You can control almost all relevant power-saving features through the excellent ''laptop-mode-tools'' package. {{{/etc/laptop-mode/laptop-mode.conf}}}. With {{{cryptsetup}}}, even suspend-on-encyrpted-swap is working nicely. I use the laptop-mode-tools option {{{ASSUME_SCSI_IS_SATA=1}}} for my hard drive, and it appears to work.
Line 9: Line 13:
React to "battery low" events by shutting down gracefully or suspending. Works with {{{acpid}}}. Action must be written by hand on Debian. Here is mine: == ACPI buttons (power, sleep, lid) ==
Line 11: Line 15:
~-{{{
#! /bin/sh
# /etc/acpid/actions/mw_battery.sh
Both the power and sleep buttons work as expected (you can control their actions through {{{/etc/default/acpi-support}}}).
Line 15: Line 17:
# Don't forget to define an event in /etc/acpi/events that calls
# /etc/acpi/actions/mw_battery.sh %e on battery events

export LC_ALL=C

# dont bother if shutdown is already running
[ -f /var/run/shutdown.pid ] && exit 0

minutes=$(/usr/local/bin/minutes_to_go $2)
[ -z "$minutes" ] && exit 0 # charging or full

if [ $minutes -le 3 ]; then
   /sbin/shutdown -h now "battery running low ($minutes minutes)"
fi

}}}

The {{{minutes_to_go}}} command is here:
{{{
#! /bin/sh
# /usr/local/bin/minutes_to_go BATTERY

BAT=$1
[ -r /proc/acpi/battery/$BAT/state ] || exit 2

awk '
/^charging state:/ { if ($3 !~ /^discharging/) { r=0; exit (0); }}
/^present rate:/ {r=$3}
/^remaining capacity/ {c=$3}
END { if (r) print int(60*c/r); }
' /proc/acpi/battery/$BAT/state
}}}
-~
Instead of poweroff, one could as well do a suspend-to-disk (see below).

Likewise, it should be possible to react to "critical temperature" events. Should be possible with {{{acpid}}} on the X50, too. Not tested (I didn't reach critical temperatures:-).


== ACPI sleep states and software suspend ==

This requires a kernel recompilation. Make the following selections in the kernel configuration:
~-{{{
 -> Power management options (ACPI, APM)
   [*] Software Suspend [EXPERIMENTAL]
   -> ACPI (Advanced Configuration and Power Interface) Support
     -> ACPI Support
     [*] ACPI Sleep States [EXPERIMENTAL]
 }}}-~

Suspend-to-disk ({{{echo disk >/sys/power/state}}}) works fine on the X50 as long as the proprietary ATI graphics driver isn't used.

Suspend-to-RAM didn't work for me yet.


== Power saving ==

'''CPU frequency adjustment''' works very well. There is a large number of tools available ([http://www.gentoo.de/doc/de/power-management-guide.xml see here for a comparison]). My personal favorite under Debian are the light-weight {{{cpufrequtils}}}. They rely mostly on the kernel {{{cpufreq}}} driver to do the adjustments. I am using the {{{ondemand}}} governor under normal conditions and the {{{powersave}}} governor when I really want to save battery.
I put the following into {{{/etc/modules}}} to enable power control:
~-{{{
freq_table
speedstep_centrino
cpufreq_ondemand
cpufreq_powersave
}}}-~
{{{cpufrequtils}}} must be enabled by editing {{{/etc/default/cpufrequtils}}}. I call {{{cpufreq-set}}} upon {{{acpid}}} AC adapter events and etiquette mode keys (see ../InputDevices).

There are also power saving modes for other components besides the CPU. Onfortunately, the {{{hdparm}}} commands to put the disk to sleep don't work with SATA disks underr libata (yet), so the {{{laptop-mode-tools}}} package is currently mostly useless.

== Power button and sleep button ==

The default {{{acpid}}} setup in Etch has a script for the '''power button''' that
 1. If a user is logged in under KDE, logs him out;
 1. Otherwise, initiates a graceful shutdown.
Thus, the power button needs to be pressed twice if someone is logged on under KDE.
All of this works out of the box on the X50.

The '''sleep button''' is detected on the X50 but there is no default action. Here is mine:
~-{{{
#! /bin/sh
# /etc/acpi/actions/mw_sleep.sh
# Create an acpi event that calls this script!

# The resume partition
RESUME=8:10

export LC_ALL=C

# Security: be sure that no console is directly accessible after wake-up
kill_console_sessions() {
        wall <<EOF
 *** SLEEP BUTTON PRESSED ***
EOF
        sleep 2
        [ -n "$(dcop --all-users --list-sessions)" ] && {
                dcop --all-users kdesktop KScreensaverIface lock
        }
        ps -eo tty,comm,pid | \
                awk '/tty[0-9]* *login /{print $3}' | \
                xargs -r kill -TERM
}

### CAREFUL! Does this also work with fglrx (ATI proprietary X driver)??
grep -q fglrx /proc/modules && exit 0

## set resume partition
grep -q $RESUME /sys/power/resume || echo $RESUME >/sys/power/resume

kill_console_sessions

chvt 1 # change to text terminal to avoid problems with X
[ -w /sys/power/state ] && {
        /sbin/hwclock --systohc
        echo disk >/sys/power/state
        /sbin/hwclock --hctosys
}
chvt 7 # change back to the console you want activated after wake-up (X Windows)
}}}-~
The LID button behaves a bit weirdly though. After boot it always shows "state: closed". When I actually close the lid, keep it closed for about 20s, and reopen it, the state switches to "open". After that, the switch works, but there seems to be a 15s delay between the time I close the lid and the related ACPI event. There is no delay when the lid is opened. This is probably a BIOS issue.

Power Management and ACPI

(!) 2007-10-28 updated this page because stuff has become a lot easier with etch final release. (!)

Most of this works out-of-the-box. this page on the Samsung X20 (in German) has many good hints, too. 0% bightness, i.e. dark. It can be reactivated with the Kbd brightness keys.

Suspend-to-RAM works with the ati and fglrx VGA drivers. With fglrx, the display after resume is at

The battery lifetime numbers Samsung publishes (6h) are marketing exaggerations. The normal battery in my notebook lasts about 2h when I'm working normally.

You can control almost all relevant power-saving features through the excellent laptop-mode-tools package. /etc/laptop-mode/laptop-mode.conf. With cryptsetup, even suspend-on-encyrpted-swap is working nicely. I use the laptop-mode-tools option ASSUME_SCSI_IS_SATA=1 for my hard drive, and it appears to work.

ACPI buttons (power, sleep, lid)

Both the power and sleep buttons work as expected (you can control their actions through /etc/default/acpi-support).

The LID button behaves a bit weirdly though. After boot it always shows "state: closed". When I actually close the lid, keep it closed for about 20s, and reopen it, the state switches to "open". After that, the switch works, but there seems to be a 15s delay between the time I close the lid and the related ACPI event. There is no delay when the lid is opened. This is probably a BIOS issue.