From owner-freebsd-hackers Mon Nov 6 7:38:37 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 A557937B479 for ; Mon, 6 Nov 2000 07:38:29 -0800 (PST) Received: (from nobody@localhost) by citadel.cequrux.com (8.8.8/8.6.9) id RAA15776 for ; Mon, 6 Nov 2000 17:38:20 +0200 (SAST) Received: by citadel.cequrux.com via recvmail id 15675; Mon Nov 6 17:37:22 2000 Message-ID: <3A06B7A7.7665C46A@cequrux.com> Date: Mon, 06 Nov 2000 15:52:39 +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: freebsd-hackers@freebsd.org Subject: Help writing a screen saver module Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi all 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. The code that I have at the moment is based on other simple saver modules, and the VT_ACTIVATE ioctl code in syscons.c. However, it just causes a reboot. This isn't a very important piece of code, but before I give up on trying to get it to work, I thought I'd throw it out here and see if anyone has any ideas. Here are the two externally visible routines I've added to syscons.c: ---------------------------------------------------------------------- extern int ActivateConsole(int n); extern int GetActiveConsole(void); int ActivateConsole(int n) { int s = spltty(); sc_clean_up(cur_console); splx(s); return switch_scr(cur_console, n); } int GetActiveConsole(void) { return get_scr_num(); } ---------------------------------------------------------------------- Here is the module code: ---------------------------------------------------------------------- #include #include #include #include #include #include #include #include static int last_active, blanked; extern int ActivateConsole(int); extern int GetActiveConsole(); static int switch_saver(video_adapter_t *adp, int blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (blank) { if (!blanked) { blanked = 1; last_active = GetActiveConsole(); ActivateConsole(0); } } else { if (blanked) { blanked = 0; ActivateConsole(last_active); } } return 0; } static int switch_init(video_adapter_t *adp) { (void)adp; last_active = blanked = 0; 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); -- 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message