1 /* $OpenBSD: apm-proto.h,v 1.12 2021/04/06 22:09:56 jca 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 }; 42 43 enum apm_state { 44 NORMAL, 45 SUSPENDING, 46 STANDING_BY, 47 HIBERNATING 48 }; 49 50 enum apm_perfmode { 51 PERF_NONE = -1, 52 PERF_MANUAL, 53 PERF_AUTO, 54 }; 55 56 struct apm_command { 57 int vno; 58 enum apm_action action; 59 }; 60 61 struct apm_reply { 62 int vno; 63 enum apm_state newstate; 64 enum apm_perfmode perfmode; 65 int cpuspeed; 66 struct apm_power_info batterystate; 67 int error; 68 }; 69 70 #define APMD_VNO 4 71 72 extern const char *battstate(int state); 73 extern const char *ac_state(int state); 74 extern const char *perf_mode(int mode); 75 extern const char *apm_state(int apm_state); 76