VIM3 通过unifykey烧录WiFi mac问题

VIM3 Android最新你版本,通过unifykey烧录WiFi mac问题成功后,系统使用的不是烧录的。

驱动通过获取uboot bootarge __setup(“mac_wifi=”, mac_addr_set) 驱动 目前wifi_dt.c获取的mac是正确的,DHD驱动使能GET_CUSTOM_MAC_FROM_CONFIG 宏 但是还是报错不能设置这个mac地址!

17.897272@2] dhd_preinit_ioctls: can’t set MAC address MAC=9e:c9:3b:61:5e:8f, error=-21
[ 17.904586@2] MACPAD:
[ 17.906791@2] 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 17.913306@2] 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 17.919805@2] 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 17.926307@2] 0030: 00 00 00 00 00 00 00 00

@Terry @Jason 有时间帮忙看下 感谢

好的,有空的时候我去看下。。。。。。。。

我没有通过GET_CUSTOM_MAC_FROM_CONFIG 走这里,原因不明!以下修改可以参考

index 7b0e65d..21d3f74
--- a/bcmdhd.100.10.315.x/dhd_gpio.c
+++ b/bcmdhd.100.10.315.x/dhd_gpio.c
@@ -203,6 +203,7 @@ static int dhd_wlan_get_mac_addr(unsigned char *buf)
                bcopy(macpad, buf+6, sizeof(macpad));
        }
 #endif /* EXAMPLE_GET_MAC_VER2 */
+       bcopy((char *)wifi_get_mac(), buf, sizeof(struct ether_addr));

        return err;
 }


+++ b/bcmdhd.100.10.315.x/dhd_linux.c
@@ -9864,7 +9864,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
        int scan_assoc_time = DHD_SCAN_ASSOC_ACTIVE_TIME;
        int scan_unassoc_time = DHD_SCAN_UNASSOC_ACTIVE_TIME;
        int scan_passive_time = DHD_SCAN_PASSIVE_TIME;
-       char buf[WLC_IOCTL_SMLEN];
+       char buf[WLC_IOCTL_SMLEN] = {0};
        char *ptr;
        uint32 listen_interval = CUSTOM_LISTEN_INTERVAL; /* Default Listen Interval in Beacons */
 #if defined(DHD_8021X_DUMP) && defined(SHOW_LOGTRACE)
@@ -10106,16 +10106,23 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
 #endif /* GET_CUSTOM_MAC_ENABLE */
        /* 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;
+
+       wifi_platform_get_mac_addr(dhd->adapter, buf);
+       if(buf[0] == 0xff && buf[1] == 0xff && buf[2] == 0xff) {
+               /* Update public MAC address after reading from Firmware */
+               printf("vhd cannot get wifi mac,so get from ap6255 itself!\n");
+               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 */
        memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN);

+