API to turn off the display

James Green jim at thebadger.org
Thu Jan 29 16:58:01 PST 2004


On Fri, 2004-01-30 at 00:13, Melvyn Sopacua wrote:
> On Friday 30 January 2004 00:19, James Green wrote:
> 
> > Recompiled the kernel with:
> > options SC_NO_SUSPEND_VTYSWITCH
> >
> > and now it all works!
> >
> > I added to rc.suspend:
> >
> > xset -display :0 dpms force off
> > sleep 3
> > sysctl hw.acpi.video.lcd0.active=0
> > sleep 1
> > sysctl hw.acpi.cpu.throttle_state=1
> >
> > and to rc.resume:
> >
> > sysctl hw.acpi.cpu.throttle_state=8
> > xset -display :0 dpms force on
> > sysctl hw.acpi.video.lcd0.active=1
> >
> > The order of DPMS and ACPI is important. This works on both the console
> > and in X. Next up is to add in ataidle...
> 
> Thanx very much for working this out. Does this only work when running xdm or 
> variants thereof? I boot into console and 'startx', in a KDE 3.2 Konsole 
> running the xset/dpms command doesn't yield any results.

It should work in both. (I run X via both gdm and startx) It will also
work from the console when X is not running as the xset commands just
timeout. The DPMS calls stop it from screwing up your display in X.

Try 'xset dpms force off' as the user you are logged in as (i.e. not
root) If that does not turn off the display but blanks it, you probably
need to look at drivers for Xfree that fully support DPMS for your card.
If you have a radeon 9000, you can either patch the driver
(http://bugs.xfree86.org/show_bug.cgi?id=26) or use 
ports/x11-servers/XFree86-4-Server-snap/

Once this works, you just need to get yourself setup so that root can
call the dpms force off. If 'xset -display :0 dpms force off' gives you
Xlib errors as root, try 'startx -listen_tcp' (as your normal user) and
then 'xhost +localhost' once X is running - should let you run 'xset
-display :0 dpms force off' as root to turn off the display. 
I am sure there is a better way of doing this, but this does work.

James





More information about the freebsd-current mailing list