updated on Wed Jan 25 08:34:36 UTC 2012
[aur-mirror.git] / sleepd-git / from_apmd.h
blobfb24dfd37ad6a7f38de0e92e0a714e825feca438
1 /* apm.h -- Header file for sample APM interface routines
2 * Created: Mon Jan 8 11:40:50 1996 by r.faith@ieee.org
3 * Revised: Thu Apr 4 21:57:31 1996 by r.faith@ieee.org
4 * Copyright 1996 Rickard E. Faith (r.faith@ieee.org)
6 * This library is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Library General Public License as published
8 * by the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * $Id: apm.h,v 1.7 1999/07/05 22:31:11 apenwarr Exp $
23 #include <linux/apm_bios.h>
24 #include <sys/types.h>
26 #define APM_PROC "/proc/apm"
27 #define APM_DEVICE "/dev/apm_bios"
29 #define APM_DEV "/proc/devices"
30 #define APM_NAME "apm_bios"
32 #ifndef APM_32_BIT_SUPPORT
33 #define APM_32_BIT_SUPPORT 0x0002
34 #endif
36 typedef struct apm_info
38 const char driver_version[10];
39 int apm_version_major;
40 int apm_version_minor;
41 int apm_flags;
42 int ac_line_status;
43 int battery_status;
44 int battery_flags;
45 int battery_percentage;
46 int battery_time;
47 int using_minutes;
49 apm_info;
52 * Encodings for apm_info
54 #define AC_LINE_STATUS_OFF (0)
55 #define AC_LINE_STATUS_ON (1)
56 #define AC_LINE_STATUS_BACKUP (2)
57 #define AC_LINE_STATUS_UNKNOWN (0xff)
59 #define BATTERY_STATUS_HIGH (0)
60 #define BATTERY_STATUS_LOW (1)
61 #define BATTERY_STATUS_CRITICAL (2)
62 #define BATTERY_STATUS_CHARGING (3)
63 #define BATTERY_STATUS_ABSENT (4)
64 #define BATTERY_STATUS_UNKNOWN (0xff)
66 #define BATTERY_FLAGS_HIGH (0x1)
67 #define BATTERY_FLAGS_LOW (0x2)
68 #define BATTERY_FLAGS_CRITICAL (0x4)
69 #define BATTERY_FLAGS_CHARGING (0x8)
70 #define BATTERY_FLAGS_ABSENT (0x80)
72 #define BATTERY_PERCENTAGE_UNKNOWN (-1)
74 #define BATTERY_TIME_UNKNOWN (-1)
76 extern int apm_exists(void);
77 extern int apm_read(apm_info * i);
78 extern dev_t apm_dev(void);
79 extern int apm_open(void);
80 extern int apm_close(int fd);
81 extern int apm_get_events(int fd, int timeout, apm_event_t * events, int n);
82 extern int apm_suspend(int fd);
83 extern int apm_standby(int fd);
84 extern int apm_set_ignore(int fd, int mode);
85 extern const char *apm_error_name( unsigned int err );
86 extern const char *apm_event_name(apm_event_t event);
87 extern const char *apm_time(time_t t);
88 extern const char *apm_delta_time(time_t then, time_t now);
89 extern const char *apm_time_nosec(time_t t);
91 #ifdef APM_IOC_REJECT
92 extern int apm_reject(int fd);
93 #else
94 #define apm_reject(fd) (-EINVAL)
95 #endif