From James.Cloos@Rahul.NET Sat Mar 19 13:30:21 EST 1994 Article: 6877 of comp.os.linux.development Newsgroups: comp.os.linux.development Path: bigblue.oit.unc.edu!concert!news.duke.edu!MathWorks.Com!europa.eng.gtefsd.com!gatech!swrinde!sgiblab!a2i!James.Cloos From: James.Cloos@Rahul.NET (James H. Cloos Jr.) Subject: Re: blank_screen patch for Laptops (Questions) In-Reply-To: 63912i@cfi.waseda.ac.jp's message of 17 Mar 1994 18:29:15 GMT Message-ID: Sender: news@rahul.net (Usenet News) Nntp-Posting-Host: jive Organization: a2i network References: <2ma7hr$439@wsdnws.cfi.waseda.ac.jp> Date: Sat, 19 Mar 1994 11:09:30 GMT Lines: 162 I was waiting on this until I finished it, but I thought I should followup now anyway. I had previously hacked version 99.14 to turn off my backlight at timeout, and leave it on when graphics mode was activated. I decided to do a cleaner mod for 1.0. The following patch to drivers/char/console.c and include/linux/tty.h adds the beginings of support for a user space daemon that can function as a general screen saver--whether than means controllong the backlight, or wastings cpu time on a fireworks display ;-) or whatever. What I need to do is add an ioclt to register the pid of said daemon so that the kernel can signal it. I also want to request comments on the signals to send to the daemon, and whether some heuristic is needed to confirm the pid still existst. I expect the daemon to set up its signal handlers, call the as-yet- to-be-added ioclt to register itself, and wait for signals. The handler for SIGTERM &c should call the ioclt to unregister itself. Comments? ======================================== diff -u linux/drivers/char/console.c_1.0 linux/drivers/char/console.c --- linux/drivers/char/console.c_1.0 Wed Feb 23 01:52:24 1994 +++ linux/drivers/char/console.c Thu Mar 17 04:29:57 1994 @@ -14,6 +14,8 @@ * 'void update_screen(int new_console)' * 'void blank_screen(void)' * 'void unblank_screen(void)' + * 'void user_blank_screen(void)' + * 'void user_unblank_screen(void)' * * 'int con_get_font(char *)' * 'int con_set_font(char *)' @@ -35,6 +37,9 @@ * Code to check for different video-cards mostly by Galen Hunt, * * + * user_{un}?blank_screen() Copyright 1994 by James H. Cloos, Jr. + * + * */ #define CAN_LOAD_EGA_FONTS /* undefine if the user must not do this */ @@ -148,6 +153,7 @@ unsigned short *vc_scrbuf[NR_CONSOLES]; static unsigned short * vc_scrmembuf; static int console_blanked = 0; +static int user_blank_pid = 0; #define origin (vc_cons[currcons].vc_origin) #define scr_end (vc_cons[currcons].vc_scr_end) @@ -1402,7 +1408,7 @@ video_page = ORIG_VIDEO_PAGE; screen_size = (video_num_lines * video_size_row); kmem_start += NR_CONSOLES * screen_size; - timer_table[BLANK_TIMER].fn = blank_screen; + timer_table[BLANK_TIMER].fn = user_blank_screen; timer_table[BLANK_TIMER].expires = 0; if (blankinterval) { timer_table[BLANK_TIMER].expires = jiffies+blankinterval; @@ -1550,18 +1556,31 @@ { if (console_blanked) return; - timer_table[BLANK_TIMER].fn = unblank_screen; + timer_table[BLANK_TIMER].fn = user_unblank_screen; get_scrmem(fg_console); hide_cursor(); console_blanked = 1; memsetw((void *)video_mem_base, 0x0020, video_mem_term-video_mem_base ); } +void user_blank_screen(void) +{ + if (console_blanked) + return; + blank_screen(); +#if 0 +/* we want to send SIGUSR1 to the registered process, if any. */ +/* perhaps SIGCONT would be better? */ + if (user_blank_pid) + (void) kill_proc(user_blank_pid,SIGUSR1,1); +#endif +} + void unblank_screen(void) { if (!console_blanked) return; - timer_table[BLANK_TIMER].fn = blank_screen; + timer_table[BLANK_TIMER].fn = user_blank_screen; if (blankinterval) { timer_table[BLANK_TIMER].expires = jiffies + blankinterval; timer_active |= 1<read_q); bp++; diff finished at Sat Mar 19 05:56:30 diff -u linux/include/linux/tty.h-1.0 linux/include/linux/tty.h --- linux/include/linux/tty.h-1.0 Fri Feb 18 04:08:41 1994 +++ linux/include/linux/tty.h Thu Mar 17 04:30:52 1994 @@ -438,7 +438,9 @@ extern int con_open(struct tty_struct * tty, struct file * filp); extern void update_screen(int new_console); extern void blank_screen(void); +extern void user_blank_screen(void); extern void unblank_screen(void); +extern void user_unblank_screen(void); /* vt.c */ diff finished at Sat Mar 19 05:58:01 ===================================== -- James H. Cloos, Jr. include James.Cloos@Rahul.NET include (cloos@io.com) Snail: POBox 1111, Amherst, NY 14226-1111 Finger for pgp pub key. Phone: +1 716 673-1250 (machine now; fax eventually)