1 /* ----------------------------------------------------------------------- *
3 * Pportions of this file taken from the dmidecode project
5 * Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
6 * Copyright (C) 2002-2008 Jean Delvare <khali@linux-fr.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * For the avoidance of doubt the "preferred form" of this code is one which
23 * is in an open unpatent encumbered format. Where cryptographic key signing
24 * forms part of the process of creating an executable the information
25 * including keys needed to generate an equivalently functional executable
26 * are deemed to be part of the source code.
31 const char *dmi_battery_chemistry(uint8_t code
)
34 static const char *chemistry
[] = {
39 "Nickel Metal Hydride",
42 "Lithium Polymer" /* 0x08 */
45 if (code
>= 0x01 && code
<= 0x08)
46 return chemistry
[code
- 0x01];
50 void dmi_battery_capacity(uint16_t code
, uint8_t multiplier
, char *capacity
)
53 sprintf(capacity
, "%s", "Unknown");
55 sprintf(capacity
, "%u mWh", code
* multiplier
);
58 void dmi_battery_voltage(uint16_t code
, char *voltage
)
61 sprintf(voltage
, "%s", "Unknown");
63 sprintf(voltage
, "%u mV", code
);
66 void dmi_battery_maximum_error(uint8_t code
, char *error
)
69 sprintf(error
, "%s", "Unknown");
71 sprintf(error
, "%u%%", code
);