5 #define LIBACPI_VER "0.95"
7 /* Here because we need it for definitions in this file . . . */
11 #define CAP_SAMPLES (SAMPLES*10)
50 /* these two are conveniences */
51 char info_file
[MAX_NAME
];
52 char state_file
[MAX_NAME
];
53 /* sysfs capacity mode */
54 sysfs_capa_t sysfs_capa_mode
;
56 int design_cap
; /* assuming mAh */
58 int design_voltage
; /* in mV */
60 charge_state_t charge_state
;
61 int present_rate
; /* in mAh */
62 int remaining_cap
; /* in mAh */
63 int present_voltage
; /* in mV */
64 /* calculated states */
66 int percentage
; /* stored here because this is a per battery thing */
67 int charge_time
; /* time left to charge this battery */
68 /* and a flag to indicate that this is valid . . . */
70 /* number of times we've gotten bad info on this battery's present rate */
76 char state_file
[MAX_NAME
];
80 /* how to calculate the time remaining */
82 RT_RATE
, /* using the current rate, as per the ACPI spec */
83 RT_CAP
, /* using the remaining capacity over time */
87 int rtime
; /* remaining time */
88 int timer
; /* how long been on battery? */
89 int crit_level
; /* anything below this is critical low */
90 int battery_count
; /* number of batteries found */
91 enum rtime_mode rt_mode
; /* remaining time mode */
92 int rt_forced
; /* was our rt_mode forced? if so, we do what we were told */
93 battery_t
*binfo
; /* pointer to the battery being monitored */
98 * Moving percentage to the battery is right, but I think we need a global
99 * remaining capacity somewhere, too . . .
103 * To provide a convenient debugging function . . .
105 * It's a macro because I'm too lazy to deal with varargs.
108 #define pdebug(fmt, arg...) \
111 fprintf(stderr, fmt, ##arg); \
114 #define pinfo(fmt, arg...) \
117 fprintf(stderr, fmt, ##arg); \
120 #define perr(fmt, arg...) \
123 fprintf(stderr, fmt, ##arg); \
126 #define pfatal(fmt, arg...) \
127 fprintf(stderr, fmt, ##arg) \
130 /* Since these /are/ needed here . . . */
131 extern battery_t batteries
[MAXBATT
];
132 extern int verbosity
;
134 /* check if apm/acpi is enabled, etc */
135 int power_init(global_t
*globals
);
136 /* reinitialise everything */
137 int power_reinit(global_t
*globals
);
138 int reinit_ac_adapters(global_t
*globals
);
139 int reinit_batteries(global_t
*globals
);
141 /* fill global_t with data */
142 void acquire_batt_info(global_t
*globals
, int batt
);
143 void acquire_all_batt_info(global_t
*globals
);
144 void acquire_global_info(global_t
*globals
);
145 void acquire_all_info(global_t
*globals
);
147 #endif /* _WMACPI_H_ */