bluetooth overview for android QC

本文详细介绍了Android设备中蓝牙启动的全过程,从UI设置到内核模块加载,再到蓝牙SoC初始化,最后到BlueZ软件栈配置。文章还探讨了不同状态下的蓝牙设备唤醒机制,并提供了相关代码路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



BlueZ Startup Procedure (Host BlueZ (Android Bluetooth host stack) )


Call flow on enabling/disabling Bluetooth in UI settings → Wireless control
Functions bt_enable, bt_disable in android/system/bluetooth/
bluedroid/bluetooth.c are entry points to enable/disable Bluetooth
■ Related services are declared in android/system/core/rootdir/
   etc/init.qcom.rc
■ Modify arguments for hci_qcomm_init in android/system/core/rootdir/
   etc/init.qcom.bt.sh for your platform dependency
■ Bttest test tool enables/disables Bluetooth device

bttest enable and bttest disable commands in ADB shell
Reference source code – android/system/bluetooth/bluedroid/bttest.c

Startup scripts
/etc/init.qcom.rc and /etc/init.qcom.bt.sh are scripts for Android Bluetooth startup
procedure

Bluetooth SoC Initialization – hci_qcomm_init (cont.)

Code flow of hci_qcomm_init application

1.bt_hci_pfal_init_uart("/dev/ttyHS0")
Open UART device as /dev/ttyHS0
b. Set flow control attributes
c. Set baud rate as 115200 bps; later, speed is changed to 3.0 Mbps for data transfer

2.bt_hci_qcomm_init()
a.  Set NVM tags according to hardware reference clock and clock-sharing features
c. Download NVM tags using vendor-specific HCI command
d. Set baud rate as 460800 bps, or 3.0 Mbps for HS-UART
e. Initialize by sending vendor-specific HCI command to Bluetooth SoC
Reset HCI command to start with new NVM tags

hciattach – Register BlueZ TTY line discipline driver and set UART protocol to
interface between UARTDM and BlueZ kernel module
Set up BlueZ TTY line discipline – android/kernel/drivers/bluetooth/hci_ldisc.c
■ For out-of-band sleep, H4 protocol is used – android/kernel/drivers/hci_h4.c
■ For software in-band sleep, IBS protocol is used – android/kernel/drivers/hci_ibs.c


BlueZ Source Directories
BlueZ kernel drivers

BlueZ utilities
android/external/bluetooth/bluez
JNI APIs (to interface with DBUS and BlueZ Bluetooth daemon)

android/kernel/net/bluetooth

android/frameworks/base/core/jni
Java APIs

android/frameworks/base/core/java/android/bluetooth
android/frameworks/base/core/java/android/server
Bluetooth settings application
android/packages/apps/Settings/src/com/android/settings/bluetooth


BTS402x only supports
out-of- band sleep, using two
additional pins

HOST_WAKE – From BTS to
 MSM to wake-up BTS
EXT_WAKE – From MSM to BTS to wake-up BTS

RTS/CTS act as wake line
acknowledgement


New software in-band sleep UART protocol (HCI_UART_IBS) is
registered to hci_ldisc
■ Source code is located in android/kernel/drivers/bluetooth/hci_ibs.c



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值