summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom27
1 files changed, 16 insertions, 11 deletions
diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
index 28bde59..fa52dd5 100644
--- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
@@ -75,19 +75,24 @@ ath9k_ubi_eeprom_extract() {
ath9k_eeprom_extract_raw /dev/$ubi $offset $swap
}
-ath9k_patch_firmware_mac() {
+ath9k_patch_fw_mac_crc() {
local mac=$1
local mac_offset=$2
- local swap=$3
- local chksum_offset=$4
+ local chksum_offset=$((mac_offset - 10))
+
+ ath9k_patch_fw_mac "${mac}" "${mac_offset}" "${chksum_offset}"
+}
+
+ath9k_patch_fw_mac() {
+ local mac=$1
+ local mac_offset=$2
+ local chksum_offset=$3
local xor_mac
local xor_fw_mac
local xor_fw_chksum
[ -z "$mac" -o -z "$mac_offset" ] && return
- [ $swap -gt 0 ] && mac="${mac:3:2}:${mac:0:2}:${mac:9:2}:${mac:6:2}:${mac:15:2}:${mac:12:2}"
-
[ -n "$chksum_offset" ] && {
xor_mac=${mac//:/}
xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
@@ -120,27 +125,27 @@ case "$FIRMWARE" in
;;
BTHOMEHUBV2B)
ath9k_eeprom_extract "art" 0 1
- ath9k_patch_firmware_mac "00:00:00:00:00:00" 524 0 514
+ ath9k_patch_fw_mac_crc "00:00:00:00:00:00" 524
;;
BTHOMEHUBV3A)
ath9k_eeprom_extract "art-copy" 0 1
- ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 268 0 258
+ ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 268
;;
BTHOMEHUBV5A)
ath9k_ubi_eeprom_extract "caldata" 4096 0
- ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi caldata 4364) +2) 268 0 258
+ ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 4364) +2) 268
;;
DGN3500*)
ath9k_eeprom_extract "calibration" 61440 0
- ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 524 0 514
+ ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 524
;;
FRITZ3370)
ath9k_eeprom_extract "urlader" 2437 0
- ath9k_patch_firmware_mac "00:00:00:00:00:00" 2 0
+ ath9k_patch_fw_mac "00:00:00:00:00:00" 2
;;
FRITZ7320|FRITZ7360SL)
ath9k_eeprom_extract "urlader" 2437 0
- ath9k_patch_firmware_mac "00:00:00:00:00:00" 268 0 258
+ ath9k_patch_fw_mac_crc "00:00:00:00:00:00" 268
;;
TDW8970|TDW8980)
ath9k_eeprom_extract "boardconfig" 135168 0