MTK平台 如何用adb控制MTKLogger/DebugLoggerUI (Q0之后更名)

文摘 无标签 2020-02-3 阅读:13488

android_Q.jpg


[DESCRIPTION]
如何通过adb command去控制MTKLogger 开关DebugLoggerUI (Q0之后更名),设定log路径等等。

[KEYWORD]
MTKLogger DebugLoggerUI adb控制 路径 大小

[SOLUTION]
Q0版本之前:

  1. 开启/关闭
  2. shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name start/stop --ei cmd_target 23

(start表示开启,stop表示关闭;23可改为1/2/4/16,分别代表MobileLog/ModemLog/NetworkLog/GPSLog)

  1. 获取开关状态
  2. shell getprop debug.MB.running

adb shell getprop debug.mdlogger.Running
adb shell getprop debug.mtklog.netlog.Running

  1. 控制Tag Log
    Enable Taglog:

adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_taglog --ei cmd_target 1
Disable Taglog:
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_taglog --ei cmd_target 0
Trigger taglog:
adb shell am broadcast -a com.mediatek.log2server.EXCEPTION_HAPPEND -e path SaveLogManually -e db_filename yourInputTagName

  1. 修改log存储路径
  2. shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_logpath -e cmd_target external_sd

——————————————————————————————————————————————————
adb shell setprop persist.mtklog.log2sd.path logpath
JB版本前logpath为:
/mnt/sdcard 内置sd卡
/mnt/sdcard2 外置sd卡
需要做stop/start MTKLogger才能生效

JB版本后logpath为:
internal_sd 内置sd卡
external_sd 外置sd卡

    1. 显示MTKLogger主界面
    1. shell am start -n com.mediatek.mtklogger/com.mediatek.mtklogger.MainActivity
    2. Taglog开启/关闭
    3. shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_taglog --ei cmd_target 0/1

    (0表示关,1表示开)

    1. 切换Mdlog录制模式为USB/SD/Passive Log to SD
    2. shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_modem_log_mode --ei cmd_target 1/2/3

    (1表示USB模式,2表示SD模式, 3表示Passive Log to SD模式)
    M:
    adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_modem_log_mode_mode --ei cmd_target mdtype
    Mode = 1/2/3 -> Usb/sd/pst
    Mdtype = 1, 3 -> md1/md3

    1. 开机自启动开启/关闭
    2. shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name set_auto_start_1/set_auto_start_0 --ei cmd_target 23

    (set_auto_start_1表示开启开机自启动,set_auto_start_0表示关闭开机自启动;
    23可改为1/2/4/16,分别代表MobileLog/ModemLog/NetworkLog/GPSLog)

    1. 设置Limit Current Log Size (JB版本以后生效)
    2. shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name set_log_size_300 --ei cmd_target 7

    (set_log_size_300 可更改为其他合适值如set_log_size_600)
    (7可改为1/2/4,分别代表MobileLog/ModemLog/NetworkLog,这里mobilelog 目录大小指的是mtklog/mobilelog下单个APLog的大小;其他modemlog Netlog等都是指的mtklog/下 mdlog netlog等的总大小)

    1. 设置Mobile Limit Total Log Size (JB版本以后生效)
    2. shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name set_total_log_size_600 --ei cmd_target 1

    (只针对mobilelog 有效,最后一位1不可更改;这里设置的是mtklog/mobilelog的总大小)
    11.设置MTKLOGGER Show Notification
    adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name show_notification_1/0 --ei cmd_target -1
    (show_notification_1/0 打开或关闭状态栏显示)

    1. 清除所有log clear_all_log(N版本)
    2. shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name clear_all_logs

    Q0版本之后:
    通过配置文件配置
    配置文件路径:
    编译之前通过 mtklog-config-bsp-eng.prop && mtklog-config-bsp-user.prop 文件配置 DebugLoggerUI 的默认值
    文件路径: devicemediatekcommonmtklog\
    mtklog-config-bsp-eng.prop 控制eng版本
    mtklog-config-bsp-user.prop 控制user 和userdebug版本
    配置log的默认路径
    Configure contents:
    mtklog_path = internal_sd/external_sd
    internal_sd : Phone storage (Default value)
    external_sd : Portable stroage
    com.mediatek.log.mobile.path = detail_path
    com.mediatek.log.modem.path = detail_path
    com.mediatek.log.network.path = detail_path
    com.mediatek.log.connsysfw.path = detail_path
    com.mediatek.log.gpshost.path = detail_path
    com.mediatek.log.bthost.path = detail_path
    如果detail_path没有设定则默认使用,"mtklog_path" .
    配置第一次开机自启的log类型
    类似:
    com.mediatek.log.mobile.enabled = true
    com.mediatek.log.modem.enabled = true
    com.mediatek.log.net.enabled = true
    com.mediatek.log.connsysfw.enabled = true
    com.mediatek.log.gpshost.enabled = true
    com.mediatek.log.bthost.enabled = true
    eng版本默认第一次开机都启动,其他版本默认不启动,可自行配置。
    配置log循环录制大小
    类似:
    com.mediatek.log.mobile.maxsize = 500
    Single mobile log folder size
    com.mediatek.log.mobile.totalmaxsize = 1000
    Total mobile log size
    com.mediatek.log.modem.maxsize = 2000
    com.mediatek.log.net.maxsize =600
    com.mediatek.log.connsysfw.maxsize = 2000
    com.mediatek.log.bthost.maxsize = 2000
    配置的log缓存大小会循环存储,即当存储达到最大值时,如果有新log就会把前面的旧log覆盖掉.
    配置mobile log中的子项
    类似:
    com.mediatek.log.mobile.AllMode = true
    Set all mobile sub log if the detail type mobile sub log is not set
    com.mediatek.log.mobile.AndroidLog = true
    com.mediatek.log.mobile.KernelLog = true
    com.mediatek.log.mobile.SCPLog = true
    com.mediatek.log.mobile.ATFLog = true
    com.mediatek.log.mobile.BSPLog = true
    com.mediatek.log.mobile.MmediaLog = true
    com.mediatek.log.mobile.SSPMLog = true
    com.mediatek.log.mobile.ADSPLog = true
    如果mobile log子项没有设定,则默认使用 “com.mediatek.log.mobile.AllMode” 的设定值.
    其他配置
    配置开启TagLog。
    com.mediatek.log.taglog.enabled = true
    默认值 : eng版本默认为trueo其他为false。
    配置当发生EE时,modem log是否自动重启。
    com.mediatek.log.modem.autoreset.enabled = false
    Default value is false
    A warning dialog will be shown if it is false
    配置modem Log默认启动模式
    com.mediatek.log.modem.mode = 2
    1: usb mode, 2 : sdcard mode, 3: pls mode
    Default value is 2
    配置使用adb 命令操作 DebugLoggerUI
    1.启动和停止
    命令格式:adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name value --ei cmd_target logTypes -n com.debug.loggerui/.framework.LogReceiver
    value = start/stop
    logTypes = 1 + 2 + 4 + 16 + 32 + 64
    (MobileLog : 1, ModemLog : 2, NetworkLog : 4, GPSLog : 16, ConnsysFWLog : 32, BTHostLog : 64)

    例1 : 开启所有log : adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name start --ei cmd_target -1 -n com.debug.loggerui/.framework.LogReceiver
    Start all logs command : adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name start --ei cmd_target 119 -n com.debug.loggerui/.framework.LogReceiver
    例2 : 停止ModemLog & NetworkLog : adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name stop --ei cmd_target 6 -n com.debug.loggerui/.framework.LogReceiver
    注意: 启动和停止命令需要间隔15s的时间。
    2.查询log运行状态
    命令格式: adb shell getprop logstatusproperty
    log status result : running with "1", stop with "0"
    其中logstatusproperty可以为如下值:
    logstatusproperty of mobile : vendor.MB.running
    logstatusproperty of modem log : vendor.mdlogger.Running
    logstatusproperty of network log : vendor.mtklog.netlog.Running
    logstatusproperty of GPSLog : vendor.gpsdbglog.enable
    logstatusproperty of BTHost log : vendor.bthcisnoop.running
    logstatusproperty of ConnsysFW log : vendor.connsysfw.running
    例1 : 获取mobile log的状态 : adb shell getprop vendor.MB.running

    1. 重启log命令
      命令格式 :

    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name restart --ei cmd_target logTypes -n com.debug.loggerui/.framework.LogReceiver
    logTypes = 1 + 2 + 4 + 16 + 32 + 64 (MobileLog:1,ModemLog:2,NetworkLog:4,GPSLog:16,ConnsysFWLog:32,BTHostLog:64)
    logTypes = -1 (all logs)
    例如:只启动mobile log.
    命令 : adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name restart --ei cmd_target -1 -n com.debug.loggerui/.framework.LogReceiver
    结果: only mobile restart
    4.设置是否显示modem EE内存转储完成对话框
    命令格式:
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name modem_auto_reset_value --ei cmd_target 2 -n com.debug.loggerui/.framework.LogReceiver
    value = 1/0 (Enable/Disabled)
    例如 : Display modem EE memory dump done dialog :
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name modem_auto_reset_1 --ei cmd_target 2 -n com.debug.loggerui/.framework.LogReceiver
    5.设置modem log模式
    命令格式:
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name switch_modem_log_mode_value --ei cmd_target modemtype -n com.debug.loggerui/.framework.LogReceiver
    value = 1/2/3 (USB/SD/PLS)
    modemtype = 1/3 (md1/md3)
    例 : Set Modem1 Mode to SD command : adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name switch_modem_log_mode_2 --ei cmd_target 1 -n com.debug.loggerui/.framework.LogReceiver
    6.手动触发EE
    命令格式 :
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name force_modem_assert --ei cmd_target 2 -n com.debug.loggerui/.framework.LogReceiver

    1. 开启/关闭Taglog
      命令格式:

    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name switch_taglog --ei cmd_target value -n com.debug.loggerui/.framework.LogReceiver
    value = 1/0 (Enable/disable)
    例 : enable taglog command :
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name switch_taglog --ei cmd_target 1 -n com.debug.loggerui/.framework.LogReceiver
    8.触发Taglog
    命令格式 :
    adb shell am broadcast -a com.mediatek.log2server.EXCEPTION_HAPPEND -e path SaveLogManually -e db_filename yourFileName --ez is_need_zip needZipValue --ez is_need_all_logs needAllLogValue -n com.debug.loggerui/.framework.LogReceiver
    yourFileName can be define by yourself
    needZipValue = true/false (zip file/ not zip file)
    needAllLogValue = true/false (tag all log from mtklog foler/ not tag all log)
    例: tigger taglog zip current log command :
    adb shell am broadcast -a com.mediatek.log2server.EXCEPTION_HAPPEND -e path SaveLogManually -e db_filename test --ez is_need_zip true --ez is_need_all_logs false -n com.debug.loggerui/.framework.LogReceiver
    9.显示DebugLoggerUI 主界面
    Start DebugLoggerUI Activity command : adb shell am start -n com.debug.loggerui/com.debug.loggerui.MainActivity
    10.设置log大小
    1) 设置mobile log size大小
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name set_total_log_size_600 --ei cmd_target 1 -n com.debug.loggerui/.framework.LogReceiver
    2) 设置 modem log size 大小:
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name set_log_size_600 --ei cmd_target 2 -n com.debug.loggerui/.framework.LogReceiver
    3) 设置network log size大小:
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name set_log_size_200 --ei cmd_target 4 -n com.debug.loggerui/.framework.LogReceiver
    4) 设置 moble log 中单个APLog 文件夹大小
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name set_log_size_300 --ei cmd_target 1 -n com.debug.loggerui/.framework.LogReceiver

    1. 设置Mobile 中子项的使能:
      命令格式:

    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name set_sublog_type1_type2_... typen_value --ei cmd_target 1 -n com.debug.loggerui/.framework.LogReceiver
    value = 1/0 (enable/disabled)
    type1_type2_...typen = 1_2_..._8
    UB_LOG_TYPE_ANDROID = 1
    UB_LOG_TYPE_KERNEL = 2;
    UB_LOG_TYPE_SCP = 3;
    UB_LOG_TYPE_ATF = 4;
    UB_LOG_TYPE_BSP = 5;
    UB_LOG_TYPE_MMEDIA = 6;
    UB_LOG_TYPE_SSPM = 7;
    UB_LOG_TYPE_ADSP =8
    例: 开启 Android Log & Kernel Log & BSP Log & Mmedia Log 命令:
    adb shell am broadcast -a com.debug.loggerui.ADB_CMD -e cmd_name set_sublog_1_2_5_6_1 --ei cmd_target 1 -n com.debug.loggerui/.framework.LogReceiver

    0条评论

    © 2024 芯缘异码. Powered by Typecho