Updated wifi.mac/bt.mac patch from mdebeljuh. See http://forum.xda-developers.com/showthread.php?t=819819
This commit is contained in:
parent
90731a9200
commit
db56b460e4
@ -27,6 +27,12 @@
|
||||
|
||||
#define NVS_MAX_SIZE 0x800U
|
||||
#define NVS_MACADDR_SIZE 0x1AU
|
||||
#define WLAN_SKB_BUF_NUM 16
|
||||
//---------PATCH for mac address------------
|
||||
#define MAC_ADDRESS_LEN_C 17
|
||||
#define ETHER_ADDR_LEN 6
|
||||
//------------------------------------------
|
||||
|
||||
|
||||
static unsigned char wifi_nvs_ram[NVS_MAX_SIZE];
|
||||
static struct proc_dir_entry *wifi_calibration;
|
||||
@ -71,6 +77,37 @@ static unsigned char *hardcoded_nvs =
|
||||
|
||||
static struct proc_dir_entry *wifi_calibration;
|
||||
|
||||
//---------PATCH for mac address-----------------
|
||||
static char htcleo_mac_address_c[MAC_ADDRESS_LEN_C+1];
|
||||
int user_mac_address = 0;
|
||||
static int __init htcleo_macaddress_setup(char *bootconfig)
|
||||
{
|
||||
int ret;
|
||||
unsigned int tmp[ETHER_ADDR_LEN];
|
||||
|
||||
printk("%s: cmdline mac config=%s | %s\n",__FUNCTION__, bootconfig, __FILE__);
|
||||
|
||||
strncpy(htcleo_mac_address_c, bootconfig, MAC_ADDRESS_LEN_C);
|
||||
ret = sscanf(htcleo_mac_address_c, "%2x:%2x:%2x:%2x:%2x:%2x", tmp, tmp+1, tmp+2, tmp+3, tmp+4, tmp+5);
|
||||
if (ret==ETHER_ADDR_LEN)
|
||||
{
|
||||
strcpy(nvs_mac_addr, "macaddr=");
|
||||
strcat(nvs_mac_addr, htcleo_mac_address_c);
|
||||
strcat(nvs_mac_addr, "\n");
|
||||
printk("%s parsed macaddr=%s | %s\n",__FUNCTION__,nvs_mac_addr, __FILE__);
|
||||
user_mac_address = 1;
|
||||
}
|
||||
printk("%s parsed mac_address=%2x:%2x:%2x:%2x:%2x:%2x | %s\n",__FUNCTION__,
|
||||
tmp[0], tmp[1], tmp[2],
|
||||
tmp[3], tmp[4], tmp[5], __FILE__);
|
||||
|
||||
return 1;
|
||||
}
|
||||
__setup("wifi.mac=", htcleo_macaddress_setup);
|
||||
//------------------------------------------
|
||||
|
||||
|
||||
|
||||
unsigned char *get_wifi_nvs_ram( void )
|
||||
{
|
||||
return hardcoded_nvs;
|
||||
@ -115,7 +152,8 @@ static int parse_tag_msm_wifi(void)
|
||||
else
|
||||
maddr++;
|
||||
}
|
||||
if((char*)maddr<(char*)(wifi_nvs_ram+NVS_MAX_SIZE-NVS_MACADDR_SIZE)) nvs_mac_addr = maddr;
|
||||
if (!user_mac_address)
|
||||
if((char*)maddr<(char*)(wifi_nvs_ram+NVS_MAX_SIZE-NVS_MACADDR_SIZE)) nvs_mac_addr = maddr;
|
||||
|
||||
|
||||
#ifdef NVS_MSM_WIFI_DEBUG
|
||||
|
@ -477,21 +477,56 @@ static struct platform_device msm_camera_sensor_s5k3e2fx =
|
||||
},
|
||||
};
|
||||
|
||||
//-----PATCH for BT mac address
|
||||
int is_valid_mac_address(char *mac)
|
||||
{
|
||||
int i =0;
|
||||
while(i<17){
|
||||
if( (i%3) == 2){
|
||||
if ((mac[i] !=':') && (mac[i] = '-')) return 0;
|
||||
if (mac[i] == '-') mac[i] = ':';
|
||||
}else{
|
||||
if ( !( ((mac[i] >= '0') && (mac[i] <= '9')) ||
|
||||
((mac[i] >= 'a') && (mac[i] <= 'f')) ||
|
||||
((mac[i] >= 'A') && (mac[i] <= 'F')))
|
||||
) return 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (mac[i] != '\0') return 0;
|
||||
return 1;
|
||||
}
|
||||
//-----------------------------
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// bluetooth
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
static char bdaddress[20];
|
||||
#define MAC_ADDRESS_SIZE_C 17
|
||||
static char bdaddress[MAC_ADDRESS_SIZE_C+1] = "";
|
||||
static void bt_export_bd_address(void)
|
||||
{
|
||||
unsigned char cTemp[6];
|
||||
|
||||
memcpy(cTemp, get_bt_bd_ram(), 6);
|
||||
sprintf(bdaddress, "%02x:%02x:%02x:%02x:%02x:%02x", cTemp[0], cTemp[1], cTemp[2], cTemp[3], cTemp[4], cTemp[5]);
|
||||
pr_info("BD_ADDRESS=%s\n", bdaddress);
|
||||
if (!is_valid_mac_address(bdaddress)){
|
||||
memcpy(cTemp, get_bt_bd_ram(), 6);
|
||||
sprintf(bdaddress, "%02x:%02x:%02x:%02x:%02x:%02x", cTemp[0], cTemp[1], cTemp[2], cTemp[3], cTemp[4], cTemp[5]);
|
||||
pr_info("BD_ADDRESS=%s\n", bdaddress);
|
||||
}
|
||||
}
|
||||
|
||||
module_param_string(bdaddress, bdaddress, sizeof(bdaddress), S_IWUSR | S_IRUGO);
|
||||
MODULE_PARM_DESC(bdaddress, "BT MAC ADDRESS");
|
||||
#
|
||||
//-----added alias for bt mac address parameter--------
|
||||
static int __init htcleo_bt_macaddress_setup(char *bootconfig)
|
||||
{
|
||||
printk("%s: cmdline bt mac config=%s | %s\n",__FUNCTION__, bootconfig, __FILE__);
|
||||
strncpy(bdaddress, bootconfig, MAC_ADDRESS_SIZE_C);
|
||||
return 1;
|
||||
}
|
||||
__setup("bt.mac=", htcleo_bt_macaddress_setup);
|
||||
//-----------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
static struct msm_serial_hs_platform_data msm_uart_dm1_pdata =
|
||||
|
Loading…
x
Reference in New Issue
Block a user