398ad79ecfd81bee41e9f352427026e5d8477a91
[openwrt.git] / target / linux / ramips / base-files / etc / hotplug.d / firmware / 10-rt2x00-eeprom
1 #!/bin/sh
2
3 rt2x00_eeprom_die() {
4 echo "rt2x00 eeprom: " "$*"
5 exit 1
6 }
7
8 rt2x00_eeprom_extract() {
9 local part=$1
10 local offset=$2
11 local count=$3
12 local mtd
13
14 . /etc/functions.sh
15
16 mtd=$(find_mtd_part $part)
17 [ -n "$mtd" ] || \
18 rt2x00_eeprom_die "no mtd device found for partition $part"
19
20 dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count || \
21 rt2x00_eeprom_die "failed to extract from $mtd"
22 }
23
24 [ -e /lib/firmware/$FIRMWARE ] && exit 0
25
26 case "$FIRMWARE" in
27 "RT288X.eeprom" | \
28 "RT305X.eeprom")
29 . /lib/ramips.sh
30
31 local board=$(ramips_board_name)
32
33 case $board in
34 dir-300-b1)
35 rt2x00_eeprom_extract "devdata" 16384 272
36 ;;
37
38 f5d8235v2 | \
39 fonera20n | \
40 hw550-3g | \
41 mofi3500-3gn | \
42 pwh2004 | \
43 rt-n15 | \
44 v22rw-2x2 | \
45 wcr150gn | \
46 whr-g300n)
47 rt2x00_eeprom_extract "factory" 0 272
48 ;;
49
50 *)
51 rt2x00_eeprom_die "board $board is not supported yet"
52 ;;
53 esac
54 ;;
55 esac
This page took 0.049936 seconds and 3 git commands to generate.