Hi,
I am proposing two changes to s2ram-x86.c:
- first, if no "-a" is given, reset acpi_video_flags to 0, which will
  override also the boot options. The reason i want to do this is that
  people (me included) are sometimes confused by first trying
  "s2ram -f -a3", then later trying "s2ram -f" and concluding that
  "-f is enough to get it going". (second hunk).
- second, with the beeping patch arriving, do not reset those settings
  by first reading out acpi_video_flags and ORing the S3_BIOS|S3_MODE
  options with it. (first hunk).

Objections?

Index: s2ram-x86.c
===================================================================
RCS file: /cvsroot/suspend/suspend/s2ram-x86.c,v
retrieving revision 1.5
diff -u -p -r1.5 s2ram-x86.c
--- s2ram-x86.c 17 Jun 2007 20:51:30 -0000      1.5
+++ s2ram-x86.c 17 Jul 2007 20:28:25 -0000
@@ -70,12 +70,20 @@ void identify_machine(void)
 
 static int set_acpi_video_mode(int mode)
 {
-       FILE *f = fopen("/proc/sys/kernel/acpi_video_flags", "w");
+       unsigned long acpi_video_flags;
+       FILE *f = fopen("/proc/sys/kernel/acpi_video_flags", "rw");
        if (!f) {
                printf("/proc/sys/kernel/acpi_video_flags does not exist; you 
need a kernel >=2.6.16.\n");
                return S2RAM_FAIL;
        }
-       fprintf(f, "%d", mode);
+       /* read the old setting from /proc */
+       if (fscanf(f, "%ld", &acpi_video_flags) != 1) {
+               printf("/proc/sys/kernel/acpi_video_flags format is invalid\n");
+               return S2RAM_FAIL;
+       }
+       /* mask out bits 0 and 1 */
+       acpi_video_flags = acpi_video_flags & (~0UL - S3_BIOS - S3_MODE);
+       fprintf(f, "%ld", acpi_video_flags | mode);
        fflush(f);
        fclose(f);
        return S2RAM_OK;
@@ -210,9 +218,7 @@ int s2ram_hacks(void)
 {
        int ret = 0;
 
-       /* 0 means: don't touch what was set on kernel commandline */
-       if (flags & (S3_BIOS | S3_MODE))
-               ret = set_acpi_video_mode(flags & (S3_BIOS | S3_MODE));
+       ret = set_acpi_video_mode(flags & (S3_BIOS | S3_MODE));
 
        if (ret)
                return ret;
-- 
Stefan Seyfried
QA / R&D Team Mobile Devices        |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg  | "Well, surrounding them's out." 

This footer brought to you by insane German lawmakers:
SUSE Linux Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to