Date: Fri, 10 Nov 2000 09:40:37 +0200 From: Graham Wheeler <gram@cequrux.com> To: Dan Nelson <dnelson@emsphone.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Help writing a screen saver module Message-ID: <3A0BA675.474EA77B@cequrux.com> References: <3A06B7A7.7665C46A@cequrux.com> <xzpofzrww7o.fsf@flood.ping.uio.no> <20001107144202.B4569@dan.emsphone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <gram@cequrux.com> 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 <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/module.h> #include <sys/syslog.h> #include <machine/md_var.h> #include <machine/random.h> #include <saver.h> #include <dev/syscons/syscons.h> #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 && from<MAXCONS) { int s = spltty(); /* The next line may be the right way for FreeBSD 4.x */ /*scr_stat *fc = SC_STAT(SC_DEV(sc_find_softc(adp, NULL), from));*/ /* I'm using 3.4, which can't cope with the above; this is a more kludgy equivalent that works for me; it assumes that the syscons major dev number is 12 */ scr_stat *fc = sc_get_scr_stat(makedev(12, from)); if (fc->scr_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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A0BA675.474EA77B>