Screen saver weirdness

J. Seth Henry jshamlet at
Sat Apr 12 14:22:31 PDT 2003

I am trying to modify the "blank" screensaver module to clear/set a bit in
a PCI control register to make the LCD on my Compaq IA-1 turn off/on - as
it doesn't respond to DPMS (green) signals. I took some working code I
already have, and plopped it into a copy of the blank_saver source:

... (existing #includes / copyright info deleted) ...

#define PCI_CMD(busn, devn, funcn, regn)   (0x80000000 | (busn << 16) |
(devn << 11) | (funcn << 8) | (regn << 2))

#define PCI_CFG_ADDR  0x0CF8
#define PCI_CFG_DATA  0x0CFC
#define LENGTH 4
#define PCI_VENDOR_ID 0x30571106
#define GPIO_EXP_BASE 0xEE00
#define GPIO_REG_ADDR 0x4C

int GPO_ADDR = 0xEE4C;

static int
blank_saver(video_adapter_t *adp, int blank)
        unsigned long i;
        u_int t;

        t = i386_set_ioperm(PCI_CFG_ADDR, LENGTH, 1);
        t += i386_set_ioperm(PCI_CFG_DATA, LENGTH, 1);
        if(t |= 0)
                return 1;

... (assorted register checks - so I don't accidentally screw my dev
machine ) ...

        i = inl(GPO_ADDR);
        if (blank == 0)
                i = i & ~(0x1 << 7);
        } else {
                i = i | (0x1 << 7);
        outl(GPO_ADDR, i);

/*      (*vidsw[adp->va_index]->blank_display)(adp,
                                               (blank) ? V_DISPLAY_BLANK
                                                       : V_DISPLAY_ON);
        return 0;

I think I have correctly written the code, though I am still having
problems testing it. It does compile, and I can kldload the resulting
.ko (and nothing weird happens), but I seem to be having another
problem. The original screen saver still works, even after it is unloaded.
I'm not sure if my code is working, or if it is even being run at all.

I specifically unloaded blank_saver.ko, and the screen *still* goes dark
after the timeout. Also, I modified my screen saver to not blank the
display, and it is made no difference.

Here is the output from kldstat:

dhcppc3#  kldstat
Id Refs Address    Size     Name
 1    1 0xc0100000 28151c   kernel

So, I'm wondering what the correct procedure is for replacing screen
savers? Is there something other than kldload/kldunload I need to do,
preferably short of rebooting?

Additionally, is there any way to get diagnostic info from a screen saver.
Yep, I know - sounds odd, but access to the syslog would be mighty helpful
right about now. Attempts to use stdio resulted in a module that refuses
to load (gives me an exec error)

I'm open to suggestions if someone knows a better way to do this as well.
I figured the a kernel screensaver was probably the best way to go - but
any way to keep my terminals from burning out their backlight tubes
prematurely is welcome.

Seth Henry

More information about the freebsd-questions mailing list