openwrt/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
Adrian Schmutzler 2c60de0e3f treewide: move MAC address patch functions to common library
This unifies MAC address patch functions and moves them to a
common script. While those were implemented differently for
different targets, they all seem to do the same. The number of
different variants is significantly reduced by this patch.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-14 12:36:02 +02:00

46 lines
863 B
Bash

#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions/caldata.sh
board=$(board_name)
case "$FIRMWARE" in
"pci_wmac0.eeprom")
case $board in
netgear,wndr4700)
. /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
caldata_extract_ubi "caldata" 0x5000 0x1000
else
caldata_extract "wifi_data" 0x5000 0x1000
ath9k_patch_mac $(mtd_get_mac_binary wifi_data 0xc)
fi
;;
*)
caldata_die "board $board is not supported yet"
;;
esac
;;
"pci_wmac1.eeprom")
case $board in
netgear,wndr4700)
. /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
caldata_extract_ubi "caldata" 0x1000 0x1000
else
caldata_extract "wifi_data" 0x1000 0x1000
ath9k_patch_mac $(mtd_get_mac_binary wifi_data 0x0)
fi
;;
*)
caldata_die "board $board is not supported yet"
;;
esac
;;
esac