The mac address of ap6212 custom wifi on rk3288

Look at the log print first:

[  103.514715] bcmsdh_oob_intr_register: HW_OOB irq=229 flags=0x4
[  103.515484] dhd_get_memdump_info: File [/data/misc/wifi/.memdump.info] doesn't exist
[  103.515534] dhd_get_memdump_info: MEMDUMP ENABLED = 2
[  103.516621] Disable tdls_auto_op failed. -1
[  103.516653] dhd_tcpack_suppress_set 362: already set to 0
[  103.517355] dhd_apply_default_clm: Ignore clm file /system/etc/firmware/clm.blob
[  103.519994] Firmware up: op_mode=0x0005, MAC=8c:f7:10:30:4a:20

After the ap6212 driver is added and can be used normally, the above log will be printed, and you can see the print of "Firmware up: op_mode=0x0005, MAC=8c:f7:10:30:4a:20", which can be found according to the log print The source location for obtaining the mac address is dhd_preinit_ioctls in drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.c. In fact, I also tried to add it in the dhd_conf_get_mac function in dhd_config.c, but it was not called after adding. So I found another way, so modify the dhd_preinit_ioctls function in drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.c according to the log prompt

int
dhd_preinit_ioctls(dhd_pub_t *dhd)
{
    
    

	char mac[6]={
    
     0x8c,0xf7,0x10,0x30,0x4a ,0x29};	//自己加的
	...

	/* Get the default device MAC address directly from firmware */
	memset(buf, 0, sizeof(buf));
	bcm_mkiovar("cur_etheraddr", 0, 0, buf, sizeof(buf));
	if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf),
		FALSE, 0)) < 0) {
    
    
		DHD_ERROR(("%s: can't get MAC address , error=%d\n", __FUNCTION__, ret));
		ret = BCME_NOTUP;
		goto done;
	}
	/* Update public MAC address after reading from Firmware */
	
	printk(" get_mac_src   %X:%X:%X:%X:%X:%X\n",buf[0],  buf[1],buf[2],buf[3],buf[4],buf[5]);	//自己加的
	memcpy(buf,mac, 6);
	printk(" get_mac_mac   %X:%X:%X:%X:%X:%X\n",buf[0],  buf[1],buf[2],buf[3],buf[4],buf[5]);	//自己加的
	memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN);

...
	DHD_ERROR(("Firmware up: op_mode=0x%04x, MAC="MACDBG"\n",
		dhd->op_mode, MAC2STRDBG(dhd->mac.octet)));
#ifdef CUSTOMER_HW2
..
	return ret;
}

Log after success:

[  103.514715] bcmsdh_oob_intr_register: HW_OOB irq=229 flags=0x4
[  103.515484] dhd_get_memdump_info: File [/data/misc/wifi/.memdump.info] doesn't exist
[  103.515534] dhd_get_memdump_info: MEMDUMP ENABLED = 2
[  103.516621] Disable tdls_auto_op failed. -1
[  103.516653] dhd_tcpack_suppress_set 362: already set to 0
[  103.517282]  get_mac_src   8C:F7:10:30:4A:20
[  103.517307]  get_mac_mac   8C:F7:10:30:4A:29
[  103.517355] dhd_apply_default_clm: Ignore clm file /system/etc/firmware/clm.blob
[  103.519994] Firmware up: op_mode=0x0005, MAC=8c:f7:10:30:4a:29

Guess you like

Origin blog.csdn.net/weixin_68294039/article/details/128412731