summaryrefslogtreecommitdiffstats
path: root/backend/battery_dummy.c
blob: baa31c1eb8a3d511a249da1d6e450abb09b5ed99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 *   Copyright (C) 2010 Michael Buesch <m@bues.ch>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation; either version 2
 *   of the License, or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 */

#include "battery_dummy.h"
#include "util.h"


static int battery_dummy_max_level(struct battery *b)
{
	return 0;
}

static void battery_dummy_destroy(struct battery *b)
{
	struct battery_dummy *bd = container_of(b, struct battery_dummy, battery);

	free(bd);
}

static struct battery * battery_dummy_probe(void)
{
	struct battery_dummy *bd;

	bd = zalloc(sizeof(*bd));
	if (!bd)
		return NULL;

	battery_init(&bd->battery, "dummy");
	bd->battery.destroy = battery_dummy_destroy;
	bd->battery.max_level = battery_dummy_max_level;

	return &bd->battery;
}

BATTERY_PROBE(dummy, battery_dummy_probe);
bues.ch cgit interface