Blank console on keyboard request

Pavel Machek (pavel@suse.cz)
Fri, 19 Nov 1999 22:28:35 +0100


Hi!

This patch adds blank console keyboard combination. This is usefull if
you want your monitor to consume less energy (primarily usefull on
notebooks to extend batery life).

Pavel

--- clean/drivers/char/keyboard.c Mon Nov 15 22:12:40 1999
+++ linux/drivers/char/keyboard.c Mon Nov 15 22:17:55 1999
@@ -83,7 +88,7 @@
/* shift state counters.. */
static unsigned char k_down[NR_SHIFT] = {0, };
/* keyboard key bitmap */
-static unsigned long key_down[256/BITS_PER_LONG] = { 0, };
+unsigned long key_down[256/BITS_PER_LONG] = { 0, };

static int dead_key_next = 0;
/*
@@ -118,21 +123,22 @@

/* Key types processed even in raw modes */

-#define TYPES_ALLOWED_IN_RAW_MODE ((1 << KT_SPEC) | (1 << KT_SHIFT))
+#define TYPES_ALLOWED_IN_RAW_MODE ((1 << KT_SPEC) | (1 << KT_SHIFT))

typedef void (*void_fnp)(void);
typedef void (void_fn)(void);

static void_fn do_null, enter, show_ptregs, send_intr, lastcons, caps_toggle,
num, hold, scroll_forw, scroll_back, boot_it, caps_on, compose,
- SAK, decr_console, incr_console, spawn_console, bare_num;
+ SAK, decr_console, incr_console, spawn_console, bare_num, blank_now;

static void_fnp spec_fn_table[] = {
do_null, enter, show_ptregs, show_mem,
show_state, send_intr, lastcons, caps_toggle,
num, hold, scroll_forw, scroll_back,
boot_it, caps_on, compose, SAK,
- decr_console, incr_console, spawn_console, bare_num
+ decr_console, incr_console, spawn_console, bare_num,
+ blank_now
};

#define SPECIALS_ALLOWED_IN_RAW_MODE (1 << KVAL(K_SAK))
@@ -354,6 +366,26 @@
con_schedule_flip(tty);
}

+static void blank_now_do(unsigned long unused)
+{
+ do_poke_blanked_console = 0;
+ do_blank_screen(0);
+}
+
+static struct timer_list blank_now_timer = {NULL, NULL, 0, 0, blank_now_do};
+
+static void blank_now(void)
+{
+ /* You ask why we have our own timer here? Well, it is because
+ we do not want user's release of keys to unblank
+ immediately. Even if we correctly guessed what is press and
+ what is release, thinkpad's broken bios will turn on
+ backlight for us... <pavel@ucw.cz> */
+ blank_now_timer.expires = jiffies + HZ;
+ blank_now_timer.prev = blank_now_timer.next = NULL;
+ add_timer(&blank_now_timer);
+}
+
static void applkey(int key, char mode)
{
static char buf[] = { 0x1b, 'O', 0x00, 0x00 };

-- 
I'm really pavel@ucw.cz. Look at http://195.113.31.123/~pavel.  Pavel
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/