4
* Copyright 2009 Juergen Hötzel <juergen@archlinux.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
28
#define ACPI_PATH_SYS_POWER_SUPPY "/sys/class/power_supply"
29
#define MIN_CAPACITY 0.01
30
#define MIN_PRESENT_RATE 0.01
31
#define BATTERY_DESC "Battery"
35
typedef struct battery {
37
/* path to battery dir */
39
/* sysfs file contents */
45
int charge_full_design;
46
int energy_full_design;
52
char *state, *poststr;
57
battery *battery_get();
58
battery *battery_update( battery *b );
59
void battery_print(battery *b, int show_capacity);
60
gboolean battery_is_charging( battery *b );
61
gint battery_get_remaining( battery *b );
62
void battery_free(battery* bat);