点击打开链接
0.主要流程
usb插入通过传递cmdline给init解析从而启动充电进程
1. LK
lk\app\aboot\aboot.c
update_cmdline
----------
if (boot_into_ffbm)
{
cmdline_len += strlen(androidboot_mode);
cmdline_len += strlen(ffbm_mode_string);
cmdline_len += strlen(loglevel);
}
else if (target_pause_for_battery_charge())
{
pause_at_bootup = 1;
cmdline_len += strlen(battchg_pause);
}
----------
else if (pause_at_bootup)
{
src = battchg_pause;
if (have_cmdline) --dst;
while ((*dst++ = *src++));
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
2.init
if (!is_ffbm)
is_charger = !strcmp(bootmode, "charger");
----------
if (is_charger)
action_for_each_trigger("charger", action_add_queue_tail);
on charger
class_start charger
----------
service charger /charger
class charger
----------
LOCAL_MODULE := healthd
...
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21