xref: /openbsd/usr.sbin/apmd/apm-proto.h (revision 898184e3)
1 /*	$OpenBSD: apm-proto.h,v 1.9 2012/03/26 20:17:45 deraadt Exp $	*/
2 
3 /*
4  *  Copyright (c) 1996 John T. Kohl
5  *  All rights reserved.
6  *
7  *  Redistribution and use in source and binary forms, with or without
8  *  modification, are permitted provided that the following conditions
9  *  are met:
10  *  1. Redistributions of source code must retain the above copyright
11  *     notice, this list of conditions and the following disclaimer.
12  *  2. Redistributions in binary form must reproduce the above copyright
13  *     notice, this list of conditions and the following disclaimer in the
14  *     documentation and/or other materials provided with the distribution.
15  *  3. The name of the author may not be used to endorse or promote products
16  *     derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
22  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  */
31 
32 enum apm_action {
33 	NONE,
34 	SUSPEND,
35 	STANDBY,
36 	HIBERNATE,
37 	GETSTATUS,
38 	SETPERF_LOW,
39 	SETPERF_HIGH,
40 	SETPERF_AUTO,
41 	SETPERF_COOL
42 };
43 
44 enum apm_state {
45 	NORMAL,
46 	SUSPENDING,
47 	STANDING_BY,
48 	HIBERNATING
49 };
50 
51 enum apm_perfmode {
52 	PERF_NONE = -1,
53 	PERF_MANUAL,
54 	PERF_AUTO,
55 	PERF_COOL
56 };
57 
58 struct apm_command {
59 	int vno;
60 	enum apm_action action;
61 };
62 
63 struct apm_reply {
64 	int vno;
65 	enum apm_state newstate;
66 	enum apm_perfmode perfmode;
67 	int cpuspeed;
68 	struct apm_power_info batterystate;
69 };
70 
71 #define APMD_VNO	3
72 
73 extern const char *battstate(int state);
74 extern const char *ac_state(int state);
75 extern const char *perf_mode(int mode);
76