高通 wlan 调试总结随笔
最近也分析了一个高通wifi,bt 没用的问题,
注意分析过程中,高度和硬件或射频同事保持密切联系,多去骚扰他们。
因为,高通wifi/bt 相关的,只要硬件及高通固件没问题,基本不会出现无功能的问题。
最终我这个问题也是终过射频同事确认,物料贴错了,导致wifi 功率起不来,
解决这个问题后,bt 的问题买一送一,连同wifi问题一并ok 了。
下面总结一些抓取wifi log 及调试的一些方法:
1. 进入ftm模式
射频同事调试wifi 时,需要进入ftm 模式,才能连接上QRCT 工具,进入ftm 模式有如下两种方法:
方法一:
adb root
adb remount
adb shell ifconfig wlan0 up
adb shell "echo 5 > sys/module/wlan/parameters/con_mode" (详细哪个目录不记得了,find 找下 con_mode_ftm 就好了)
adb shell ftmdaemon -n -dd
pause
方法二:
adb root && adb wait-for-devices
adb shell rmmod wlan
adb shell insmod /vendor/lib/modules/qca_cld3_wlan.ko con_mode_ftm=5
adb shell ifconifg wlan0 up
adb shell ftmdaemon -n -dd
有关ftm更多知识,也可以参考高通文档
《80-wl521-103_g_qca639x_wcn685x_wlan_software_user_guide.pdf》
《80-ya512-15_p_wlan_ftm_for_wcn39xx_tlv2_commands_user_guide.pdf》
《80-wl521-103_g_qca639x_wcn685x_wlan_software_user_guide.pdf》
《kba-170509183004_7_how_to_collect_wifi_logs_for_debug》
2. 抓取wifi log
2.1 抓取 Android log
2.1.1 How to enable wifi verbose log?
Goto Settings-> About Phone -> BuildNumber (Click this 10 times) to activate development options.
Goto Settings -> Develop Options -> Enable Wifi Verbose logging
adb shell logcat -v threadtime >logcat.txt
2.1.2 How to collect adb log and kernel log in one file?
adb shell logcat-v time -f /dev/kmsg | adbshell cat /proc/kmsg | tee kernel_logcat.txt
2.1.3 How to open wpa_supplicant debug log?
Run the following command before collect adb logs
wpa_cli ifname=wlan0 log_level debug
If failed to run above command on some platform, try command:
wpa_cli -iwlan0 -p /data/misc/wifi/sockets log_level DEBUG
enum {
MSG_EXCESSIVE, MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR
};
2.2 抓取 Tcpdump
tcpdump -i <interface> -vv -w <dump_file>
Ex: tcpdump -i wlan0 -vv -w tcpdump_000.pcap
2.3 抓取 wifi driver log & FW log - for WCN36xx
Snapdragon platform with WCN36xx chipset attached
Read doc 80-Y0513-2 , section 2.4.6
2.3.1 collect QXDM logs - for MSM8909
open QXDM
Press F1, pop up Log view windows
In Log view window, click right button
In popup menu, choose configure …, pop up configure window
In popup configure window, choose Message packets , in right column, select all WLAN options.
2.3.2 collect text format logs
-
make sure WCNSS_qcom_cfg.ini and cnss_diag.conf configured properly
Enable fw logging:gEnableFWLogging=1
Continuously send firmware logs to the host even if the host is suspended:
gEnableContFWLogging=1
-
make sure cnss_diag is running
cnss_diag -q -f
Then pull logs from/data/vendor/wifi/wlan_logs/
-
Log file size and archives. Set In
/data/misc/wifi/cnss_diag.conf
-
Open more logs
iwpriv wlan0 dump 211 32 1
//open more RA debug log
iwpriv wlan0 dump 13 6 6 1
//open more CxM log
2.4 抓取 wifi driver log & FW log - for WCN39xx
2.4.1 collect text format logs
-
make sure WCNSS_qcom_cfg.ini and cnss_diag.conf configured properly
WCNSS_qcom_cfg.ini : gEnablefwlog=1
// by default -
make sure cnss_diag is running
cnss_diag -q -f
Then pull logs from/data/vendor/wifi/wlan_logs/
-
Log file size and archives. Set In
/data/misc/wifi/cnss_diag.conf
, default config is
MAX_LOG_FILE_SIZE = 30
MAX_ARCHIVES = 2
-
Open more logs
Open more BTC logs:
adb shell iwpriv wlan0 setUnitTestCmd 4 2 11 1
adb shell iwpriv wlan0 setUnitTestCmd 4 2 12 1
2.5 抓取 wifi driver log & FW log - for QCA639x
Please refer the “2 WLAN logging” in " 80-wl521-103 qca639x_wlan_software_user_guid"
2.5.1 collect QXDM logs
-
Turn on the Wi-Fi once
MHI cannot be created unless an initial Wi-Fi is on -
Connect the device with a local machine
-
Create folders in /sdcard/
adb shell
cd sdcard
mkdir /diag_logs
cd diag_logs
mkdir /mdm2 -
Push the golden cfg to two folders
-
adb push Diag.cfg /sdcard/diag_logs/mdm2/Diag.cfg
(for WLAN FW) -
adb push Diag.cfg /sdcard/diag_logs/Diag.cfg
(for WLAN Host) -
To start logs:
adb shell "nohup diag_mdlog -j 5 -s 30 -n 3 &"
WLAN host file is created under mdm2/
WLAN FW file is created under/sdcard/diag_logs/[result location]/mdm2
"nohup" will prevent to kill the diag_mdlog process without USB connection
-s means the size of a file (MB).
-n means the total number of log files for each module -
Duplicate a Wi-Fi issue (with or without USB conection)
-
To stop logs:
adb shell diag_mdlog -k -j 5
-k means “kill” -
Pull logs from
/sdcard/diag_logs/[result location]/mdm2
2.5 Collect pktlog
2.5.1 Snapdragon platform with WCN39xx chipset attached
-
Force enable mode
Stop capturing the pktlog:iwpriv wlan0 pktlog 0 (to discard older logs)
Enable the pktlog:iwpriv wlan0 pktlog 1
Sleep <arbitrary time of preference>
Stop capturing the pktlog:iwpriv wlan0 pktlog 0
Take the snapshot of current pktlog in the buffer:cat /proc/ath_pktlog/cld > /data/<filename1>.dat
Pull the capture:adb pull /data/<filename1>.dat <filename2>.dat
Restore the pktlog to its original state:iwpriv wlan0 pktlog 2
-
Auto enable mode
INI parameter:gEnablePacketLog=1
Flush pktlog
Developer options -> Take bug report > Interactive report
. Once reporting the bugreport is done and
the device makes beep sound, the pktlog will be flushed and logged in/sdcard/wlan_logs
Or run"adb bugreport >bugreport.txt"
. Once reporting the bugreport is done and the device makes
beep sound, the pktlog will be flushed and logged in/sdcard/wlan_logs
Pktog file size and archives. In In
/data/misc/wifi/cnss_diag.conf
, default config is
MAX_PKTLOG_ARCHIVES = 4
MAX_PKTLOG_BUFFER = 10
2.5.1 Snapdragon platform with QCA639x chipset attached
Please refer the “2 WLAN logging” in " 80-wl521-103 qca639x_wlan_software_user_guid"
The pktlog disabled by default and need be collected manually
The pktlog is the primary source of debug for data path, system issues, and occasional control path issues
The pktlog instructions:
iwpriv wlan0 pktlog 3 10;
sleep 2;
// Run before testing
iwpriv wlan0 pktlog 1;
// Run after testing
iwpriv wlan0 pktlog 0;
cp /proc/ath_pktlog/cld /data/pktlog.dat
在 WCNSS_qcom_cfg.ini 中添加:
vosTraceEnableBAP=255
vosTraceEnableTL=255
vosTraceEnableWDI=255
vosTraceEnableHDD=255
vosTraceEnableSME=255
vosTraceEnablePE=255
vosTraceEnablePMC=255
vosTraceEnableWDA=255
vosTraceEnableSYS=255
vosTraceEnableVOSS=255
vosTraceEnableSAP=255
vosTraceEnableHDDSAP=255
wdiTraceEnableDAL=255
wdiTraceEnableCTL=255
wdiTraceEnableDAT=255
wdiTraceEnablePAL=255
wlanLoggingEnable=1g
EnableDebugLog=6g
EnableDhcpDebug=1
gEnableFWLogging=1
gEnableContFWLogging=1