From 1b4c92e53ac2c6ff2a78ae44898e32e2f5b62902 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Fri, 30 Sep 2016 07:30:56 +0200 Subject: [PATCH] Patch to set MAC address for 8189fs http://forum.armbian.com/index.php/topic/2191-orange-pi-pc-same-mac-address-on-wlan0/ --- .../linux-200-wifi-mac-fix.patch | 38 +++++++++++++++++++ scripts/firstrun | 6 --- 2 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 patch/kernel/sun8i-default/linux-200-wifi-mac-fix.patch diff --git a/patch/kernel/sun8i-default/linux-200-wifi-mac-fix.patch b/patch/kernel/sun8i-default/linux-200-wifi-mac-fix.patch new file mode 100644 index 0000000000..c57ed6bc1a --- /dev/null +++ b/patch/kernel/sun8i-default/linux-200-wifi-mac-fix.patch @@ -0,0 +1,38 @@ +diff -Nur a/drivers/net/wireless/rtl8189fs/core/rtw_ieee80211.c b/drivers/net/wireless/rtl8189fs/core/rtw_ieee80211.c +--- a/drivers/net/wireless/rtl8189fs/core/rtw_ieee80211.c 2016-02-25 06:58:52.000000000 +0100 ++++ b/drivers/net/wireless/rtl8189fs/core/rtw_ieee80211.c 2016-09-27 21:44:26.470787346 +0200 +@@ -1467,17 +1467,22 @@ + goto func_exit; + } + ++#if 0 + if (check_local_bit == _TRUE) { + if (mac_addr[0] & BIT1) { + res = _TRUE; + goto func_exit; + } + } ++#else ++ (void) check_local_bit; ++#endif + + func_exit: + return res; + } + ++extern void wifi_hwaddr_from_chipid(u8 *addr); + extern char* rtw_initmac; + /** + * rtw_macaddr_cfg - Decide the mac address used +@@ -1510,6 +1515,11 @@ + goto err_chk; + #endif + ++#ifdef CONFIG_PLATFORM_ARM_SUN8I ++ wifi_hwaddr_from_chipid(mac); ++ goto err_chk; ++#endif ++ + /* Use the mac address stored in the Efuse */ + if (hw_mac_addr) { + _rtw_memcpy(mac, hw_mac_addr, ETH_ALEN); diff --git a/scripts/firstrun b/scripts/firstrun index 8a517e6e65..5a65811ca4 100644 --- a/scripts/firstrun +++ b/scripts/firstrun @@ -108,12 +108,6 @@ collect_information() { } # collect_information adjust_sunxi_settings() { - # set some mac address for wifi - [[ "$(lsmod | grep 8189fs)" != "" ]] && \ - (MACADDR=$(printf '00:E0:4C:%02X:%02X:%02X\n' $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]) ; \ - echo "options 8189fs rtw_initmac=${MACADDR}" > /etc/modprobe.d/8189fs.conf ; \ - echo -e "\n### [firstrun] Use MAC address ${MACADDR} for Wi-Fi from now" >>${Log}) - # set some mac address for BT [[ "$(lsmod | grep bcmdhd)" != "" ]] && \ (MACADDR=$(printf '43:29:B1:%02X:%02X:%02X\n' $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]) ; \