Hi,

when investigating a suspend problem, i noticed that it is not paticlularly
useful to switch to the console where the kernel messages are redirected to:
After resume, you see nothing of the suspend messages, because everything
is pushed off the screen by the drivers chatting about suspend and resume
and their "new found" devices.

So how about this (i elected vt63 since that is where the in-kernel code
traditionally printed its messages):

 suspend.c |   40 +---------------------------------------
 1 file changed, 1 insertion(+), 39 deletions(-)

Index: suspend.c
===================================================================
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.63
diff -u -r1.63 suspend.c
--- suspend.c   2 Nov 2006 22:05:53 -0000       1.63
+++ suspend.c   6 Nov 2006 16:11:53 -0000
@@ -855,8 +855,6 @@
 #define TIOCL_GETKMSGREDIRECT  17
 #endif
 
-static int set_kmsg_redirect;
-
 /**
  *     prepare_console - find a spare virtual terminal, open it and attach
  *     the standard streams to it.  The number of the currently active
@@ -865,29 +863,17 @@
 
 static int prepare_console(int *orig_vc, int *new_vc)
 {
-       int fd, error, vt = -1;
+       int fd, error, vt = 63;
        char *vt_name = mem_pool;
        struct vt_stat vtstat;
-       char clear_vt, tiocl[2];
 
        fd = console_fd("/dev/console");
        if (fd < 0)
                return fd;
 
-       tiocl[0] = TIOCL_GETKMSGREDIRECT;
-       if (!ioctl(fd, TIOCLINUX, tiocl)) {
-               if (tiocl[0] > 0)
-                       vt = tiocl[0];
-       }
-
-       clear_vt = 0;
        error = ioctl(fd, VT_GETSTATE, &vtstat);
        if (!error) {
                *orig_vc = vtstat.v_active;
-               if (vt < 0) {
-                       clear_vt = 1;
-                       error = ioctl(fd, VT_OPENQRY, &vt);
-               }
        }
 
        close(fd);
@@ -912,28 +898,11 @@
                goto Close_fd;
        }
 
-       if (clear_vt) {
-               char *msg = "\33[H\33[J";
-               write(fd, msg, strlen(msg));
-       }
-
        dup2(fd, 0);
        dup2(fd, 1);
        dup2(fd, 2);
        *new_vc = vt;
 
-       set_kmsg_redirect = !tiocl[0];
-       if (set_kmsg_redirect) {
-               tiocl[0] = TIOCL_SETKMSGREDIRECT;
-               tiocl[1] = vt;
-               if (ioctl(fd, TIOCLINUX, tiocl)) {
-                       fprintf(stderr, "Failed to redirect kernel messages to 
VT %d\n"
-                                       "Reason: %s\n", vt, strerror(errno));
-                       fflush(stderr);
-                       set_kmsg_redirect = 0;
-               }
-       }
-
        return fd;
 Close_fd:
        close(fd);
@@ -960,13 +929,6 @@
                fprintf(stderr, "VT %d activation failed\n", orig_vc);
                fflush(stderr);
        }
-       if (set_kmsg_redirect) {
-               char tiocl[2];
-
-               tiocl[0] = TIOCL_SETKMSGREDIRECT;
-               tiocl[1] = 0;
-               ioctl(fd, TIOCLINUX, tiocl);
-       }
 Close_fd:
        close(fd);
 }
-- 
Stefan Seyfried
QA / R&D Team Mobile Devices        |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg  | "Well, surrounding them's out." 

-------------------------------------------------------------------------
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

Reply via email to