[Pacebook-devel] textmode blanking
Brought to you by:
zander
|
From: Alessandro R. <ru...@ar...> - 2003-10-05 00:11:41
|
I'm one of the "startx" guys (no [xgk]dm). So my computers are often
in text mode (used over the network or just mail reading on a text
terminal).
The following trivial module deals with console blanking in text mode.
The X server already turns the video off (I'm running the vanilla
4.1.0 I found in Woody (Debian GNU/Linux).
I don't run the pbiod, as it turns the video off while I'm interactive
over an USB keyboard, and that's not enjoyable.
/alessandro
/* GPL 2 or later, but I doubt this trivial stuff is copyrightable */
#define __KERNEL__
#define MODULE
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/io.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Alessandro Rubini");
extern int (*console_blank_hook)(int);
int (*pbl_hook_save)(int);
int pbl_hook(int what)
{
if (what)
outb(0x99, 0xb1); /* light off with pacebook register */
else
outb(0x98, 0xb1); /* light on */
if (pbl_hook_save)
return pbl_hook_save(what);
return 0;
}
int pbl_init(void)
{
pbl_hook_save = console_blank_hook;
console_blank_hook = pbl_hook;
return 0;
}
void pbl_exit(void)
{
console_blank_hook = pbl_hook_save;
}
module_init(pbl_init);
module_exit(pbl_exit);
|