Applied mdebeljuh patch from http://forum.xda-developers.com/showthread.php?t=819819
This commit is contained in:
parent
69d61f8433
commit
187ebc6dad
@ -28,6 +28,9 @@ int htcleo_wifi_set_carddetect(int on);
|
||||
#define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 1024)
|
||||
|
||||
#define WLAN_SKB_BUF_NUM 16
|
||||
//---------PATCH for mac address------------
|
||||
#define MAC_ADDRESS_LEN_C 17
|
||||
//------------------------------------------
|
||||
|
||||
static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
|
||||
|
||||
@ -42,6 +45,22 @@ static wifi_mem_prealloc_t wifi_mem_array[PREALLOC_WLAN_NUMBER_OF_SECTIONS] = {
|
||||
{ NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER) },
|
||||
{ NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER) }
|
||||
};
|
||||
//---------PATCH for mac address-----------------
|
||||
static char htcleo_mac_address_c[MAC_ADDRESS_LEN_C+1];
|
||||
static int __init htcleo_macaddress_setup(char *bootconfig)
|
||||
{
|
||||
printk("%s: cmdline mac config=%s | %s\n",__FUNCTION__, bootconfig, __FILE__);
|
||||
strncpy(htcleo_mac_address_c, bootconfig, MAC_ADDRESS_LEN_C);
|
||||
return 1;
|
||||
}
|
||||
__setup("wifi.mac_address=", htcleo_macaddress_setup);
|
||||
|
||||
const char *get_htcleo_mac_address_c(void)
|
||||
{
|
||||
return htcleo_mac_address_c;
|
||||
}
|
||||
EXPORT_SYMBOL(get_htcleo_mac_address_c);
|
||||
//------------------------------------------
|
||||
|
||||
static void *htcleo_wifi_mem_prealloc(int section, unsigned long size)
|
||||
{
|
||||
|
@ -70,6 +70,12 @@ typedef struct dhd_prot {
|
||||
unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN];
|
||||
} dhd_prot_t;
|
||||
|
||||
//---------PATCH for mac address------------
|
||||
extern uint8 mac_address[ETHER_ADDR_LEN];
|
||||
extern int user_mac_address;
|
||||
//------------------------------------------
|
||||
|
||||
|
||||
static int
|
||||
dhdcdc_msg(dhd_pub_t *dhd)
|
||||
{
|
||||
@ -906,6 +912,21 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
|
||||
dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf));
|
||||
myprintf("firmware version: %s\n", buf);
|
||||
|
||||
//---------PATCH for mac address-----------------
|
||||
if (user_mac_address)
|
||||
{
|
||||
ret = 0;
|
||||
if (!bcm_mkiovar("cur_etheraddr", (char*)mac_address, ETHER_ADDR_LEN, buf, 32)) {
|
||||
myprintf("%s: mkiovar failed for cur_etheraddr\n", __FUNCTION__);
|
||||
ret = -1;
|
||||
}
|
||||
if (!ret)
|
||||
ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, 32);
|
||||
if (ret < 0)
|
||||
myprintf("%s: __moj__ set cur_etheraddr failed\n", __FUNCTION__);
|
||||
}
|
||||
//------------------------------------------
|
||||
|
||||
|
||||
/* Get the device MAC address */
|
||||
strcpy(iovbuf, "cur_etheraddr");
|
||||
|
@ -72,6 +72,30 @@ struct dhd_bus *g_bus;
|
||||
static struct wifi_platform_data *wifi_control_data = NULL;
|
||||
static struct resource *wifi_irqres = NULL;
|
||||
|
||||
//---------PATCH for mac address-----------------
|
||||
extern const char *get_htcleo_mac_address_c(void);
|
||||
uint8 mac_address[ETHER_ADDR_LEN];
|
||||
int user_mac_address = 0;
|
||||
|
||||
static void dhd_macaddress_setup(void)
|
||||
{
|
||||
int ret, i;
|
||||
unsigned int tmp[ETHER_ADDR_LEN];
|
||||
ret = sscanf(get_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)
|
||||
{
|
||||
for (i=0; i<ETHER_ADDR_LEN; i++)
|
||||
mac_address[i] = (uint8)tmp[i];
|
||||
user_mac_address = 1;
|
||||
}
|
||||
myprintf("%s parsed mac_address=%2x:%2x:%2x:%2x:%2x:%2x | %s\n",__FUNCTION__,
|
||||
mac_address[0], mac_address[1], mac_address[2],
|
||||
mac_address[3], mac_address[4], mac_address[5], __FILE__);
|
||||
return;
|
||||
}
|
||||
//------------------------------------------
|
||||
|
||||
|
||||
#if 0
|
||||
extern int htc_linux_periodic_wakeup_init(void);
|
||||
extern void htc_linux_periodic_wakeup_exit(void);
|
||||
@ -2221,6 +2245,9 @@ dhd_module_init(void)
|
||||
int error;
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
//-----patch for mac address-----------
|
||||
dhd_macaddress_setup();
|
||||
//-------------------------------------
|
||||
|
||||
/* Sanity check on the module parameters */
|
||||
do {
|
||||
|
Loading…
x
Reference in New Issue
Block a user