xref: /openbsd/usr.sbin/apmd/apm-proto.h (revision e4a72a75)
1*e4a72a75Sjca /*	$OpenBSD: apm-proto.h,v 1.12 2021/04/06 22:09:56 jca Exp $	*/
2a831c31eSmickey 
3054c7b81Shvozda /*
4054c7b81Shvozda  *  Copyright (c) 1996 John T. Kohl
5054c7b81Shvozda  *  All rights reserved.
6054c7b81Shvozda  *
7054c7b81Shvozda  *  Redistribution and use in source and binary forms, with or without
8054c7b81Shvozda  *  modification, are permitted provided that the following conditions
9054c7b81Shvozda  *  are met:
10054c7b81Shvozda  *  1. Redistributions of source code must retain the above copyright
11054c7b81Shvozda  *     notice, this list of conditions and the following disclaimer.
12054c7b81Shvozda  *  2. Redistributions in binary form must reproduce the above copyright
13054c7b81Shvozda  *     notice, this list of conditions and the following disclaimer in the
14054c7b81Shvozda  *     documentation and/or other materials provided with the distribution.
15054c7b81Shvozda  *  3. The name of the author may not be used to endorse or promote products
16054c7b81Shvozda  *     derived from this software without specific prior written permission.
17054c7b81Shvozda  *
18054c7b81Shvozda  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
19054c7b81Shvozda  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20054c7b81Shvozda  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21054c7b81Shvozda  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
22054c7b81Shvozda  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23054c7b81Shvozda  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24054c7b81Shvozda  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25054c7b81Shvozda  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26054c7b81Shvozda  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27054c7b81Shvozda  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28054c7b81Shvozda  * POSSIBILITY OF SUCH DAMAGE.
29054c7b81Shvozda  *
30054c7b81Shvozda  */
31054c7b81Shvozda 
32054c7b81Shvozda enum apm_action {
33054c7b81Shvozda 	NONE,
34054c7b81Shvozda 	SUSPEND,
35054c7b81Shvozda 	STANDBY,
3629a085afSderaadt 	HIBERNATE,
37f6da2e61Ssturm 	GETSTATUS,
38f6da2e61Ssturm 	SETPERF_LOW,
39f6da2e61Ssturm 	SETPERF_HIGH,
40ab844ba2Sbeck 	SETPERF_AUTO,
41054c7b81Shvozda };
42054c7b81Shvozda 
43054c7b81Shvozda enum apm_state {
44054c7b81Shvozda 	NORMAL,
45054c7b81Shvozda 	SUSPENDING,
4629a085afSderaadt 	STANDING_BY,
4729a085afSderaadt 	HIBERNATING
48054c7b81Shvozda };
49054c7b81Shvozda 
50a99a7ef6Ssturm enum apm_perfmode {
51a99a7ef6Ssturm 	PERF_NONE = -1,
52a99a7ef6Ssturm 	PERF_MANUAL,
53ab844ba2Sbeck 	PERF_AUTO,
54f6da2e61Ssturm };
55f6da2e61Ssturm 
56054c7b81Shvozda struct apm_command {
57054c7b81Shvozda 	int vno;
58054c7b81Shvozda 	enum apm_action action;
59054c7b81Shvozda };
60054c7b81Shvozda 
61054c7b81Shvozda struct apm_reply {
62054c7b81Shvozda 	int vno;
63054c7b81Shvozda 	enum apm_state newstate;
64a99a7ef6Ssturm 	enum apm_perfmode perfmode;
65cc5d5fa6Ssturm 	int cpuspeed;
66054c7b81Shvozda 	struct apm_power_info batterystate;
67c7cff24eSkn 	int error;
68054c7b81Shvozda };
69054c7b81Shvozda 
70*e4a72a75Sjca #define APMD_VNO	4
71054c7b81Shvozda 
72c72b5b24Smillert extern const char *battstate(int state);
73c72b5b24Smillert extern const char *ac_state(int state);
74a99a7ef6Ssturm extern const char *perf_mode(int mode);
75c7cff24eSkn extern const char *apm_state(int apm_state);
76