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);

+

发现这样修改 然后读取mac没问题 但是WiFi连接不上 :sweat: :sweat: :sweat: :sweat: :sweat:

@jasonl 有时间帮忙看一下 万分感谢

好的。。。。。。。。。。。。。。。。。。。

@seekdream1990 你修改驱动后现在的mac 是从哪里读取的?

如上图wifi_get_mac 通过这里获取 如果unifykey没有刷mac地址 就随机产生 当然也可以打开#ifdef EXAMPLE_GET_MAC

wifi 连接不上,内核的打印是什么?你发个log 看下

1 Like

[ 114.414289@2] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 23, bssidx: 0
[ 118.236687@1] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 24, bssidx: 0
[ 128.266185@1] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 25, bssidx: 0
[ 131.360796@4] [dhd-wlan0] wl_cfg80211_disconnect : Reason 3
[ 131.360828@4] dhd_dbg_stop_pkt_monitor, 1859
[ 131.384525@3] [dhd-wlan0] wl_iw_event : disconnected with fc:d7:33:5d:ab:1e, event 11, reason 8
[ 131.387716@0] [dhd] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_LINK
[ 131.387745@0] [dhd] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_LINK
[ 131.387752@0] [dhd] CFG80211-ERROR) wl_notify_connect_status : link down–clearing disconnect IEs
[ 131.404506@5] dhd_dbg_stop_pkt_monitor, 1859
[ 131.415822@3] [dhd-wlan0] wl_ext_iapsta_event : [S] Link down with fc:d7:33:5d:ab:1e, WLC_E_DISASSOC(11), reason 8
[ 131.426333@3] [dhd-wlan0] wl_iw_event : Link Down with fc:d7:33:5d:ab:1e, reason=2
[ 131.433640@3] [dhd-wlan0] wl_ext_iapsta_event : [S] Link down with fc:d7:33:5d:ab:1e, WLC_E_LINK(16), reason 2
[ 132.023824@0] [dhd] CFG80211-ERROR) wl_cfg80211_disconnect : Clearing disconnect IEs
[ 132.047104@4] dhd_dbg_monitor_get_tx_pkts, 1913
[ 132.047132@4] dhd_dbg_monitor_get_tx_pkts(): no tx_status in tx completion messages, make sure that ‘d11status’ is enabled in firmware, status_pos=0
[ 132.063285@4] dhd_dbg_monitor_get_rx_pkts, 2010
[ 132.081258@0] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 26, bssidx: 0
[ 134.449080@5] [dhd] CFG80211-ERROR) wl_set_wsec_info_algos : wsec_info error (-23)
[ 134.451223@5] [dhd] CFG80211-ERROR) wl_set_set_cipher : set wsec_info error (0)
[ 134.461365@5] [dhd-wlan0] wl_cfg80211_connect : Connecting with c2:2d:64:ea:d3:7d ssid “seekdream”, len (9), sec=wpa2psk/aes, channel=6
[ 134.461365@5]
[ 134.490970@0] dhd_dbg_start_pkt_monitor, 1621
[ 134.491002@0] __dhd_dbg_free_tx_pkts, 1412
[ 134.493762@0] __dhd_dbg_free_rx_pkts, 1431
[ 134.595077@3] [dhd-wlan0] wl_iw_event : Link UP with c2:2d:64:ea:d3:7d
[ 134.596007@3] [dhd-wlan0] wl_ext_iapsta_event : [S] Link UP with c2:2d:64:ea:d3:7d
[ 134.607496@1] [dhd-wlan0] wl_bss_connect_done : Report connect result - connection succeeded
[ 135.080408@3] [dhd] CFG80211-ERROR) wl_cfg80211_check_in4way : return -EBUSY cnt 1
[ 136.213154@3] dhd_dbg_monitor_get_tx_pkts, 1913
[ 136.213183@3] dhd_dbg_monitor_get_tx_pkts(): no tx_status in tx completion messages, make sure that ‘d11status’ is enabled in firmware, status_pos=0
[ 136.226369@4] dhd_dbg_monitor_get_rx_pkts, 2010
[ 138.271135@0] [dhd] CFG80211-ERROR) wl_cfg80211_check_in4way : return -EBUSY cnt 2
[ 138.616985@3] [dhd-wlan0] wl_iw_event : disconnected with c2:2d:64:ea:d3:7d, event 12, reason 15
[ 138.617001@0] [dhd] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_DISASSOC_IND
[ 138.617011@0] [dhd] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_DISASSOC_IND
[ 138.617017@0] [dhd] CFG80211-ERROR) wl_notify_connect_status : link down–clearing disconnect IEs
[ 138.645532@3] [dhd-wlan0] wl_ext_iapsta_event : [S] Link down with c2:2d:64:ea:d3:7d, WLC_E_DISASSOC_IND(12), reason 15
[ 138.656464@3] [dhd-wlan0] wl_iw_event : disconnected with c2:2d:64:ea:d3:7d, event 6, reason 15
[ 138.658805@2] dhd_dbg_stop_pkt_monitor, 1859
[ 138.669167@3] [dhd-wlan0] wl_ext_iapsta_event : [S] Link down with c2:2d:64:ea:d3:7d, WLC_E_DEAUTH_IND(6), reason 15
[ 138.680894@1] [dhd-wlan0] wl_iw_event : Link Down with c2:2d:64:ea:d3:7d, reason=2
[ 138.687264@1] [dhd-wlan0] wl_ext_iapsta_event : [S] Link down with c2:2d:64:ea:d3:7d, WLC_E_LINK(16), reason 2
[ 138.743829@2] [dhd] CFG80211-ERROR) wl_cfg80211_check_in4way : WPA failed at 13
[ 138.746094@2] [dhd] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_DEAUTH_IND
[ 138.754201@2] [dhd] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_DEAUTH_IND
[ 138.762118@2] [dhd] CFG80211-ERROR) wl_notify_connect_status : link down–clearing disconnect IEs
[ 138.771096@2] [dhd] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_LINK
[ 138.776044@4] dhd_dbg_monitor_get_tx_pkts, 1913
[ 138.776050@4] dhd_dbg_monitor_get_tx_pkts(): no tx_status in tx completion messages, make sure that ‘d11status’ is enabled in firmware, status_pos=0
[ 138.777132@5] dhd_dbg_monitor_get_rx_pkts, 2010
[ 138.800423@2] [dhd] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_LINK
[ 138.808117@2] [dhd] CFG80211-ERROR) wl_notify_connect_status : link down–clearing disconnect IEs
[ 140.084109@0] [dhd-wlan0] wl_run_escan : LEGACY_SCAN sync ID: 27, bssidx: 0
[ 142.430947@1] [dhd] CFG80211-ERROR) wl_set_wsec_info_algos : wsec_info error (-23)
[ 142.433055@1] [dhd] CFG80211-ERROR) wl_set_set_cipher : set wsec_info error (0)
[ 142.443887@1] [dhd-wlan0] wl_cfg80211_connect : Connecting with fc:d7:33:5d:ab:1e ssid “TP-LINK_AB1E”, len (12), sec=open/none, channel=1
[ 142.443887@1]
[ 142.455051@0] dhd_dbg_start_pkt_monitor, 1621
[ 142.458504@0] __dhd_dbg_free_tx_pkts, 1412
[ 142.462511@0] __dhd_dbg_free_rx_pkts, 1431
[ 142.546303@3] [dhd-wlan0] wl_iw_event : Link UP with fc:d7:33:5d:ab:1e
[ 142.547211@3] [dhd-wlan0] wl_ext_iapsta_event : [S] Link UP with fc:d7:33:5d:ab:1e
[ 142.551066@0] [dhd-wlan0] wl_bss_connect_done : Report connect result - connection succeeded
[ 142.578699@2] dhd_dev_apf_get_version: firmware doesn’t support APF
[ 142.579325@2] dhd_dev_apf_get_max_len: firmware doesn’t support APF
[ 142.610110@3] net_os_enable_packet_filter: val = 0
[ 142.610569@3] net_os_rxfilter_add_remove: add_remove = 1, num = 2
[ 142.616489@1] dhd_pktfilter_offload_set: failed to add pktfilter 102 0 0 0 0xFFFFFF 0x01005E, retcode = -2
[ 142.625660@5] net_os_enable_packet_filter: val = 1
[ 142.706768@5] dhd_set_suspend: Remove extra suspend setting
[ 142.707386@3] dhd_enable_packet_filter: enter, value = 0

c2:2d:64:ea:d3:7d 这个是你写到unikey 中的mac 地址吗

不是 这个应该是路由器的地址 :grinning: :grinning: :grinning: :grinning: :grinning:

你可以尝试用回原来的mac地址看下是不是跟你的mac 地址不合法有关

不是地址不合法引起 已经尝试了 :grinning: :grinning: :grinning: :grinning: :grinning:

你不就是改了获取mac 地址的方式吗,是不是还改了什么导致的?

1 Like

没有改其他地方,我觉得应该还是打开GET_CUSTOM_MAC_FROM_CONFIG 走这里流程 但是就是出现设置版本失败问题

1 Like

我再RK平台 也是通过GET_CUSTOM_MAC_FROM_CONFIG 走这里流程 没有异常 但是两个平台DHD驱动差异较大 不好参考

1 Like

那这个问题要查看下代码了。。。。。。。。

代码参考上面的参考 并更新fw固件 可解