aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Seyfried <stefan.seyfried@googlemail.com>2007-07-31 12:32:41 +0000
committerStefan Seyfried <stefan.seyfried@googlemail.com>2007-07-31 12:32:41 +0000
commit9ab3cc8661089af0bb48a400df86b6b17227001b (patch)
treedd3999cc140aabf5929dea047cd7db8300b1265a
parentff0dbb81157324f7161d953dacdddc74af4d0a59 (diff)
downloadsuspend-utils-9ab3cc8661089af0bb48a400df86b6b17227001b.tar.gz
Fix the acpi_video_flags setting.
-rw-r--r--s2ram-x86.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/s2ram-x86.c b/s2ram-x86.c
index e47a969..bb9b9e4 100644
--- a/s2ram-x86.c
+++ b/s2ram-x86.c
@@ -71,7 +71,7 @@ void identify_machine(void)
static int set_acpi_video_mode(int mode)
{
unsigned long acpi_video_flags;
- FILE *f = fopen("/proc/sys/kernel/acpi_video_flags", "rw");
+ FILE *f = fopen("/proc/sys/kernel/acpi_video_flags", "r");
if (!f) {
printf("/proc/sys/kernel/acpi_video_flags does not exist; you need a kernel >=2.6.16.\n");
return S2RAM_FAIL;
@@ -81,6 +81,9 @@ static int set_acpi_video_mode(int mode)
printf("/proc/sys/kernel/acpi_video_flags format is invalid\n");
return S2RAM_FAIL;
}
+ /* rewind() seems not to work on /proc files, so close and reopen it */
+ fclose(f);
+ f = fopen("/proc/sys/kernel/acpi_video_flags", "w");
/* mask out bits 0 and 1 */
acpi_video_flags = acpi_video_flags & (~0UL - S3_BIOS - S3_MODE);
fprintf(f, "%ld", acpi_video_flags | mode);