Root/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom

1#!/bin/sh
2
3ath9k_eeprom_die() {
4    echo "ath9k eeprom: " "$*"
5    exit 1
6}
7
8ath9k_eeprom_extract() {
9    local part=$1
10    local offset=$2
11    local count=$3
12    local mtd
13
14    . /lib/functions.sh
15
16    mtd=$(find_mtd_chardev $part)
17    [ -n "$mtd" ] || \
18        ath9k_eeprom_die "no mtd device found for partition $part"
19
20    dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
21        ath9k_eeprom_die "failed to extract from $mtd"
22}
23
24[ -e /lib/firmware/$FIRMWARE ] && exit 0
25
26. /lib/ar71xx.sh
27
28board=$(ar71xx_board_name)
29
30case "$FIRMWARE" in
31"soc_wmac.eeprom")
32    case $board in
33    wndr4300)
34        ath9k_eeprom_extract "caldata" 4096 2048
35        ;;
36    *)
37        ath9k_eeprom_die "board $board is not supported yet"
38        ;;
39    esac
40    ;;
41
42"pci_wmac0.eeprom")
43    case $board in
44    wndr4300)
45        ath9k_eeprom_extract "caldata" 20480 2048
46        ;;
47    *)
48        ath9k_eeprom_die "board $board is not supported yet"
49        ;;
50    esac
51    ;;
52esac
53

Archive Download this file



interactive