[Share Experiences] Realtek Bluetooth Android 10.0 Porting: Basic Testing and Issues
Experiences and Insight 183 views · 0 replies ·
SuperDavid
deepin
2024-09-12 16:56
Author
Realtek Bluetooth Android 10.0 Porting: Basic Testing and Common Issues Analysis
Basic Testing
Basic testing primarily includes configuration checks and Bluetooth (BT) tests.
Configuration Checks:
To ensure there are no issues with the porting, confirm the firmware (fw) and configuration (config) files are present before testing. Use adb shell to access the root directory of the test platform and check if the rtlxxxx_fw and rtlxxxx_config files are present in the vendor/firmware/ directory (xxxx represents the BT chip model). Verify if the files in the rtkbt/ directory from the release package are installed in their respective directories.
BT Testing:
This test is a quick check of basic and commonly used BT functions after porting. It aims to quickly identify basic issues and does not represent a comprehensive BT test. The results are not considered an official test report. If a non-Realtek BT chip is used, this test may be irrelevant.
Basic Functional Tests:
Turn BT on/off without any failures.
Detect nearby BT devices.
Pair with detected BT headsets or other devices.
Connect to a BT headset and use BT A2DP to play music (ensure sdcard is present).
Connect to a BT headset and use BT HFP/HSP for calls (ensure normal call functionality via Bluetooth).
Transfer files to a remote device supporting Bluetooth OPP Server and receive files from a device supporting Bluetooth OPP client (ensure sdcard is present).
Connect to a BT keyboard, open an application requiring input, and input using the BT keyboard.
If you encounter BT issues, provide the corresponding BT problem report logs. Insufficient log information may hinder issue resolution. Ensure you know how to capture the following BT logs.
Bluetooth Log Configuration Files:
Bluetooth configuration files are stored in /system/etc/bluetooth/bt_stack.conf. They can be modified via adb. The default configuration file is as follows:
Enable trace level reconfiguration function
Must be present before any TRC_ trace level settings
TraceConf=true
# Trace level configuration# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated )# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages )# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages )# BT_TRACE_LEVEL_API 3 ( API traces )# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events )# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages )# BT_TRACE_LEVEL_VERBOSE 6 ( Verbose messages ) - Currently supported for
TRC_BTAPP only.
TRC_BTM=2
TRC_HCI=2
TRC_L2CAP=2
TRC_RFCOMM=2
TRC_OBEX=2
TRC_AVCT=2
TRC_AVDT=2
TRC_AVRC=2
TRC_AVDT_SCB=2
TRC_AVDT_CCB=2
TRC_A2D=2
TRC_SDP=2
TRC_GATT=2
TRC_SMP=2
TRC_BTAPP=2
TRC_BTIF=2
TRC_GAP=2
TRC_BNEP=2
TRC_PAN=2
TRC_HID_HOST=2
TRC_HID_DEV=2
Logcat –v time:
When capturing logs, add the -v time option. Without it, logs cannot correlate with the issue's timestamp, making log analysis challenging. Before testing, enable logs and import them into a partition on the device. After testing, export the logs via adb or sdcard.
BtSnoop:
Enable btsnoop recording by setting persist.bluetooth.btsnooplogmode to full and the save path to persist.bluetooth.btsnooppath. Toggle Bluetooth on/off to apply changes. After encountering an issue, quickly export the btsnoop file using adb or sdcard without toggling Bluetooth or restarting the device.
Get Bluetooth Process Information:
Run adb shell dumpsys bluetooth_manager > xxx.log to obtain BT process information.
Important Notes:
When reporting BT issues, provide at least the following information:
logcat -v time
btsnoop
Bluetooth process information
The exact time of the issue (based on device time)
Steps to reproduce the issue
Common Issues Analysis
BT Fails to Turn On (UART):
Enable H5 UART Driver Log and capture logs using logcat. Check if the H5 SYNC process is successful. If H5 SYNC fails, first check hardware circuits (Power Supply, BT Reset PIN, UART TX/RX, CTS/RTS) and then the card's efuse. Use an oscilloscope to measure UART waveform to ensure the Host correctly sends data to the Controller.
If H5 SYNC is successful, proceed to Change Baudrate. Determine if the Change Baudrate is successful. If it fails, confirm if the Host supports the baud rate and if the config file correctly sets the baud rate.
If the Change Baudrate is successful, download the fw and config files. If the Controller does not respond with Command Complete Event after downloading, verify the fw and config files and ensure the BT Reset PIN is high.
If the download is successful, modify HW Flowcontrol settings as per the config file. Once set, the bluedroid stack sends the first HCI Command. If the first HCI Command continuously retransmits H5, HW flowcontrol may have issues, requiring checking if the Host's UART driver supports HW Flowcontrol.
BT Fails to Turn On (USB):
Capture logs while turning on Bluetooth and search for "dev/bus/usb". If you see logs like Added device UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=3034,mProductId=46880,mClass=239,mSubclass=2, check if mVendorId and mProductId match the Bluetooth chip. If not, ensure the hardware circuit is correct.
Check if the USB driver loads correctly. Log in to the platform (adb shell) and use lsmod to check for rtk_btusb.ko.
Realtek Bluetooth Android 10.0 Porting: Basic Testing and Common Issues Analysis
Basic Testing
Basic testing primarily includes configuration checks and Bluetooth (BT) tests.
Configuration Checks:
To ensure there are no issues with the porting, confirm the firmware (fw) and configuration (config) files are present before testing. Use
adb shell
to access the root directory of the test platform and check if thertlxxxx_fw
andrtlxxxx_config
files are present in thevendor/firmware/
directory (xxxx represents the BT chip model). Verify if the files in thertkbt/
directory from the release package are installed in their respective directories.BT Testing:
This test is a quick check of basic and commonly used BT functions after porting. It aims to quickly identify basic issues and does not represent a comprehensive BT test. The results are not considered an official test report. If a non-Realtek BT chip is used, this test may be irrelevant.
Basic Functional Tests:
If you encounter BT issues, provide the corresponding BT problem report logs. Insufficient log information may hinder issue resolution. Ensure you know how to capture the following BT logs.
Bluetooth Log Configuration Files:
Bluetooth configuration files are stored in
/system/etc/bluetooth/bt_stack.conf
. They can be modified via adb. The default configuration file is as follows:Enable trace level reconfiguration function
Must be present before any TRC_ trace level settings
TraceConf=true
# Trace level configuration# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated )# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages )# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages )# BT_TRACE_LEVEL_API 3 ( API traces )# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events )# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages )# BT_TRACE_LEVEL_VERBOSE 6 ( Verbose messages ) - Currently supported for
TRC_BTAPP only.
TRC_BTM=2
TRC_HCI=2
TRC_L2CAP=2
TRC_RFCOMM=2
TRC_OBEX=2
TRC_AVCT=2
TRC_AVDT=2
TRC_AVRC=2
TRC_AVDT_SCB=2
TRC_AVDT_CCB=2
TRC_A2D=2
TRC_SDP=2
TRC_GATT=2
TRC_SMP=2
TRC_BTAPP=2
TRC_BTIF=2
TRC_GAP=2
TRC_BNEP=2
TRC_PAN=2
TRC_HID_HOST=2
TRC_HID_DEV=2
Logcat –v time:
When capturing logs, add the
-v time
option. Without it, logs cannot correlate with the issue's timestamp, making log analysis challenging. Before testing, enable logs and import them into a partition on the device. After testing, export the logs via adb or sdcard.BtSnoop:
Enable btsnoop recording by setting
persist.bluetooth.btsnooplogmode
tofull
and the save path topersist.bluetooth.btsnooppath
. Toggle Bluetooth on/off to apply changes. After encountering an issue, quickly export the btsnoop file using adb or sdcard without toggling Bluetooth or restarting the device.Get Bluetooth Process Information:
Run
adb shell dumpsys bluetooth_manager > xxx.log
to obtain BT process information.Important Notes:
When reporting BT issues, provide at least the following information:
logcat -v time
Common Issues Analysis
BT Fails to Turn On (UART):
Enable H5 UART Driver Log and capture logs using logcat. Check if the H5 SYNC process is successful. If H5 SYNC fails, first check hardware circuits (Power Supply, BT Reset PIN, UART TX/RX, CTS/RTS) and then the card's efuse. Use an oscilloscope to measure UART waveform to ensure the Host correctly sends data to the Controller.
If H5 SYNC is successful, proceed to Change Baudrate. Determine if the Change Baudrate is successful. If it fails, confirm if the Host supports the baud rate and if the config file correctly sets the baud rate.
If the Change Baudrate is successful, download the fw and config files. If the Controller does not respond with Command Complete Event after downloading, verify the fw and config files and ensure the BT Reset PIN is high.
If the download is successful, modify HW Flowcontrol settings as per the config file. Once set, the bluedroid stack sends the first HCI Command. If the first HCI Command continuously retransmits H5, HW flowcontrol may have issues, requiring checking if the Host's UART driver supports HW Flowcontrol.
BT Fails to Turn On (USB):
Capture logs while turning on Bluetooth and search for "dev/bus/usb". If you see logs like
Added device UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=3034,mProductId=46880,mClass=239,mSubclass=2
, check if mVendorId and mProductId match the Bluetooth chip. If not, ensure the hardware circuit is correct.Check if the USB driver loads correctly. Log in to the platform (adb shell) and use
lsmod
to check forrtk_btusb.ko
.