RemoteDrawingEngine: Reduce RP_READ_BITMAP result timeout.
[haiku.git] / src / bin / dpms.cpp
blobb8207a4a82156ec457f79b33b7aa0a140979b037
1 /*
2 * dpms CLI tool
3 * (c) François Revol, revol@free.fr
4 */
6 #include <stdio.h>
7 #include <string.h>
8 #include <Application.h>
9 #include <Accelerant.h>
10 #include <Screen.h>
12 int usage(char *prog)
14 printf("%s on|standby|suspend|off|caps|state\n", prog);
15 printf("on|standby|suspend|off\tsets corresponding state\n");
16 printf("caps\tprints capabilities\n");
17 printf("state\tprints the current state\n");
18 return 1;
21 int main(int argc, char **argv)
23 BApplication app("application/x-vnd.Haiku.dpms");
24 BScreen bs;
25 if (argc < 2)
26 return usage(argv[0]);
27 if (!strcmp(argv[1], "on"))
28 bs.SetDPMS(B_DPMS_ON);
29 else if (!strcmp(argv[1], "standby"))
30 bs.SetDPMS(B_DPMS_STAND_BY);
31 else if (!strcmp(argv[1], "suspend"))
32 bs.SetDPMS(B_DPMS_SUSPEND);
33 else if (!strcmp(argv[1], "off"))
34 bs.SetDPMS(B_DPMS_OFF);
35 else if (!strcmp(argv[1], "caps")) {
36 uint32 caps = bs.DPMSCapabilites(); // nice typo...
37 printf("dpms capabilities: %s%s%s%s\n", (caps & B_DPMS_ON)?("on"):(""),
38 (caps & B_DPMS_STAND_BY)?(", standby"):(""),
39 (caps & B_DPMS_SUSPEND)?(", suspend"):(""),
40 (caps & B_DPMS_OFF)?(", off"):(""));
41 } else if (!strcmp(argv[1], "state")) {
42 uint32 st = bs.DPMSState();
43 printf("%s\n", (st & B_DPMS_ON)?("on"):
44 ((st & B_DPMS_STAND_BY)?("standby"):
45 ((st & B_DPMS_SUSPEND)?("suspend"):
46 ((st & B_DPMS_OFF)?("off"):("?")))));
47 } else
48 return usage(argv[0]);
49 return 0;