On my amd64 laptop, s2ram works when using a 32-bit kernel, but not with a 64-bit one. To handle this, I've implemented support for differentiating between the two situations in the whitelist.
This applies on top of my previous patch adding the HP zv5000 to the s2ram whitelist. Jason --- s2ram.c | 23 +++++++++++++++++++++-- whitelist.c | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) Index: suspend-0.2/s2ram.c =================================================================== --- suspend-0.2.orig/s2ram.c +++ suspend-0.2/s2ram.c @@ -10,6 +10,7 @@ #include <getopt.h> #include <errno.h> #include <string.h> +#include <sys/utsname.h> #define S2RAM #include "vbetool/vbetool.h" @@ -24,6 +25,7 @@ /* return codes for s2ram_prepare */ #define S2RAM_OK 0 #define S2RAM_FAIL 1 +#define S2RAM_NO64 125 #define S2RAM_NOFB 126 #define S2RAM_UNKNOWN 127 @@ -35,6 +37,7 @@ #define RADEON_OFF 0x10 /* machine needs "radeontool light off" */ #define UNSURE 0x20 /* unverified entries from acpi-support 0.59 */ #define NOFB 0x40 /* must not use a frame buffer */ +#define NO64 0x80 /* doesn't work on 64-bit kernels */ #include "whitelist.c" @@ -66,13 +69,14 @@ " bios_version = '%s'\n", i, whitelist[i].sys_vendor, whitelist[i].sys_product, whitelist[i].sys_version, whitelist[i].bios_version); - printf("Fixes: 0x%x %s%s%s%s%s%s\n", flags, + printf("Fixes: 0x%x %s%s%s%s%s%s%s\n", flags, (flags & VBE_SAVE) ? "VBE_SAVE " : "", (flags & VBE_POST) ? "VBE_POST " : "", (flags & RADEON_OFF) ? "RADEON_OFF " : "", (flags & S3_BIOS) ? "S3_BIOS " : "", (flags & S3_MODE) ? "S3_MODE " : "", - (flags & NOFB) ? "NOFB " : ""); + (flags & NOFB) ? "NOFB " : "", + (flags & NO64) ? "NO64 " : ""); if (flags & UNSURE) printf("Machine is in the whitelist but perhaps using " "vbetool unnecessarily.\n" @@ -126,6 +130,16 @@ return -1; } +static int is_kernel_64bit(void) +{ + struct utsname uts; + if(uname(&uts)) { + perror("uname"); + return 0; + } + return strstr(uts.machine, "64") != NULL; +} + int s2ram_check(int id) { int ret = S2RAM_OK; @@ -136,6 +150,8 @@ flags = whitelist[id].flags; if ((flags & NOFB) && is_framebuffer()) ret = S2RAM_NOFB; + if ((flags & NO64) && is_kernel_64bit()) + ret = S2RAM_NO64; } return ret; @@ -325,6 +341,9 @@ if (ret == S2RAM_NOFB) printf("This machine can only suspend without framebuffer.\n"); + if (ret == S2RAM_NO64) + printf("This machine can't suspend to ram when running a 64-bit kernel.\n"); + if (test_mode) { machine_known(id); goto out; Index: suspend-0.2/whitelist.c =================================================================== --- suspend-0.2.orig/whitelist.c +++ suspend-0.2/whitelist.c @@ -57,7 +57,7 @@ /* The full match is: * { "Hewlett-Packard ", "Pavilion zv5000 (DP523AV) ", "F.35", "F.35", VBE_POST|NOFB }, * but I don't see any reason to match that tightly. - Jason Lunz */ - { "Hewlett-Packard*", "Pavilion zv5000 *", "", "", VBE_POST|NOFB }, + { "Hewlett-Packard*", "Pavilion zv5000 *", "", "", VBE_POST|NOFB|NO64 }, { "Hewlett-Packard", "Presario R4100 *", "", "", S3_BIOS|S3_MODE }, /* R51 and T43 confirmed by Christian Zoz */ { "IBM", "1829*", "ThinkPad R51", "", 0 }, Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel