[ltp] Re: Emulate APM's resume.d folder with ACPI
Daniel Déchelotte
linux-thinkpad@linux-thinkpad.org
Sat, 15 Apr 2006 16:56:58 +0200
This is a multi-part message in MIME format.
--Multipart=_Sat__15_Apr_2006_16_56_58_+0200_ZZWG8N4bg.KoyYJ+
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
(Replying to my own message, sent 2 days ago via gmane...)
Daniel Déchelotte a écrit :
> [...]
> Quite a few packages installed APM scripts (chrony, laptop-mode,
> apmiser, anacron, ifplugd, alsa, hwclock). Maybe some scripts are no
> longer needed with ACPI? (cleaner suspend/resume??)
> [...]
> How can be emulated APM's resume.d folder? What event must be handled?
> In /etc/acpi/events/resume:
>
> event=???
> action=run-parts /etc/acpi/resume.d/
[ 2 days passed ]
Not quite, because AFAIU, it is ACPI's philosophy that suspend happens
transparently in the middle of a userspace script, which also handles
resuming. So I configured Fn-F4 and the lid closure to run
/etc/acpi/actions/suspend_and_resume.sh, which I enclose with this mail.
Is it the ACPI way, or am I just wrongly struggling to reproduce the
APM way with ACPI?
--
Daniel Déchelotte
http://yo.dan.free.fr/
--Multipart=_Sat__15_Apr_2006_16_56_58_+0200_ZZWG8N4bg.KoyYJ+
Content-Type: text/x-sh;
name="suspend_and_resume.sh"
Content-Disposition: attachment;
filename="suspend_and_resume.sh"
Content-Transfer-Encoding: 7bit
#! /bin/sh
# /etc/acpi/actions/suspend_and_resume.sh
#
run-parts --arg suspend --arg user /etc/apm/suspend.d
# Taken from test_acpi_drain.sh. Why is such a thing needed?
# remove USB for external mouse before sleeping
if lsmod | grep '^usbhid' >/dev/null ; then
/sbin/modprobe -r -s usbhid
fi
if lsmod | grep '^uhci_hcd' >/dev/null ; then
/sbin/modprobe -r -s uhci_hcd
fi
if lsmod | grep '^ehci_hcd' >/dev/null ; then
/sbin/modprobe -r -s ehci_hcd
fi
###
echo mem > /sys/power/state
###
# restore USB support
if !(lsmod | grep '^ehci_hcd') >/dev/null ; then
/sbin/modprobe -s ehci_hcd
fi
if !(lsmod | grep '^uhci_hcd') >/dev/null ; then
/sbin/modprobe -s uhci_hcd
fi
if !(lsmod | grep '^usbhid') >/dev/null ; then
/sbin/modprobe -s usbhid
fi
#
run-parts --arg resume --arg suspend /etc/apm/resume.d
--Multipart=_Sat__15_Apr_2006_16_56_58_+0200_ZZWG8N4bg.KoyYJ+--