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 <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>
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: [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message