* Blank now key
@ 2003-03-27 22:33 Pavel Machek
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2003-03-27 22:33 UTC (permalink / raw)
To: vojtech, kernel list, torvalds
Hi!
This is must-have for machines where backlight eats significant
ammount of power. Please apply,
Pavel
Index: linux/drivers/char/keyboard.c
===================================================================
--- linux.orig/drivers/char/keyboard.c 2003-03-27 11:10:04.000000000 +0100
+++ linux/drivers/char/keyboard.c 2003-03-16 18:51:05.000000000 +0100
@@ -20,6 +20,7 @@
* parts by Geert Uytterhoeven, May 1997
*
* 27-05-97: Added support for the Magic SysRq Key (Martin Mares)
+ * 29-07-97: Added blank console key (Pavel Machek)
* 30-07-98: Dead keys redone, aeb@cwi.nl.
* 21-08-02: Converted to input API, major cleanup. (Vojtech Pavlik)
*/
@@ -86,7 +87,8 @@
fn_show_state, fn_send_intr, fn_lastcons, fn_caps_toggle,\
fn_num, fn_hold, fn_scroll_forw, fn_scroll_back,\
fn_boot_it, fn_caps_on, fn_compose, fn_SAK,\
- fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num
+ fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num, \
+ fn_blank_now
typedef void (fn_handler_fn)(struct vc_data *vc, struct pt_regs *regs);
static fn_handler_fn FN_HANDLERS;
@@ -320,6 +322,25 @@
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;
+
+static void fn_blank_now(struct vc_data *vc, struct pt_regs *regs)
+{
+ /* 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;
+ add_timer(&blank_now_timer);
+}
+
static void applkey(struct vc_data *vc, int key, char mode)
{
static char buf[] = { 0x1b, 'O', 0x00, 0x00 };
@@ -1215,6 +1258,9 @@
{
int i;
+ init_timer(&blank_now_timer);
+ blank_now_timer.function = blank_now_do;
+
kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS;
kbd0.ledmode = LED_SHOW_FLAGS;
kbd0.lockstate = KBD_DEFLOCK;
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Blank now key
2002-08-28 22:16 Pavel Machek
@ 2002-08-29 11:10 ` DervishD
0 siblings, 0 replies; 3+ messages in thread
From: DervishD @ 2002-08-29 11:10 UTC (permalink / raw)
To: pavel, vojtech, linux-kernel
Hi Pavel :))
>Being able to "blank now" is very important for handheld devices
And for computers that are always up with the monitor powered off
;). This key is just a *great* idea. No I will be able to turn off my
monitor 'by software' ;)) (BTW I don't use power saver nor
autoblanking and must switch off my monitor if I want to save power
and/or CRT life).
Thanks for the idea (and the patch, of course ;))
Raúl
^ permalink raw reply [flat|nested] 3+ messages in thread
* Blank now key
@ 2002-08-28 22:16 Pavel Machek
2002-08-29 11:10 ` DervishD
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2002-08-28 22:16 UTC (permalink / raw)
To: vojtech, kernel list
Hi!
Being able to "blank now" is very important for handheld devices
(where screen can eat more than 50% of total power), and it is just
nice everywhere else (also saves a little power). Please apply.
Pavel
--- clean/drivers/char/keyboard.c Wed Aug 28 22:38:44 2002
+++ linux/drivers/char/keyboard.c Wed Aug 28 23:03:43 2002
@@ -20,6 +20,7 @@
* parts by Geert Uytterhoeven, May 1997
*
* 27-05-97: Added support for the Magic SysRq Key (Martin Mares)
+ * 29-07-97: Added blank console key (Pavel Machek)
* 30-07-98: Dead keys redone, aeb@cwi.nl.
* 21-08-02: Converted to input API, major cleanup. (Vojtech Pavlik)
*/
@@ -88,7 +89,8 @@
fn_show_state, fn_send_intr, fn_lastcons, fn_caps_toggle,\
fn_num, fn_hold, fn_scroll_forw, fn_scroll_back,\
fn_boot_it, fn_caps_on, fn_compose, fn_SAK,\
- fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num
+ fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num, \
+ fn_blank_now
typedef void (fn_handler_fn)(struct vc_data *vc);
static fn_handler_fn FN_HANDLERS;
@@ -310,6 +312,25 @@
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;
+
+static void fn_blank_now(struct vc_data *vc)
+{
+ /* 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;
+ add_timer(&blank_now_timer);
+}
+
static void applkey(struct vc_data *vc, int key, char mode)
{
static char buf[] = { 0x1b, 'O', 0x00, 0x00 };
@@ -1169,6 +1209,9 @@
int __init kbd_init(void)
{
int i;
+
+ init_timer(&blank_now_timer);
+ blank_now_timer.function = blank_now_do;
kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS;
kbd0.ledmode = LED_SHOW_FLAGS;
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-03-28 8:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-27 22:33 Blank now key Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2002-08-28 22:16 Pavel Machek
2002-08-29 11:10 ` DervishD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®