Turning off automatic screen clanking
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. :-)
drivers/char/console.c renamed from drivers/char/console.c.orig +1 -83
@@ -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--
Quoted 4 lines · Erik Andersen
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. :-)
Come on...
That's not necessary! I'm looking for either making it default to "no blanking" so startup scripts need to enable this feature, or an ioctl to turn it off.
The 'kindest and gentlist' approach was to simply set the timer variable "blankinterval" (line 165 in console.c) to 0 instead of 10*60*HZ. This doesn't work. The screen still blanks in 10 minutes.
The next approach was to make an ioctl function. I was supplied with 1/2 what was necessary and, if I add the rest (a trivial call), it will work, however that extra code may probably be rejected as 'bloat'.
What I'm working on now, when I can get the time, is trying to find out how come initialization to zero doesn't work and making it work. Once this is done, there should not be any technical reasons why it can't be included in the standard kernel.
The current enabling of the blanker by default is clearly policy and it has been well established that policy decisions should be outside the kernel.
[SNIPPED (neat) patch...]
Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.
Quoted 3 lines · Richard B. Johnson
The 'kindest and gentlist' approach was to simply set the timer variable "blankinterval" (line 165 in
console.c) to 0 instead of 10*60*HZ. This doesn't work. The screen still blanks in 10 minutes.
console.c line 2491 (function con_init:)
init_timer(&console_timer);
console_timer.function = blank_screen;
if (blankinterval) {
mod_timer(&console_timer, jiffies + blankinterval);
}So the trick appears to be to not initialize console_timer. Then, on line 1283 (function setterm_command:)
case 9: /* set blanking interval */ blankinterval = ((par[1] < 60) ? par[1] : 60) * 60 * HZ; poke_blanked_console(); break;
Do some "magic" to initialize console_timer if it is not.
I think blanking by default is bad. Many times it bite me in the past. Same old history: only monitor, no keyboard, couldn't see what's going on until I plugged a keyboard (which of course, was in another room.)
BTW:
Quoted 6 lines · Zwane Mwaikambo
Quoted 3 lines · Richard B. Johnson
If the machine had blanking disabled by default, then the usual SYS-V startup scripts could execute setterm to enable it IFF it was wanted.
optimise for the common case, just fix your box and be done with it.
*IF* Linux primary target is the server market then, what kind of optimization in console blanking if you need to hack your init script and insert "setterm -blank 0" somewhere??
Regards,
Norberto
Quoted 11 lines · Norberto BENSA
Quoted 6 lines · Zwane Mwaikambo
Quoted 3 lines · Richard B. Johnson
If the machine had blanking disabled by default, then the usual SYS-V startup scripts could execute setterm to enable it IFF it was wanted.
optimise for the common case, just fix your box and be done with it.
*IF* Linux primary target is the server market then, what kind of optimization in console blanking if you need to hack your init script and insert "setterm -blank 0" somewhere??
oh lord, you make it sound like a lot of work.
<insert reply about 'working out of the box'>
You're convincing the wrong person, it's not a difficult problem just send a patch already instead of slinging arguments for and against back and forth.
Signature · 1 line
function.linuxpower.ca