高通平台关机充电直接开机
修改文件及记录如下:
bootable/bootloader/lk/app/aboot/aboot.c
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 2419b95..855f685 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -537,6 +537,8 @@ unsigned char *update_cmdline(const char * cmdline)
if(is_mdtp_activated)
cmdline_len += strlen(mdtp_activated_flag);
#endif
+
+ dprintf(DEBUG, "UpdateCmdLine ====== device.charger_screen_enabled ============= %d\n",device.charger_screen_enabled);
if (boot_into_ffbm) {
cmdline_len += strlen(androidboot_mode);
@@ -548,7 +550,8 @@ unsigned char *update_cmdline(const char * cmdline)
cmdline_len += strlen(loglevel);
} else if (boot_reason_alarm) {
cmdline_len += strlen(alarmboot_cmdline);
- } else if (target_pause_for_battery_charge() && !boot_into_recovery) {
+ /* modify by hhm for ID1086449 on 2021-10-11*/
+ } else if (device.charger_screen_enabled && target_pause_for_battery_charge() && !boot_into_recovery) {
pause_at_bootup = 1;
cmdline_len += strlen(battchg_pause);
}
除此修改之外,debug版本也可以通过fastboot指令实现此功能
fastboot 指令主要通过修改charger_screen_enabled。相关代码块如下,有兴趣可以研究下
fastboot oem enable-charger-screen 打开关机充电功能
fastboot oem disable-charger-screen 关闭关机充电功能
struct fastboot_cmd_desc cmd_list[] = {
/* By default the enabled list is empty. */
{
"", NULL},
/* move commands enclosed within the below ifndef to here
* if they need to be enabled in user build.
*/
#ifndef DISABLE_FASTBOOT_CMDS
/* Register the following commands only for non-user builds */
{
"flash:", cmd_flash},
{
"erase:", cmd_erase},
{
"boot", cmd_boot},
{
"continue", cmd_continue},
{
"reboot", cmd_reboot},
{
"reboot-bootloader", cmd_reboot_bootloader},
{
"oem unlock", cmd_oem_unlock},
{
"oem unlock-go", cmd_oem_unlock_go},
{
"oem lock", cmd_oem_lock},
{
"flashing unlock", cmd_oem_unlock},
{
"flashing lock", cmd_oem_lock},
{
"flashing lock_critical", cmd_flashing_lock_critical},
{
"flashing unlock_critical", cmd_flashing_unlock_critical},
{
"flashing get_unlock_ability", cmd_flashing_get_unlock_ability},
{
"oem device-info", cmd_oem_devinfo},
{
"preflash", cmd_preflash},
{
"oem enable-charger-screen", cmd_oem_enable_charger_screen},
{
"oem disable-charger-screen", cmd_oem_disable_charger_screen},
{
"oem off-mode-charge", cmd_oem_off_mode_charger},
{
"oem select-display-panel", cmd_oem_select_display_panel},
{
"set_active",cmd_set_active},
#if DYNAMIC_PARTITION_SUPPORT
{
"reboot-fastboot",cmd_reboot_fastboot},
{
"reboot-recovery",cmd_reboot_recovery},
#endif
#if UNITTEST_FW_SUPPORT
{
"oem run-tests", cmd_oem_runtests},
#endif
#endif
};
void cmd_oem_enable_charger_screen(const char *arg, void *data, unsigned size)
{
dprintf(INFO, "Enabling charger screen check\n");
device.charger_screen_enabled = 1;
write_device_info(&device);
fastboot_okay("");
}
void cmd_oem_disable_charger_screen(const char *arg, void *data, unsigned size)
{
dprintf(INFO, "Disabling charger screen check\n");
device.charger_screen_enabled = 0;
write_device_info(&device);
fastboot_okay("");
}