echo "Please user a root device or daily build device to catch the logs"
pause
:要求使用具有root 权限的daily版本手机,方便有权限抓取log
echo "\n"
echo "consumption: *************enviroment set bagain******************"
echo "0: Put the device in Airplane mode. Disable Wifi, BT, NFC, GPS, and Always On display to OFF."
pause
; 操作手机进入飞行模式,关闭蓝牙,wifi,nFC,GPS , 和常亮模式。
echo "1: Open kernel AP part log before test"
adb wait-for-device root
adb wait-for-device shell "echo 8 > /proc/sys/kernel/printk"
adb wait-for-device shell "echo on > /proc/sys/kernel/printk_devkmsg"
adb wait-for-device shell "echo 0 > /sys/module/qpnp_rtc/parameters/poweron_alarm"
adb wait-for-device shell "echo 1 > /sys/module/msm_show_resume_irq/parameters/debug_mask"
adb wait-for-device shell "echo 1 > /sys/kernel/debug/clk/debug_suspend"
adb wait-for-device shell "echo 0x2 > /sys/module/ipc_router_core/parameters/debug_mask"
echo "\n"
:设置kernel 相关属性值,确保能抓取较全的AP 睡眠信息。
echo "2. Check rpm status before sleep"
adb wait-for-device root
adb wait-for-device shell "cat /sys/power/system_sleep/stats" >> rpm_0.txt
adb wait-for-device shell "cat /sys/kernel/debug/rpm_stats ">> rpm_0.txt
adb wait-for-device shell "cat /sys/power/soc_sleep/stats " >> rpm_0.txt
adb wait-for-device shell "cat /sys/power/rpmh_sleep/master_stats " >> rpm_0.txt
adb wait-for-device shell "cat /sys/kernel/debug/rpm_master_stats " >> rpm_0.txt
adb wait-for-device shell "cat /sys/power/rpmh_stats/master_stats " >> rpm_0.txt
echo "\n"
: RPM 作为高通电源管理系统,他在睡眠前后的log 是很重要的,睡眠前需要抓取一份。
echo "3. echo value mem to autosleep"
adb wait-for-device shell "echo mem > /sys/power/autosleep"
echo "\n"
:让系统进入睡眠。
echo "4. Remove the USB cable immediately from the device , press pwrkey to screen off."
pause
echo "Wait for 10 minutes or more. Plug the USB cable back"
pause
echo "\n"
: 灭屏,拔掉USB , 等待10分钟之后确保睡眠所需时间。然后链接USB.
echo "5. check rpm status again after sleep"
adb wait-for-device root
adb wait-for-device shell "cat /sys/power/system_sleep/stats" >> rpm_1.txt
adb wait-for-device shell "cat /sys/kernel/debug/rpm_stats " >> rpm_1.txt
adb wait-for-device shell "cat /sys/power/soc_sleep/stats " >> rpm_1.txt
adb wait-for-device shell "cat /sys/power/rpmh_sleep/master_stats " >> rpm_1.txt
adb wait-for-device shell "cat /sys/kernel/debug/rpm_master_stats " >> rpm_1.txt
adb wait-for-device shell "cat /sys/power/rpmh_stats/master_stats " >> rpm_1.txt
echo "\n"
: RPM 作为高通电源管理系统,他在睡眠前后的log 是很重要的,睡眠需要抓取一份。
echo "6. check log, irq and wakeup source"
adb wait-for-device shell "cat /sys/kernel/debug/wakeup_sources" > wakeup_sources1.log
adb wait-for-device shell "cat /proc/interrupts" > interrupts.log
: 抓取内核唤醒源的信息。
adb wait-for-device shell "dumpsys power" > Wake_Lock.log
echo "\n"
:打印上层wake_lock.log 锁的事情
echo "7. last catch the bugreport log , logcat log,kmsg log,waitting........"
adb shell bugreportz
echo "8. please pull the bugreport zip files for debuger"
adb pull /data/user_de/0/com.android.shell/files/bugreports/
: 通过bugreportz 获取测试阶段log 状态。
echo "9. to catch next dmesg log and logcat log"
adb wait-for-device shell dmesg > dmesg.txt
adb wait-for-device shell logcat > logcat.txt
:作为补充,正常的kernel log 和 logcat log 补充抓取。
echo "10. provide all the files created by script to debuger"
注意点:
1.The device in Airplane mode. Disable Wifi, BT, NFC, GPS, and Always On display to OFF
---设备需要开启飞行模式,关闭蓝牙wifi, NRF,GPS等功能。
2. Backup battery:Charged full (Charge from main battery: off)
-----在配置小电池的项目手机上,需要额外注意要关闭“小电池充电”的内能,因为这个功能能阻塞内核进入深度睡眠
3. 测试样机要做过qcn动静态较准工作,不然手机灭屏后,mode 作为协议运行系统,是不能进行modem 子系统睡眠的(预计100ma)