zoukankan      html  css  js  c++  java
  • RK3288 手动设置电池电量

    参考:[RK3288][Android6.0] 调试笔记 --- 电池电量一直显示100%

    系统版本:RK3288 android 5.1 (与参考的变量和宏有点区别)

    设备没有电池,在进行Fota升级时,提示电量不能低于30%,外接电源,可是读出来的电量是0%,无法进行升级,只能手动设置电池电量。

    $ adb shell dumpsys battery  //通过adb查询电池信息
    Current Battery Service state:
      AC powered: false
      USB powered: false
      Wireless powered: false
      status: 1
      health: 1
      present: true
      level: 0  //电池电量
      scale: 100
      voltage: 0
      temperature: 0
      technology:

    diff --git a/system/core/healthd/BatteryMonitor.cpp b/system/core/healthd/BatteryMonitor.cpp
    old mode 100644
    new mode 100755
    index d317b28..6b37dee
    --- a/system/core/healthd/BatteryMonitor.cpp
    +++ b/system/core/healthd/BatteryMonitor.cpp
    @@ -35,7 +35,7 @@
     
     #define POWER_SUPPLY_SUBSYSTEM "power_supply"
     #define POWER_SUPPLY_SYSFS_PATH "/sys/class/" POWER_SUPPLY_SUBSYSTEM
    -#define FAKE_BATTERY_CAPACITY 42
    +#define FAKE_BATTERY_CAPACITY 100
     #define FAKE_BATTERY_TEMPERATURE 424
     
     namespace android {
    @@ -513,8 +513,14 @@ void BatteryMonitor::init(struct healthd_config *hc) {
             closedir(dir);
         }
     
    -    if (!mChargerNames.size())
    +    if (!mChargerNames.size())  {
             KLOG_ERROR(LOG_TAG, "No charger supplies found
    ");
    +               /*------------电池电量一直显示100%------------*/
    +               mBatteryFixedCapacity = FAKE_BATTERY_CAPACITY;    //电量 level
    +               mBatteryFixedTemperature = FAKE_BATTERY_TEMPERATURE;    //温度 temperature
    +               mBatteryDevicePresent = true;
    +               /*------------------------------------------------*/
    +       }
         if (!mBatteryDevicePresent) {
             KLOG_WARNING(LOG_TAG, "No battery devices found
    ");
             hc->periodic_chores_interval_fast = -1;

    $ adb shell dumpsys battery
    Current Battery Service state:
      AC powered: false
      USB powered: false
      Wireless powered: false
      status: 1
      health: 1
      present: true
      level: 100  //电池电量
      scale: 100
      voltage: 0
      temperature: 424
      technology:

  • 相关阅读:
    java 放射机制简介
    java 放射机制简介
    后海日记(1)
    后海日记(1)
    java 发邮件 代码
    java 发邮件 代码
    hadoop学习笔记411
    hadoop学习笔记411
    swoole_table
    用swoole简单实现MySQL连接池
  • 原文地址:https://www.cnblogs.com/lialong1st/p/8276042.html
Copyright © 2011-2022 走看看