console: make blank timeout value a boot option

The console blank timer is currently hardcoded to 10*60 seconds which
might be annoying on systems with no input devices attached to wake up the
console again.  Especially during development, disabling the screen saver
can be handy - for example when debugging the root fs mount mechanism or
other scenarios where no userspace program could be started to do that at
runtime from userspace.

This patch defines a core_param for the variable in charge which allows
users to entirely disable the blank feature at boot time by setting it 0.
The value can still be overwritten at runtime using the standard ioctl
call - this just allows to conditionally change the default.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Daniel Mack 2009-06-16 15:33:52 -07:00 committed by Linus Torvalds
parent 4764e280dc
commit f324edc85e
2 changed files with 11 additions and 6 deletions

View file

@ -546,6 +546,10 @@ and is between 256 and 4096 characters. It is defined in the file
console=brl,ttyS0
For now, only VisioBraille is supported.
consoleblank= [KNL] The console blank (screen saver) timeout in
seconds. Defaults to 10*60 = 10mins. A value of 0
disables the blank timer.
coredump_filter=
[KNL] Change the default value for
/proc/<pid>/coredump_filter.

View file

@ -171,8 +171,9 @@ int do_poke_blanked_console;
int console_blanked;
static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */
static int blankinterval = 10*60*HZ;
static int vesa_off_interval;
static int blankinterval = 10*60;
core_param(consoleblank, blankinterval, int, 0444);
static DECLARE_WORK(console_work, console_callback);
@ -1485,7 +1486,7 @@ static void setterm_command(struct vc_data *vc)
update_attr(vc);
break;
case 9: /* set blanking interval */
blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ;
blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60;
poke_blanked_console();
break;
case 10: /* set bell frequency in Hz */
@ -2871,7 +2872,7 @@ static int __init con_init(void)
if (blankinterval) {
blank_state = blank_normal_wait;
mod_timer(&console_timer, jiffies + blankinterval);
mod_timer(&console_timer, jiffies + (blankinterval * HZ));
}
for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
@ -3677,7 +3678,7 @@ void do_unblank_screen(int leaving_gfx)
return; /* but leave console_blanked != 0 */
if (blankinterval) {
mod_timer(&console_timer, jiffies + blankinterval);
mod_timer(&console_timer, jiffies + (blankinterval * HZ));
blank_state = blank_normal_wait;
}
@ -3711,7 +3712,7 @@ void unblank_screen(void)
static void blank_screen_t(unsigned long dummy)
{
if (unlikely(!keventd_up())) {
mod_timer(&console_timer, jiffies + blankinterval);
mod_timer(&console_timer, jiffies + (blankinterval * HZ));
return;
}
blank_timer_expired = 1;
@ -3741,7 +3742,7 @@ void poke_blanked_console(void)
if (console_blanked)
unblank_screen();
else if (blankinterval) {
mod_timer(&console_timer, jiffies + blankinterval);
mod_timer(&console_timer, jiffies + (blankinterval * HZ));
blank_state = blank_normal_wait;
}
}