开发平台基本信息
芯片: MSM8953
版本: Android 10.0
kernel: msm-4.9
问题描述
有个客户要求产品型号、蓝牙等名称都修改为客户公司的名称;我这边是增加了persist.model
属性来定义客户定制的型号,所以,将蓝牙型号改为读取persist.model
。
解决方法
--- a/vendor/qcom/opensource/commonsys/system/bt/btif/src/btif_dm.cc
+++ b/vendor/qcom/opensource/commonsys/system/bt/btif/src/btif_dm.cc
@@ -113,6 +113,7 @@
#include "stack/sdp/sdpint.h"
#include "btif_tws_plus.h"
#include "device/include/device_iot_config.h"
+#define MAX_BUF_LEN 512
using bluetooth::Uuid;
@@ -3698,10 +3699,14 @@ void btif_dm_bredr_disable() {
void btif_dm_read_energy_info() { BTA_DmBleGetEnergyInfo(bta_energy_info_cb); }
static char* btif_get_default_local_name() {
+ char chType[MAX_BUF_LEN] = {0};
+ osi_property_get("persist.model", chType, "");
if (btif_default_local_name[0] == '\0') {
int max_len = sizeof(btif_default_local_name) - 1;
- if (BTM_DEF_LOCAL_NAME[0] != '\0') {
- strncpy(btif_default_local_name, BTM_DEF_LOCAL_NAME, max_len);
+ /*if (BTM_DEF_LOCAL_NAME[0] != '\0') {
+ strncpy(btif_default_local_name, BTM_DEF_LOCAL_NAME, max_len);*/
+ if (chType[0] != '\0'){
+ strncpy(btif_default_local_name, chType, max_len);
} else {
char prop_model[PROPERTY_VALUE_MAX];
osi_property_get(PROPERTY_PRODUCT_MODEL, prop_model, "");