Re: Turning off automatic screen clanking

From: Erik Andersen (andersen@codepoet.org)
Date: Wed Jul 30 2003 - 01:14:55 EST


Here ya go... This rips out the screen blanking code by the
roots since the kind and gentle approach didn't seem to be what
you were looking for. :-)

--- linux/drivers/char/console.c.orig
+++ linux/drivers/char/console.c
@@ -144,7 +144,6 @@
 static int con_open(struct tty_struct *, struct file *);
 static void vc_init(unsigned int console, unsigned int rows,
                     unsigned int cols, int do_clear);
-static void blank_screen(unsigned long dummy);
 static void gotoxy(int currcons, int new_x, int new_y);
 static void save_cur(int currcons);
 static void reset_terminal(int currcons, int do_clear);
@@ -152,7 +151,6 @@
 static void set_vesa_blanking(unsigned long arg);
 static void set_cursor(int currcons);
 static void hide_cursor(int currcons);
-static void unblank_screen_t(unsigned long dummy);
 static void console_callback(void *ignored);
 
 static int printable; /* Is console ready for printing? */
@@ -205,8 +203,6 @@
  */
 int (*console_blank_hook)(int);
 
-static struct timer_list console_timer;
-
 /*
  * Low-Level Functions
  */
@@ -2488,12 +2484,6 @@
         if (tty_register_driver(&console_driver))
                 panic("Couldn't register console driver\n");
 
- init_timer(&console_timer);
- console_timer.function = blank_screen;
- if (blankinterval) {
- mod_timer(&console_timer, jiffies + blankinterval);
- }
-
         /*
          * kmalloc is not running yet - we use the bootmem allocator.
          */
@@ -2629,39 +2619,6 @@
                                     console_driver.minor_start + i);
 }
 
-/*
- * This is called by a timer handler
- */
-static void vesa_powerdown(void)
-{
- struct vc_data *c = vc_cons[fg_console].d;
- /*
- * Power down if currently suspended (1 or 2),
- * suspend if currently blanked (0),
- * else do nothing (i.e. already powered down (3)).
- * Called only if powerdown features are allowed.
- */
- switch (vesa_blank_mode) {
- case VESA_NO_BLANKING:
- c->vc_sw->con_blank(c, VESA_VSYNC_SUSPEND+1);
- break;
- case VESA_VSYNC_SUSPEND:
- case VESA_HSYNC_SUSPEND:
- c->vc_sw->con_blank(c, VESA_POWERDOWN+1);
- break;
- }
-}
-
-/*
- * This is a timer handler
- */
-static void vesa_powerdown_screen(unsigned long dummy)
-{
- console_timer.function = unblank_screen_t;
-
- vesa_powerdown();
-}
-
 static void timer_do_blank_screen(int entering_gfx, int from_timer_handler)
 {
         int currcons = fg_console;
@@ -2687,17 +2644,6 @@
         }
 
         hide_cursor(currcons);
- if (!from_timer_handler)
- del_timer_sync(&console_timer);
- if (vesa_off_interval) {
- console_timer.function = vesa_powerdown_screen;
- mod_timer(&console_timer, jiffies + vesa_off_interval);
- } else {
- if (!from_timer_handler)
- del_timer_sync(&console_timer);
- console_timer.function = unblank_screen_t;
- }
-
         save_screen(currcons);
         /* In case we need to reset origin, blanking hook returns 1 */
         i = sw->con_blank(vc_cons[currcons].d, 1);
@@ -2717,14 +2663,6 @@
 }
 
 /*
- * This is a timer handler
- */
-static void unblank_screen_t(unsigned long dummy)
-{
- unblank_screen();
-}
-
-/*
  * Called by timer as well as from vt_console_driver
  */
 void unblank_screen(void)
@@ -2742,11 +2680,6 @@
         if (vcmode != KD_TEXT)
                 return; /* but leave console_blanked != 0 */
 
- console_timer.function = blank_screen;
- if (blankinterval) {
- mod_timer(&console_timer, jiffies + blankinterval);
- }
-
         console_blanked = 0;
         if (console_blank_hook)
                 console_blank_hook(0);
@@ -2757,25 +2690,10 @@
         set_cursor(fg_console);
 }
 
-/*
- * This is both a user-level callable and a timer handler
- */
-static void blank_screen(unsigned long dummy)
-{
- timer_do_blank_screen(0, 1);
-}
-
 void poke_blanked_console(void)
 {
- del_timer(&console_timer);
         if (!vt_cons[fg_console] || vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
                 return;
- if (console_blanked) {
- console_timer.function = unblank_screen_t;
- mod_timer(&console_timer, jiffies); /* Now */
- } else if (blankinterval) {
- mod_timer(&console_timer, jiffies + blankinterval);
- }
 }
 
 /*
@@ -3001,7 +2919,7 @@
                 unblank_screen();
                 break;
         case PM_SUSPEND:
- do_blank_screen(0);
+ unblank_screen();
                 break;
         }
         return 0;

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jul 31 2003 - 22:00:44 EST