Hi,
I dug this out again after updating the vbetool code.
This hack does the equivalent of
X=`vbetool vbemode get`
<suspend>
<maybe vbetool post>
vbetool vbemode set $X
This actually works fine on many intel chips (i810/i855gm, e.g. compaq
nx5000) which are now listed as "VBE_POST|VBE_SAVE" and should be less
intrusive than VBE_SAVE. It was also recommended to me by my local VESA
BIOS (and BIOS in general :-) guru Steffen Winterfeldt ad the method of
choice (he almost passed out when i mentioned VBE_SAVE and that it
actually works - although VBE_SAVE was suggested as "The Right Thing" to
Matthew by intel :-).
There seems to be no _real_ need for this, the machines that work fine
with VBE_MODE also seem to work fine with VBE_SAVE (although i have one
particular nasty acer tablet i'd have to test this one on), but it
a) "feels" better to me
b) the HAL / pm-utils guys have a similar method in their repertoire, and
i'd like to have "s2ram $SOME_ADVANCED_OPTIONS_DETERMINED_BY_HAL" as an
drop-in-replacement to this stuff, so i need this.
I actually included the nx5000 whitelist change, to show a potential usage
of this flag.
Index: s2ram.c
===================================================================
RCS file: /cvsroot/suspend/suspend/s2ram.c,v
retrieving revision 1.43
diff -u -p -r1.43 s2ram.c
--- s2ram.c 2 May 2006 11:31:21 -0000 1.43
+++ s2ram.c 19 Jul 2006 09:13:23 -0000
@@ -18,7 +18,7 @@
static void *vbe_buffer;
/* Flags set from whitelist */
-static int flags;
+static int flags, vbe_mode = -1;
char bios_version[1024], sys_vendor[1024], sys_product[1024],
sys_version[1024];
/* return codes for s2ram_prepare */
@@ -31,10 +31,11 @@ char bios_version[1024], sys_vendor[1024
#define S3_BIOS 0x01 /* machine needs acpi_sleep=s3_bios */
#define S3_MODE 0x02 /* machine needs acpi_sleep=s3_mode */
#define VBE_SAVE 0x04 /* machine needs "vbetool save / restore" */
-#define VBE_POST 0x08 /* machine does not need / may not use "vbetool
post" */
+#define VBE_POST 0x08 /* machine needs "vbetool post" */
#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 VBE_MODE 0x80 /* machine needs "vbetool vbemode get / set" */
#include "whitelist.c"
@@ -66,9 +67,10 @@ void machine_known(int i)
" 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 & VBE_MODE) ? "VBE_MODE " : "",
(flags & RADEON_OFF) ? "RADEON_OFF " : "",
(flags & S3_BIOS) ? "S3_BIOS " : "",
(flags & S3_MODE) ? "S3_MODE " : "",
@@ -159,6 +161,11 @@ int s2ram_hacks(void)
printf("Calling save_state\n");
vbe_buffer = __save_state(&size);
}
+ if (flags & VBE_MODE) {
+ vbetool_init();
+ printf("Calling get_mode\n");
+ vbe_mode = __get_mode();
+ }
if (flags & RADEON_OFF) {
map_radeon_cntl_mem();
printf("Calling radeon_cmd_light(0)\n");
@@ -220,7 +227,11 @@ void s2ram_resume(void)
printf("Calling restore_state_from\n");
restore_state_from(vbe_buffer);
}
-
+ if (vbe_mode >= 0) {
+ vbetool_init();
+ printf("Calling set_vbe_mode\n");
+ set_vbe_mode(vbe_mode);
+ }
if (flags & RADEON_OFF) {
printf("Calling radeon_cmd_light(1)\n");
radeon_cmd_light(1);
@@ -243,6 +254,7 @@ static void usage(void)
" -s, --vbe_save: save VBE state before suspending and "
"restore after resume.\n"
" -p, --vbe_post: VBE POST the graphics card after resume\n"
+ " -m, --vbe_mode: get VBE mode before suspend and set it
after resume\n"
" -r, --radeontool: turn off the backlight on radeons "
"before suspending.\n"
" -a, --acpi_sleep: set the acpi_sleep parameter before "
@@ -262,13 +274,14 @@ int main(int argc, char *argv[])
{ "force", no_argument, NULL, 'f'},
{ "vbe_save", no_argument, NULL, 's'},
{ "vbe_post", no_argument, NULL, 'p'},
+ { "vbe_mode", no_argument, NULL, 'm'},
{ "radeontool", no_argument, NULL, 'r'},
{ "identify", no_argument, NULL, 'i'},
{ "acpi_sleep", required_argument, NULL, 'a'},
{ NULL, 0, NULL, 0 }
};
- while ((i = getopt_long(argc, argv, "nhfspria:", options, NULL)) != -1)
{
+ while ((i = getopt_long(argc, argv, "nhfspmria:", options, NULL)) !=
-1) {
switch (i) {
case 'h':
usage();
@@ -289,6 +302,9 @@ int main(int argc, char *argv[])
case 'p':
flags |= VBE_POST;
break;
+ case 'm':
+ flags |= VBE_MODE;
+ break;
case 'r':
flags |= RADEON_OFF;
break;
Index: whitelist.c
===================================================================
RCS file: /cvsroot/suspend/suspend/whitelist.c,v
retrieving revision 1.41
diff -u -p -r1.41 whitelist.c
--- whitelist.c 13 Jul 2006 05:20:19 -0000 1.41
+++ whitelist.c 19 Jul 2006 09:13:23 -0000
@@ -55,8 +55,8 @@ struct machine_entry whitelist[] = {
{ "FUJITSU SIEMENS", "Stylistic ST5000", "", "",
S3_BIOS|S3_MODE },
/* This is a desktop with onboard i810 video */
{ "FUJITSU SIEMENS", "SCENIC W300/W600", "", "",
VBE_POST|VBE_SAVE },
- { "Hewlett-Packard ", "Compaq nx5000 *", "",
"68BCU*", VBE_POST|VBE_SAVE },
- { "Hewlett-Packard*", "hp compaq nx5000 *", "",
"68BCU*", VBE_POST|VBE_SAVE },
+ { "Hewlett-Packard ", "Compaq nx5000 *", "",
"68BCU*", VBE_POST|VBE_MODE },
+ { "Hewlett-Packard*", "hp compaq nx5000 *", "",
"68BCU*", VBE_POST|VBE_MODE },
{ "Hewlett-Packard", "HP Compaq nc6000 *", "",
"68BDD*", S3_BIOS|S3_MODE },
{ "Hewlett-Packard", "HP Compaq nx6125 *", "", "",
VBE_SAVE|NOFB },
{ "Hewlett-Packard", "HP Compaq nc6230 *", "", "",
VBE_SAVE|NOFB },
Index: vbetool/vbetool.c
===================================================================
RCS file: /cvsroot/suspend/suspend/vbetool/vbetool.c,v
retrieving revision 1.6
diff -u -p -r1.6 vbetool.c
--- vbetool/vbetool.c 19 Jul 2006 08:51:04 -0000 1.6
+++ vbetool/vbetool.c 19 Jul 2006 09:13:23 -0000
@@ -379,6 +379,11 @@ int do_set_mode (int mode, int vga) {
return 0;
}
+void set_vbe_mode(int mode)
+{
+ (void)do_set_mode(mode, 0);
+}
+
int do_get_panel_brightness() {
reg_frame regs;
int error;
@@ -441,12 +446,18 @@ int do_set_panel_brightness(int brightne
return 0;
}
-int do_get_mode() {
+int __get_mode()
+{
reg_frame regs;
int error;
memset(®s, 0, sizeof(regs));
error = do_vbe_service(0x4f03, 0, ®s);
+ return error;
+}
+
+int do_get_mode() {
+ int error = __get_mode();
if (error<0) {
return error;
Index: vbetool/vbetool.h
===================================================================
RCS file: /cvsroot/suspend/suspend/vbetool/vbetool.h,v
retrieving revision 1.3
diff -u -p -r1.3 vbetool.h
--- vbetool/vbetool.h 19 Jul 2006 07:38:07 -0000 1.3
+++ vbetool/vbetool.h 19 Jul 2006 09:13:23 -0000
@@ -19,3 +19,5 @@ int do_get_panel_id();
void vbetool_init(void);
char *__save_state(int *);
void restore_state_from(char *);
+int __get_mode(void);
+void set_vbe_mode(int);
--
Stefan Seyfried | "Please, just tell people
QA / R&D Team Mobile Devices | to use KDE."
SUSE LINUX Products GmbH, Nürnberg | -- Linus Torvalds
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/suspend-devel