We want to hear from you! Please send us your
FEEDBACK.
The following technical article may contain actual software programs in source code form.
This source code is made available for developers to use as needed, pursuant to the terms and conditions of this
license.
NOTE: As of writing this article, some of the APIs used in this article
are not supported on Solaris x86 platform.
The functions contained in the X server DPMS Extension API are:
To access these man pages, use the following
syntax:
The Solaris 8 Operating System X Server
Display Power Management Signaling (DPMS) Extension
by Gopinath Rao
(July 2003)Introduction
Beginning with the Solaris 8 Operating System (OS), a set of APIs was introduced that
can be used to query and alter the power management aspects of an X server.
DPMSCapable - returns the DPMS capability of the X server.
DPMSDisable - disables DPMS on the specified display.
DPMSEnable - enables DPMS on the specified display.
DPMSForceLevel - forces a DPMS capable display into the specified power
level.
DPMSGetTimeouts - retrieves the timeout values used by the X server
for DPMS timings.
DPMSGetVersion - returns the version of the DPMS extension implemented
by the X server.
DPMSInfo - returns information about the current DPMS state.
DPMSQueryExtension - queries the X server to determine the availability
of the DPMS Extension.
DPMSSetTimeouts - permits applications to set the timeout values used
by the X server for DPMS timings.
Some of the functionalities available by means of the above API
are also available by using the xset
user preference utility for X.
Sample Program
Following is a sample program that can be used to query the DPMS capability
of an X server. If the X server is DPMS capable, the program will force the monitor
out of power save mode.
A typical use for this type of application would be during setups where the user wishes to enable
power save mode during normal operation, and wants to switch off power save mode to
display a message (possibly to draw operator attention).
/*
* Compile the sample program as:
*
* $ cc -o dpms dpms.c -lX11 -lXext
*
*/
/* Declaration of XOpenDisplay, XCloseDisplay and Display */
#include <X11/Xlibint.h>
/* dpms.h has prototypes for DPMSDisable and DPMSCapable
*/
#include <X11/extensions/dpms.h>
Bool DPMSCapable (Display *);
Status DPMSDisable (Display *);
void main()
{
Bool g;
Display *d;
/*
* XOpenDisplay() returns a Display structure defined
in <X11/Xlib.h>
* that contains all the information about the X
server
*/
if (( d = XOpenDisplay(NULL)) == NULL)
{
printf("Unable to open the display\n");
exit(1);
}
/*
* The DPMSCapable function returns the DPMS
capability of the
* X server, either TRUE (capable of
DPMS) or FALSE (incapable
* of DPMS).
*/
g = DPMSCapable(d);
printf("X server DPMS capablity is:%d\n",g);
if (g == True)
{
/* The DPMSDisable function disables
DPMS on the specified
* display.
*/
DPMSDisable(d);
}
/*
* The XCloseDisplay function closes the connection
to the X
* server for the display specified in the
Display structure
*/
XCloseDisplay(d);
}
Program Execution
a) Set the DISPLAY environment variable to the display that is being
forced off power save mode.
For csh:
%setenv DISPLAY :0.0 (For local system)
For sh or ksh:
$DISPLAY=:0.0; export DISPLAY (For local system)
b) Run the sample program as:
%./dpms
Please note that power save mode will be disabled for the display device
after running this program. You will have to use the DPMSEnable(3dpms) API -
the xset(1) utility, or the dtpower(1M)
interface to re-enable power save mode.
References
$man -M /usr/openwin/man <Function_Name>
DOC ID# 1931