Hi, while working on https://bugzilla.novell.com/show_bug.cgi?id=293662 and https://bugzilla.novell.com/show_bug.cgi?id=281798 it occured to me that including Ubuntu's hack in s2ram might be a good idea. It should do no harm - they are apparently doing it unconditionally on all machines. This could get some machines out of the NOFB requirement - at least the ACER mentioned in the above bugreport seems to work with framebuffers and this hack. I doubt it will help on some of the HP's with ATI, but i'd need to test that again.
The hack (as the bugreporter made the "minimal testcase") is basically: #!/bin/bash CONSOLE=`fgconsole` chvt 12 for x in /sys/class/graphics/*; do if [ -f $x/state ]; then echo -n 1 >$x/state; fi done echo -n mem >/sys/power/state vbetool post for x in /sys/class/graphics/*; do if [ -f $x/state ]; then echo -n 0 >$x/state; fi done chvt $CONSOLE I have coded this into C in the following patch: Index: s2ram-x86.c =================================================================== RCS file: /cvsroot/suspend/suspend/s2ram-x86.c,v retrieving revision 1.6 diff -u -p -r1.6 s2ram-x86.c --- s2ram-x86.c 19 Jul 2007 13:28:47 -0000 1.6 +++ s2ram-x86.c 27 Jul 2007 11:35:53 -0000 @@ -10,6 +10,9 @@ #include <stdlib.h> #include <errno.h> #include <string.h> +#include <sys/types.h> +#include <dirent.h> +#include <unistd.h> #include <pci/pci.h> @@ -124,6 +127,42 @@ static int machine_match(void) return -1; } +static void fbcon_state(int state) +{ + DIR *d; + FILE *f; + struct dirent *entry; + char statefile[255]; + + if ((d = opendir("/sys/class/graphics")) == NULL) + return; + while ((entry = readdir(d)) != NULL) { + if (entry->d_name[0] == '.') + continue; + snprintf(statefile, 255, "/sys/class/graphics/%s/state", entry->d_name); + if (!access(statefile, W_OK)) { + printf("fbcon %s state %d\n", entry->d_name, state); + f = fopen(statefile, "w"); + if (!f) { + printf("s2ram: cannot write to %s\n", statefile); + continue; + } + fprintf(f, "%d", state); + fclose(f); + } + } +} + +static void suspend_fbcon(void) +{ + fbcon_state(1); +} + +static void resume_fbcon(void) +{ + fbcon_state(0); +} + int s2ram_check(int id) { int ret = S2RAM_OK; @@ -252,6 +291,7 @@ int s2ram_hacks(void) return 1; } + suspend_fbcon(); return 0; } @@ -304,6 +344,7 @@ void s2ram_resume(void) printf("Calling set_vbe_mode\n"); do_set_mode(vbe_mode, 0); } + resume_fbcon(); if (flags & RADEON_OFF) { printf("Calling radeon_cmd_light(1)\n"); radeon_cmd_light(1); Objections? Does anybody know what i am doing here :-) ? (yes, i think i know what it does; writing 1 into the state of the framebuffer device just disables any drawing - and thus any access of possibly not really initialized hardware before running vbe_post etc...) At least it seemed to do no harm in my (limited) tests. -- 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: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel