0. 背景
问题表现是系统,系统关机状态下插入USB线,按power设备不能开机;
同时还有一个现象,关机插入USB充电状态下,拔掉USB,系统无法shut down;
log如下:
[ 153.742220] <<GTP-DBG>>[gt1x_power_switch:371]GTP power off.
[ 153.811749] <<GTP-INF>>[gt1x_suspend:2253] Suspend end...
[ 160.339053] healthd: battery l=58 v=3915 t=25.0 h=2 st=3 c=-896 fc=4200000 cc=0 chg=
[ 160.339335] charger: [160339] shutting down
[ 160.880636] charger: [160880] shutting down
[ 160.880787] charger: [160880] shutting down
[ 160.884019] charger: [160883] shutting down
[ 161.072181] charger: [161072] shutting down
[ 165.856121] charger: [165856] shutting down
[ 165.857443] charger: [165857] shutting down
[ 165.957515] charger: [165957] shutting down
[ 166.144330] charger: [166144] shutting down
[ 170.945760] charger: [170945] shutting down
[ 170.946590] charger: [170946] shutting down
[ 170.962459] charger: [170962] shutting down
[ 171.148936] charger: [171148] shutting down
[ 172.032289] healthd: battery l=58 v=3913 t=25.0 h=2 st=3 c=-896 fc=4200000 cc=0 chg=
[ 172.032574] charger: [172032] shutting down
[ 175.933014] charger: [175932] shutting down
[ 175.934499] charger: [175934] shutting down
[ 176.034951] charger: [176034] shutting down
[ 176.165505] charger: [176165] shutting down
[ 181.022700] charger: [181022] shutting down
[ 181.031062] charger: [181031] shutting down
[ 181.042673] charger: [181042] shutting down
[ 181.225727] charger: [181225] shutting down
[ 186.084580] charger: [186084] shutting down
[ 186.090749] charger: [186090] shutting down
[ 186.092509] charger: [186092] shutting down
[ 186.314631] charger: [186314] shutting down
[ 191.201524] charger: [191201] shutting down
[ 191.202926] charger: [191202] shutting down
[ 191.205084] charger: [191205] shutting down
[ 191.404970] charger: [191404] shutting down
1. 硬重启
其实这个并非无法重启,只是软重启功能失效,使用硬重启长按power健10几秒,是可以重启设备的;
如下修改可以把硬重启时间从10秒修改到2秒左右;
注意这两个时间不是随便填的,可以检索内核文档看看;
grep -nr "qcom,s1-timer" ./kernel/msm-4.9/Documentation/
vim ./kernel/msm-4.9/Documentation/devicetree/bindings/input/qpnp-power-on.txt +166
The below mentioned properties are required only when qcom,support-reset DT
property is defined and is set to 1.
- qcom,s1-timer The debounce timer for the BARK interrupt for
that reset source. Value is specified in ms.
Supported values are:
- 0, 32, 56, 80, 128, 184, 272, 408, 608, 904
1352, 2048, 3072, 4480, 6720, 10256
- qcom,s2-timer The debounce timer for the S2 reset specified
in ms. On the expiry of this timer, the PMIC
executes the reset sequence.
Supported values are:
- 0, 10, 50, 100, 250, 500, 1000, 2000
- qcom,s2-type The type of reset associated with this source.
The supported resets are:
SOFT(0), WARM(1), SHUTDOWN(4), HARD(7)
没有特殊的原因不要修改硬重启时间,原因是时间被改短了,本来开机之后,你按power键只是想唤醒下系统,结果直接重启了。当然,你要是一个项目没power健,比如用单片机控制,那当我没说-_-||。
2. 软重启解决
一般检查CAP_SYS_BOOT 权限有没有提供:
diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc
index f63db89..380772b 100644
--- a/rootdir/etc/init.qcom.rc
+++ b/rootdir/etc/init.qcom.rc
@@ -917,6 +917,7 @@ service charger /system/bin/charger
class charger
user system
group system graphics input
+ capabilities SYS_BOOT
seclabel u:r:charger:s0
我这个比较特殊,是人为修改出来的BUG,user 版本和debug版本走不同的init.qcom.rc ,
但是这个权限,之前的大兄弟忘了加,最终修改如下:
diff --git a/device/qcom/common/rootdir/etc/init.qcom.debug.rc
b/device/qcom/common/rootdir/etc/init.qcom.debug.rc
--- a/device/qcom/common/rootdir/etc/init.qcom.debug.rc
+++ b/device/qcom/common/rootdir/etc/init.qcom.debug.rc
@@ -922,6 +922,7 @@ service charger /system/bin/charger
class charger
user system
group system graphics input
+ capabilities SYS_BOOT
seclabel u:r:charger:s0
service vendor.ssr_diag /system/vendor/bin/ssr_diag
diff --git a/device/qcom/common/rootdir/etc/init.qcom.user.rc
b/device/qcom/common/rootdir/etc/init.qcom.user.rc
--- a/device/qcom/common/rootdir/etc/init.qcom.user.rc
+++ b/device/qcom/common/rootdir/etc/init.qcom.user.rc
@@ -925,6 +925,7 @@ service charger /system/bin/charger
class charger
user system
group system graphics input
+ capabilities SYS_BOOT
seclabel u:r:charger:s0