高通 wlan 調試總結隨筆

最近也分析了一個高通wifi,bt 沒用的問題,
注意分析過程中,高度和硬件或射頻同事保持密切聯繫,多去騷擾他們。
因爲,高通wifi/bt 相關的,只要硬件及高通固件沒問題,基本不會出現無功能的問題。

最終我這個問題也是終過射頻同事確認,物料貼錯了,導致wifi 功率起不來,
解決這個問題後,bt 的問題買一送一,連同wifi問題一併ok 了。

下面總結一些抓取wifi log 及調試的一些方法:

1. 進入ftm模式

射頻同事調試wifi 時,需要進入ftm 模式,才能連接上QRCT 工具,進入ftm 模式有如下兩種方法:

方法一:

adb root && adb wait-for-devices
adb shell echo 5 > sys/xxx/xx/xxx/con_mode_ftm    (詳細哪個目錄不記得了,find 找下 con_mode_ftm 就好了)
adb shell ifconifg wlan0 up
adb shell ftmdaemon -n -dd

方法二:

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

  1. 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


  1. make sure cnss_diag is running
    cnss_diag -q -f
    Then pull logs from /data/vendor/wifi/wlan_logs/

  2. Log file size and archives. Set In /data/misc/wifi/cnss_diag.conf

  3. 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

  1. make sure WCNSS_qcom_cfg.ini and cnss_diag.conf configured properly
    WCNSS_qcom_cfg.ini : gEnablefwlog=1 // by default

  2. make sure cnss_diag is running
    cnss_diag -q -f
    Then pull logs from /data/vendor/wifi/wlan_logs/

  3. Log file size and archives. Set In /data/misc/wifi/cnss_diag.conf, default config is
    MAX_LOG_FILE_SIZE = 30
    MAX_ARCHIVES = 2

  4. 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

  1. Turn on the Wi-Fi once
    MHI cannot be created unless an initial Wi-Fi is on

  2. Connect the device with a local machine

  3. Create folders in /sdcard/
    adb shell
    cd sdcard
    mkdir /diag_logs
    cd diag_logs
    mkdir /mdm2

  4. Push the golden cfg to two folders

  5. adb push Diag.cfg /sdcard/diag_logs/mdm2/Diag.cfg (for WLAN FW)

  6. adb push Diag.cfg /sdcard/diag_logs/Diag.cfg (for WLAN Host)

  7. 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

  8. Duplicate a Wi-Fi issue (with or without USB conection)

  9. To stop logs: adb shell diag_mdlog -k -j 5
    -k means “kill”

  10. Pull logs from /sdcard/diag_logs/[result location]/mdm2



2.5 Collect pktlog

2.5.1 Snapdragon platform with WCN39xx chipset attached

  1. 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

  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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章