#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/power_supply.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <generated/utsrelease.h>
enum test_power_id { … };
static int ac_online = …;
static int usb_online = …;
static int battery_status = …;
static int battery_health = …;
static int battery_present = …;
static int battery_technology = …;
static int battery_capacity = …;
static int battery_voltage = …;
static int battery_charge_counter = …;
static int battery_current = …;
static enum power_supply_charge_behaviour battery_charge_behaviour = …;
static bool module_initialized;
static int test_power_get_ac_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int test_power_get_usb_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int test_power_get_battery_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int test_power_battery_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static int test_power_set_battery_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static enum power_supply_property test_power_ac_props[] = …;
static enum power_supply_property test_power_battery_props[] = …;
static char *test_power_ac_supplied_to[] = …;
static struct power_supply *test_power_supplies[TEST_POWER_NUM];
static const struct power_supply_desc test_power_desc[] = …;
static const struct power_supply_config test_power_configs[] = …;
static int __init test_power_init(void)
{ … }
module_init(…) …;
static void __exit test_power_exit(void)
{ … }
module_exit(test_power_exit);
#define MAX_KEYLENGTH …
struct battery_property_map { … };
static struct battery_property_map map_ac_online[] = …;
static struct battery_property_map map_status[] = …;
static struct battery_property_map map_health[] = …;
static struct battery_property_map map_present[] = …;
static struct battery_property_map map_technology[] = …;
static int map_get_value(struct battery_property_map *map, const char *key,
int def_val)
{ … }
static const char *map_get_key(struct battery_property_map *map, int value,
const char *def_key)
{ … }
static inline void signal_power_supply_changed(struct power_supply *psy)
{ … }
static int param_set_ac_online(const char *key, const struct kernel_param *kp)
{ … }
static int param_get_ac_online(char *buffer, const struct kernel_param *kp)
{ … }
static int param_set_usb_online(const char *key, const struct kernel_param *kp)
{ … }
static int param_get_usb_online(char *buffer, const struct kernel_param *kp)
{ … }
static int param_set_battery_status(const char *key,
const struct kernel_param *kp)
{ … }
static int param_get_battery_status(char *buffer, const struct kernel_param *kp)
{ … }
static int param_set_battery_health(const char *key,
const struct kernel_param *kp)
{ … }
static int param_get_battery_health(char *buffer, const struct kernel_param *kp)
{ … }
static int param_set_battery_present(const char *key,
const struct kernel_param *kp)
{ … }
static int param_get_battery_present(char *buffer,
const struct kernel_param *kp)
{ … }
static int param_set_battery_technology(const char *key,
const struct kernel_param *kp)
{ … }
static int param_get_battery_technology(char *buffer,
const struct kernel_param *kp)
{ … }
static int param_set_battery_capacity(const char *key,
const struct kernel_param *kp)
{ … }
#define param_get_battery_capacity …
static int param_set_battery_voltage(const char *key,
const struct kernel_param *kp)
{ … }
#define param_get_battery_voltage …
static int param_set_battery_charge_counter(const char *key,
const struct kernel_param *kp)
{ … }
#define param_get_battery_charge_counter …
static int param_set_battery_current(const char *key,
const struct kernel_param *kp)
{ … }
#define param_get_battery_current …
static const struct kernel_param_ops param_ops_ac_online = …;
static const struct kernel_param_ops param_ops_usb_online = …;
static const struct kernel_param_ops param_ops_battery_status = …;
static const struct kernel_param_ops param_ops_battery_present = …;
static const struct kernel_param_ops param_ops_battery_technology = …;
static const struct kernel_param_ops param_ops_battery_health = …;
static const struct kernel_param_ops param_ops_battery_capacity = …;
static const struct kernel_param_ops param_ops_battery_voltage = …;
static const struct kernel_param_ops param_ops_battery_charge_counter = …;
static const struct kernel_param_ops param_ops_battery_current = …;
#define param_check_ac_online(name, p) …
#define param_check_usb_online(name, p) …
#define param_check_battery_status(name, p) …
#define param_check_battery_present(name, p) …
#define param_check_battery_technology(name, p) …
#define param_check_battery_health(name, p) …
#define param_check_battery_capacity(name, p) …
#define param_check_battery_voltage(name, p) …
#define param_check_battery_charge_counter(name, p) …
#define param_check_battery_current(name, p) …
module_param(ac_online, ac_online, 0644);
MODULE_PARM_DESC(…) …;
module_param(usb_online, usb_online, 0644);
MODULE_PARM_DESC(…) …;
module_param(battery_status, battery_status, 0644);
MODULE_PARM_DESC(…) …;
module_param(battery_present, battery_present, 0644);
MODULE_PARM_DESC(…) …;
module_param(battery_technology, battery_technology, 0644);
MODULE_PARM_DESC(…) …;
module_param(battery_health, battery_health, 0644);
MODULE_PARM_DESC(…) …;
module_param(battery_capacity, battery_capacity, 0644);
MODULE_PARM_DESC(…) …;
module_param(battery_voltage, battery_voltage, 0644);
MODULE_PARM_DESC(…) …;
module_param(battery_charge_counter, battery_charge_counter, 0644);
MODULE_PARM_DESC(…) …;
module_param(battery_current, battery_current, 0644);
MODULE_PARM_DESC(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;