1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > 高通平台msm8917蓝牙mac地址流程

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

时间:2019-04-02 20:00:17

相关推荐

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

高通平台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.confro.boot.btmacaddrpersist.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.confif not found, will read from property "persist.service.bdroid.bdaddr" directlyif 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.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。