dre: Use local version of wifi-mac-generator
MAC_1_PATH does not exist in the N200, causing a 10-second delay in generating MAC addresses. By that point, the WLAN driver has already failed to get a MAC address, thus leaving Wi-Fi broken. Change-Id: Iab2d34aa9db9e8843108b90b203e82f915c79bda
This commit is contained in:
parent
63af35b020
commit
8abcf2d6c7
5 changed files with 60 additions and 2 deletions
|
@ -553,7 +553,7 @@ PRODUCT_PACKAGES += \
|
||||||
libwpa_client \
|
libwpa_client \
|
||||||
libwifi-hal-ctrl \
|
libwifi-hal-ctrl \
|
||||||
libwifi-hal-qcom \
|
libwifi-hal-qcom \
|
||||||
wifi-mac-generator \
|
wifi-mac-generator-dre \
|
||||||
WifiResCommon \
|
WifiResCommon \
|
||||||
wpa_supplicant \
|
wpa_supplicant \
|
||||||
wpa_supplicant.conf
|
wpa_supplicant.conf
|
||||||
|
|
2
sepolicy/vendor/file_contexts
vendored
2
sepolicy/vendor/file_contexts
vendored
|
@ -1,6 +1,6 @@
|
||||||
# Binaries
|
# Binaries
|
||||||
/(vendor|system/vendor)/bin/opf-service u:object_r:opf_exec:s0
|
/(vendor|system/vendor)/bin/opf-service u:object_r:opf_exec:s0
|
||||||
/(vendor|system/vendor)/bin/wifi-mac-generator u:object_r:wifi-mac-generator_exec:s0
|
/(vendor|system/vendor)/bin/wifi-mac-generator-dre u:object_r:wifi-mac-generator_exec:s0
|
||||||
|
|
||||||
# Block devices
|
# Block devices
|
||||||
/dev/block/platform/soc/4804000\.ufshc/by-name/fw_ufs1_[ab] u:object_r:vendor_custom_ab_block_device:s0
|
/dev/block/platform/soc/4804000\.ufshc/by-name/fw_ufs1_[ab] u:object_r:vendor_custom_ab_block_device:s0
|
||||||
|
|
6
wifi-mac-generator/Android.bp
Normal file
6
wifi-mac-generator/Android.bp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
sh_binary {
|
||||||
|
name: "wifi-mac-generator-dre",
|
||||||
|
init_rc: ["wifi-mac-generator.rc"],
|
||||||
|
src: "wifi-mac-generator.sh",
|
||||||
|
vendor: true,
|
||||||
|
}
|
9
wifi-mac-generator/wifi-mac-generator.rc
Normal file
9
wifi-mac-generator/wifi-mac-generator.rc
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
service vendor.wifi-mac-generator /vendor/bin/wifi-mac-generator-dre
|
||||||
|
class main
|
||||||
|
user wifi
|
||||||
|
group wifi
|
||||||
|
oneshot
|
||||||
|
disabled
|
||||||
|
|
||||||
|
on post-fs-data
|
||||||
|
start vendor.wifi-mac-generator
|
43
wifi-mac-generator/wifi-mac-generator.sh
Normal file
43
wifi-mac-generator/wifi-mac-generator.sh
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/vendor/bin/sh
|
||||||
|
WLAN_MAC_VENDOR_PREFIX="C0EEFB"
|
||||||
|
WLAN_MAC_PERSIST_PATH="/mnt/vendor/persist/wlan_mac.bin"
|
||||||
|
|
||||||
|
function wait_for_file() {
|
||||||
|
retries=0
|
||||||
|
|
||||||
|
while [ ! -f "${1}" ]; do
|
||||||
|
retries=$((retries + 1))
|
||||||
|
|
||||||
|
if [ "${retries}" -eq 10 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ ! -f "${WLAN_MAC_PERSIST_PATH}" ]] || [[ ! -s "${WLAN_MAC_PERSIST_PATH}" ]]; then
|
||||||
|
MAC_0_PATH="/data/vendor/oemnvitems/4678_0"
|
||||||
|
|
||||||
|
if ! wait_for_file "${MAC_0_PATH}"; then
|
||||||
|
MAC_0="${WLAN_MAC_VENDOR_PREFIX}`xxd -l 3 -p /dev/urandom | tr '[:lower:]' '[:upper:]'`"
|
||||||
|
else
|
||||||
|
MAC_0=`xxd -p "${MAC_0_PATH}" | grep -o '..' | tac | tr -d '\n' | tr '[:lower:]' '[:upper:]'`
|
||||||
|
fi
|
||||||
|
|
||||||
|
#MAC_1_PATH="/data/vendor/oemnvitems/4678_1"
|
||||||
|
|
||||||
|
#if ! wait_for_file "${MAC_1_PATH}"; then
|
||||||
|
# MAC_1="${WLAN_MAC_VENDOR_PREFIX}`xxd -l 3 -p /dev/urandom | tr '[:lower:]' '[:upper:]'`"
|
||||||
|
#else
|
||||||
|
# MAC_1=`xxd -p "${MAC_1_PATH}" | grep -o '..' | tac | tr -d '\n' | tr '[:lower:]' '[:upper:]'`
|
||||||
|
#fi
|
||||||
|
|
||||||
|
echo "Intf0MacAddress=${MAC_0}" > "${WLAN_MAC_PERSIST_PATH}"
|
||||||
|
echo "Intf1MacAddress=000AF58989FE" >> "${WLAN_MAC_PERSIST_PATH}"
|
||||||
|
echo "Intf2MacAddress=000AF58989FD" >> "${WLAN_MAC_PERSIST_PATH}"
|
||||||
|
echo "Intf3MacAddress=000AF58989FC" >> "${WLAN_MAC_PERSIST_PATH}"
|
||||||
|
echo "END" >> "${WLAN_MAC_PERSIST_PATH}"
|
||||||
|
fi
|
Loading…
Reference in a new issue