From owner-freebsd-hackers Fri Nov 10 1:26:20 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from citadel.cequrux.com (citadel.cequrux.com [192.96.22.18]) by hub.freebsd.org (Postfix) with ESMTP id 8C14437B479 for ; Fri, 10 Nov 2000 01:26:12 -0800 (PST) Received: (from nobody@localhost) by citadel.cequrux.com (8.8.8/8.6.9) id LAA01096; Fri, 10 Nov 2000 11:25:56 +0200 (SAST) Received: by citadel.cequrux.com via recvmail id 991; Fri Nov 10 11:25:14 2000 Message-ID: <3A0BA675.474EA77B@cequrux.com> Date: Fri, 10 Nov 2000 09:40:37 +0200 From: Graham Wheeler Organization: Cequrux Technologies X-Mailer: Mozilla 4.5 [en] (X11; I; FreeBSD 3.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Dan Nelson Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Help writing a screen saver module References: <3A06B7A7.7665C46A@cequrux.com> <20001107144202.B4569@dan.emsphone.com> Content-Type: multipart/mixed; boundary="------------9A44061129438E75E5872412" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------9A44061129438E75E5872412 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Dan Nelson wrote: > > In the last episode (Nov 07), Dag-Erling Smorgrav said: > > Graham Wheeler writes: > > > I am trying to write a screen saver module that, when it kicks in, > > > will switch to the first console, and then, if a key is pressed, > > > will switch back to the one that was previously active. The idea is > > > that the first console has something useful running on it, > > > typically a tail -f of the logs. > > > You can make it look like you're switched to vty 0, by making your > screen_saver() function simply copy the contents of vty 0 to screen > memory on every update. Just make sure both vtys are the same size > first... Okay, got it working. I've attached my code if anyone is interested. Thanks for all the help Dan. I have another question now - it would be great if I could put a message on the top or bottom line of /dev/ttyv0, in inverse video, and have the output of the `tail -f' go to a scrolling region in the rest of the screen. The idea here is, on /dev/ttyv0, to have a message "Press Alt-Fn (n=1,2,..) for Login Consoles". The screen saver would replace this with "Press any key to stop watching logs and return to login console", or something like that. It would be nice, but its not too important... gram -- Dr Graham Wheeler E-mail: gram@cequrux.com Director, Research and Development WWW: http://www.cequrux.com CEQURUX Technologies Phone: +27(21)423-6065 Firewalls/VPN Specialists Fax: +27(21)424-3656 --------------9A44061129438E75E5872412 Content-Type: text/plain; charset=us-ascii; name="switch_saver.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="switch_saver.c" #include #include #include #include #include #include #include #include #include #ifndef SC_STAT #define SC_STAT sc_get_scr_stat #endif #ifndef MAXCONS #define MAXCONS 16 #endif void CopyConsoleContents(video_adapter_t *adp, int from) { if (from>=0 && fromscr_buf && adp->va_window && fc->ysize == adp->va_info.vi_height && fc->xsize == adp->va_info.vi_width) { int len = fc->ysize * fc->xsize, pos; for (pos = 0; pos < len; ++pos) writew(adp->va_window+pos*2, fc->scr_buf[pos]); } splx(s); } } static int switch_saver(video_adapter_t *adp, int blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (blank) CopyConsoleContents(adp, 0); return 0; } static int switch_init(video_adapter_t *adp) { (void)adp; return 0; } static int switch_term(video_adapter_t *adp) { (void)adp; return 0; } static scrn_saver_t switch_module = { "switch_saver", switch_init, switch_term, switch_saver, NULL, }; SAVER_MODULE(switch_saver, switch_module); --------------9A44061129438E75E5872412-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message