高通平台msm8917蓝牙mac地址流程

Where is the BD address?
BD address can be saved in following places:

modem NV NV447
/persist/.bt_nv.bin OR /persist/bluetooth/.bt_nv.bin
/data/misc/bluedroid/bt_config.xml OR /data/misc/bluedroid/bt_config.conf
ro.boot.btmacaddr
persist.service.bdroid.bdaddr

How about QCOM default BD address solution?
In general there are 2 stage for BD address.One is on boot and the other is enabling Bluetooth from GUI.
while on boot stage, btnvtool will try to find bt_nv.bin.
if not exist, it will generate a BD address and save it to bt_nv.bin. If exist, do nothing and exit.
while on enabling BT stage, we will read BD address from bt_nv.bin and overwrite NVM tag 2.
Finally write all of the NVM tags into chipset, including tag 2.
After the chipset reset, BD address will take effect.

Details are as follows:
[On Boot Stage]
In init.qcom.rc, there is an android service named “config_bluetooth”. When Android boot, this service will be started.
It will trigger btnvtool with option “O”, which means on boot configuration.
btnvtool will try to find whether BD address already saved into bt_nv.bin or not.
If yes, will do nothing.
If not, the following operation depends on different version of Android.
Android L:

it will generate a random BD address base on clock and save it into bt_nv.bin.

Android M:

priority is designed to read BD address from different place:
1st of all, it will read BD address from modem NV through QMI interface.
if failed, it will read from android property "ro.boot.btmacaddr".
if still failed, it will generate a random address base on clock.
if ANY of the above steps success, we will save the BD address into file bt_nv.bin.

[On enabling BT Stage]
while enabling Bluetooth from GUI, we have different process for difference chipset.
As for WCN36xx, hci_qcomm_init will start running to download all NVM tags into chipset, including tag 2.
In hci_qcomm_init, so far there are 3 macros:
BT_QSOC_GET_ITEMS_FROM_NV,
BT_QSOC_GET_ITEMS_FROM_PERSIST,
BT_QSOC_GET_ITEMS_FROM_PROPERTY.

By default only BT_QSOC_GET_ITEMS_FROM_PERSIST is enabled. That means we will read the BD address from file: bt_nv.bin.
After defining other macros, OEM can change the default priority to read BD address from other places.
The priority is NV --> PERSIST --> PROPERTY.
if all of them failed, we will generate a random BD address base on clock.
for more details, please refer to func: bt_hci_qcomm_pfal_get_bdaddress()

As for QCA61x4, by default we will read BD address from bt_nv.bin as well.
If failed, there is complicated logic / priority to read BD address from various places.

General steps are as follows:

we get the path of saving BD address with property "ro.bt.bdaddr_path" and then read it.
if property is NULL, will read from bt_config.conf
if not found, will read from property "persist.service.bdroid.bdaddr" directly
if failed, will read from another property "ro.boot.btmacaddr"
if still failed, will read from file: bt_nv.bin(/persist/.bt_nv.bin  OR /persist/bluetooth/.bt_nv.bin).
if failed as well, will generate a random BD address base on clock. at the same time, save it to property "persist.service.bdroid.bdaddr".

If ANY of the above success, will save it to bt_config.conf.
For more details, please fer to func:btif_fetch_local_bdaddr()

Since Android M, OEM may change the default priority by enable macro READ_BT_ADDR_FROM_PROP.
After that, 1st priority will be android property “ro.boot.btmacaddr”.
if failed. we will read BD address from bt_nv.bin as the 2nd priority.
if still failed or no valid BD address, we will fall to the complicated logic / priority as above.

How to modify BD address?
Theoretically, OEM can customize their BD address solution in either stage.
However, for mass production we strongly recommend OEM to customize it in the boot stage.
This is because such kind of customization will be unified for various Android OS and QCOM BT chipset.

In details, OEM can change the implementation of option “O” in btnvtool.
If bt_nv.bin is not exist, read BD address from desired place and then save it to bt_nv.bin.
So for the 1st boot, bt_nv.bin will be created and BD address will be saved.
For the following boot, BD address in bt_nv.bin will be used.
For some unexpected reason that bt_nv.bin is missing, it will be recovered after the next boot.

高通平台msm8917蓝牙mac地址流程相关推荐

  1. android 6.0 高通平台sensor 工作机制及流程(原创)

    最近工作上有碰到sensor的相关问题,正好分析下其流程作个笔记. 这个笔记分三个部分: sensor硬件和驱动的工作机制 sensor 上层app如何使用 从驱动到上层app这中间的流程是如何 Se ...

  2. android 6.0 高通平台sensor 工作机制及流程

    最近工作上有碰到sensor的相关问题,正好分析下其流程作个笔记. 这个笔记分三个部分: sensor硬件和驱动的工作机制 sensor 上层app如何使用 从驱动到上层app这中间的流程是如何 Se ...

  3. 高通平台Android 蓝牙调试和配置手册--如何抓取log

    1.Android蓝牙调试概述 使用本文档可以使用以下方法调试一些常见的蓝牙问题: ■ Android主机日志(ADB logcat) ■ 蓝牙日志 ■ 音频配置文件日志 ■ 数据配置文件日志 ■ G ...

  4. 高通msm8996配置wlan0 Mac地址

    1.wlan_mac.bin添加 Intf0MacAddress=000000000001 END2.push到/persist

  5. 高通平台msm8917 闪光灯解析

    kernel/msm-3.18/drivers/media/platform/msm/camera_v2/sensor/flash msm_flash.c//flash 初始化函数,包括闪光灯结点的读 ...

  6. 高通平台RF配置流程

    高通平台RF配置流程 **注:**本文参考项目路径和代码为SIM7600 LE20分支 1 准备工作 需要的资料: 各个器件的datasheet 原理图 逻辑表(内容包含支持哪些制式.band,各个b ...

  7. 高通平台Bootloader启动流程【转】

    本文转载自:http://blog.csdn.net/fang_first/article/details/49615631 ====================基本知识============= ...

  8. 高通平台android开发总结

    http://www.cnblogs.com/yuzaipiaofei/archive/2012/07/24/4124179.html 1.高通平台android开发总结 1.1 搭建高通平台环境开发 ...

  9. 高通平台android 环境配置编译及开发经验总结

    完全转自:http://blog.csdn.net/dongwuming/article/details/12784535 1.高通平台android开发总结 1.1 搭建高通平台环境开发环境 在高通 ...

最新文章

  1. mac启动本地redis_通过 Laravel Sail 构建基于 Docker 的本地开发环境
  2. SeekBar的使用(一):实现OnSeekBarChangListener
  3. 前端自动化构建工具Grunt
  4. UIActionSheet和UIProgressView的组合
  5. 理解javascript中的回调函数(callback)【转】
  6. java运行class文件_java命令行下运行class文件
  7. C++标准输入流、输出流以及文件流
  8. windows 禁用ipv6服务_在 Windows 7 中禁用IPv6协议/IPv6隧道
  9. 【Java】使用前准备工作配置环境变量
  10. 【华为云技术分享】从自建MongoDB聊聊云数据库MongoDB的蓬勃张力
  11. 卷积神经网络CNN总结(转)
  12. python创建一个csv文件_Python程序中用csv模块来操作csv文件的基本使用教程
  13. 基于stm32 ESP8266WiFi模块的基本通信
  14. 线形设计matlab,立交匝道平面线形优化设计及MATLAB的应用
  15. HCIP第十六天(VLAN IF接口,STP生成树协议,BPDU的配置)
  16. 前后端分离实现在线音乐网站-springboot+vue
  17. 张俊 中国科技大学 计算机,张俊-中国科学院大学-UCAS
  18. 32位plsql连接64位Oracle数据库
  19. SNIPER: Efficient Multi-Scale Training解读
  20. 个人Android学习社区

热门文章

  1. php面试题目及答案下载,精选新浪php面试题附答案
  2. nodeJs修改上传文件的大小限制
  3. 中国电信及网通IP网段
  4. 两个卡方分布之和_机器学习算法数学基础之 —— 统计与概率论篇(3)
  5. Kate commitments入门
  6. window服务器加固(等保2级)
  7. 自己选择的路,跪着走完吧——一个兔纸的话
  8. Android 官方模拟器7.0+ ROOT操作(以把CA证书刷到系统信任证书为例)
  9. 网络服务之----DNS域名解析服务篇
  10. PHP手机号码吉凶源码,手机号码测吉凶