From: Daniel Mack Date: Tue, 16 Jun 2009 22:33:52 +0000 (-0700) Subject: console: make blank timeout value a boot option X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=f324edc85e5c1137e49e3b36a58cf436ab5b1fb3;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index ad3800630772..5578248c18a4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -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//coredump_filter. diff --git a/drivers/char/vt.c b/drivers/char/vt.c index c796a86ab7f3..d9113b4c76e3 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -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; } }