本文主要是介绍解决android系统唤醒时间偏长------healthd里的一些调用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目前定位到healthd的调用过程耗时太长,于是去看看power相关的一些东西
healthd里一共调用了如下的节点获取数据
openat(AT_FDCWD, "/sys/class/power_supply/battery/present", 1 *******
openat(AT_FDCWD, "/sys/class/power_supply/battery/capacity",100 *****
openat(AT_FDCWD, "/sys/class/power_supply/battery/voltage_now", 4389402 ********
openat(AT_FDCWD, "/sys/class/power_supply/battery/temp", 291 ********
openat(AT_FDCWD, "/sys/class/power_supply/battery/status", Full
到kernel里找节点
Power_supply_sysfs.c里
static struct device_attribute power_supply_attrs[] = {
/* Properties of type `int' */
POWER_SUPPLY_ATTR(status),
看看#define POWER_SUPPLY_ATTR(_name) \
{ \
.attr = { .name = #_name }, \
.show = power_supply_show_property, \
.store = power_supply_store_property, \
}
然后看static ssize_t power_supply_show_property(struct device *dev,
struct device_attribute *attr,
char *buf)
这个里面调用了
if (off == POWER_SUPPLY_PROP_TYPE)
value.intval = psy->type;
else
ret = psy->get_property(psy, off, &value);
这个get_property需要在qpnp-vm-bms.c
static int qpnp_vm_bms_power_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{
switch (psp) {
case POWER_SUPPLY_PROP_CHARGE_NOW:
val->intval = get_remaining_usable_capacity(chip);
break;
}
这些的case都在power_supply.h
enum power_supply_property {
/* Properties of type `int' */
POWER_SUPPLY_PROP_STATUS = 0,
POWER_SUPPLY_PROP_CHARGE_TYPE,
POWER_SUPPLY_PROP_HEALTH,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_AUTHENTIC,
POWER_SUPPLY_PROP_CHARGING_ENABLED,
POWER_SUPPLY_PROP_TECHNOLOGY,
POWER_SUPPLY_PROP_CYCLE_COUNT,
POWER_SUPPLY_PROP_VOLTAGE_MAX,
POWER_SUPPLY_PROP_VOLTAGE_MIN,
POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_VOLTAGE_AVG,
POWER_SUPPLY_PROP_VOLTAGE_OCV,
POWER_SUPPLY_PROP_INPUT_VOLTAGE_REGULATION,
POWER_SUPPLY_PROP_CURRENT_MAX,
POWER_SUPPLY_PROP_INPUT_CURRENT_MAX,
POWER_SUPPLY_PROP_INPUT_CURRENT_TRIM,
POWER_SUPPLY_PROP_INPUT_CURRENT_SETTLED,
POWER_SUPPLY_PROP_VCHG_LOOP_DBC_BYPASS,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CURRENT_AVG,
POWER_SUPPLY_PROP_POWER_NOW,
POWER_SUPPLY_PROP_POWER_AVG,
如果找其中的一个比如POWER_SUPPLY_PROP_ONLINE
在kernel里搜索后只有在这几个文件里Qpnp-linear-charger.c 或者Smb358-charger.c 或者qpnp-vm-bms.c里找对应的
这篇关于解决android系统唤醒时间偏长------healthd里的一些调用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!