Re: swsusp + APM in 2.6.6

From: Pavel Machek
Date: Fri May 14 2004 - 19:23:24 EST


Hi!

> Upgrading older IBM ThinkPad from 2.6.1 to 2.6.6.
>
> In 2.6.1, I had ACPI + APM support compiled in, and I disabled ACPI at
> boot (acpi=off). With this setup, I could sleep, shutdown, and use swap
> suspend with "echo 4 > /proc/sleep" (_not_ /proc/acpi/sleep, as there
> was no /proc/acpi). I slept the computer with "apm -[s,S]". I had ACPI
> support because for some reason the computer wouldn't shutdown without
> it, even though I have it disabled at boot. Note that ACPI wouldn't
> properly sleep my computer (display stayed on, even with lid closed),
> which is why I used APM. In any event, 2.6.1 worked _great_ as far as PM
> stuff was concerned.

Well, you actually exploited bug in ACPI /proc handling. Cute.

> In 2.6.6, however, using the same kernel configuration, neither
> /proc/sleep or /proc/acpi/sleep exist! I _do_ have swsusp enabled in the
> kernel, as well as ACPI sleep states (do they do anything if you disable
> ACPI at boot?). ACPI sleep doesn't turn off the screen, so I want to use
> APM. However, I also want swsusp to work. So, I will continue to use
> 2.6.1 until everything pans out.

It works as designed. Perhaps on one sunny day shutdown will support
-z option meaning "do swsusp".
Pavel

Q: My machine doesn't work with ACPI. How can I use swsusp than ?

A: Do reboot() syscall with right parameters. Warning: glibc gets in
its way, so check with strace:

reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, 0xd000fce2)

(Thanks to Peter Osterlund:)

#include <unistd.h>
#include <syscall.h>

#define LINUX_REBOOT_MAGIC1 0xfee1dead
#define LINUX_REBOOT_MAGIC2 672274793
#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2

int main()
{
syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
LINUX_REBOOT_CMD_SW_SUSPEND, 0);
return 0;
}

--
When do you have heart between your knees?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/