char val[PROPERTY_VALUE_MAX] = {0};
uint8_t valid_bda = FALSE;
int val_size = 0;
-
+ int vflash_fd;
const uint8_t null_bdaddr[BD_ADDR_LEN] = {0,0,0,0,0,0};
+ if ((vflash_fd = open("/dev/vflash", O_RDONLY)) != -1)
+ {
+ char bd_addr[6] = {0};
+ BTIF_TRACE_ERROR("Get local bdaddr from vflash");
+ #define VFLASH_READ_BDA 0x01
+ if(ioctl(vflash_fd, VFLASH_READ_BDA, (unsigned long)bd_addr) >= 0
+ && memcmp(bd_addr, null_bdaddr, BD_ADDR_LEN) != 0)
+ {
+ local_addr->address[0] = bd_addr[5];
+ local_addr->address[1] = bd_addr[4];
+ local_addr->address[2] = bd_addr[3];
+ local_addr->address[3] = bd_addr[2];
+ local_addr->address[4] = bd_addr[1];
+ local_addr->address[5] = bd_addr[0];
+ //local_addr->address[0] = local_addr->address[0] << 1;
+ valid_bda = TRUE;
+ BTIF_TRACE_DEBUG("Got Factory BDA %02X:%02X:%02X:%02X:%02X:%02X",
+ local_addr->address[0], local_addr->address[1], local_addr->address[2],
+ local_addr->address[3], local_addr->address[4], local_addr->address[5]);
+ }
+
+ close(vflash_fd);
+ }
+
if (!valid_bda) {
int ret;
char bd_addr[6] = {0};
bt_addr_vendor_storage_read_or_write(1, bd_addr, 6);
}
}
-
- if (!valid_bda) {// cmy@2012-11-28: Get local bdaddr from vflash
- int vflash_fd = open("/dev/vflash", O_RDONLY);
- if (vflash_fd > 0)
- {
- char bd_addr[6] = {0};
- BTIF_TRACE_ERROR("Get local bdaddr from vflash");
- #define VFLASH_READ_BDA 0x01
- if(ioctl(vflash_fd, VFLASH_READ_BDA, (unsigned long)bd_addr) >= 0
- && memcmp(bd_addr, null_bdaddr, BD_ADDR_LEN) != 0)
- {
- local_addr->address[0] = bd_addr[5];
- local_addr->address[1] = bd_addr[4];
- local_addr->address[2] = bd_addr[3];
- local_addr->address[3] = bd_addr[2];
- local_addr->address[4] = bd_addr[1];
- local_addr->address[5] = bd_addr[0];
-
- //local_addr->address[0] = local_addr->address[0] << 1;
- valid_bda = TRUE;
- BTIF_TRACE_ERROR("Got Factory BDA %02X:%02X:%02X:%02X:%02X:%02X",
- local_addr->address[0], local_addr->address[1], local_addr->address[2],
- local_addr->address[3], local_addr->address[4], local_addr->address[5]);
- }
- close(vflash_fd);
- }
- }
/* Get local bdaddr storage path from property */
if (!valid_bda && osi_property_get(PROPERTY_BT_BDADDR_PATH, val, NULL))
{
/******************************************************************************
** Externs
******************************************************************************/
-
+static char mac_addr[6]={0};
void hw_config_cback(void *p_evt_buf);
extern uint8_t vnd_local_bd_addr[BD_ADDR_LEN];
char data[256], *str;
int addr_fd;
- if ((addr_fd = open("/data/misc/bluetooth/bdaddr", O_RDONLY)) != -1)
- {
- memset(data, 0, sizeof(data));
- read(addr_fd, data, 17);
- for (i = 0,str = data; i < 6; i++) {
- addr[5-i] = (unsigned char)strtoul(str, &str, 16);
- str++;
- }
- close(addr_fd);
- return 0;
- }
+#if (USE_CONTROLLER_BDADDR == TRUE)
return -1;
+#else
+// the mac in config is revert ,so we need revert
+ addr[0]=mac_addr[5];
+ addr[1]=mac_addr[4];
+ addr[2]=mac_addr[3];
+ addr[3]=mac_addr[2];
+ addr[4]=mac_addr[1];
+ addr[5]=mac_addr[0];
+ return 0;
+#endif
}
static inline int getAltSettings(patch_info *patch_entry, unsigned short *offset, int max_group_cnt)
i += temp;
entry = (struct rtk_bt_vendor_config_entry*)((uint8_t*)entry + temp);
}
-
+#if (USE_CONTROLLER_BDADDR == FALSE)
+ ALOGE("rtk_parse_config_file : %02X:%02X:%02X:%02X:%02X:%02X",
+ bt_addr[0], bt_addr[1],
+ bt_addr[2], bt_addr[3],
+ bt_addr[4], bt_addr[5]);
+//bt_addr normal
+ memcpy(mac_addr,bt_addr,6);
+#endif
return baudrate;
}