From 5a97d475ff67e8c978fcbd72e506703b1511723c Mon Sep 17 00:00:00 2001 From: Jon Benson Date: Wed, 27 Oct 2010 19:36:27 +1100 Subject: [PATCH] Updated mdebeljuh patch from http://forum.xda-developers.com/showthread.php?t=819819 for wifi.mac_address --- arch/arm/mach-msm/board-htcleo-wifi-nvs.c | 40 ++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-msm/board-htcleo-wifi-nvs.c b/arch/arm/mach-msm/board-htcleo-wifi-nvs.c index 6aca9f5c..3c2d7fe5 100644 --- a/arch/arm/mach-msm/board-htcleo-wifi-nvs.c +++ b/arch/arm/mach-msm/board-htcleo-wifi-nvs.c @@ -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_address=", 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