2015-03-20 12:15:40 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (C) 2015 OpenWrt.org
|
|
|
|
#
|
|
|
|
|
|
|
|
[ ! -e /etc/config/wireless ] && exit 0
|
|
|
|
|
2017-05-12 20:36:07 +00:00
|
|
|
. /lib/functions.sh
|
2015-12-10 12:13:16 +00:00
|
|
|
. /lib/functions/system.sh
|
2015-03-20 12:15:40 +00:00
|
|
|
|
2017-05-12 20:36:07 +00:00
|
|
|
board=$(board_name)
|
2015-03-20 12:15:40 +00:00
|
|
|
|
|
|
|
case "$board" in
|
2015-10-08 10:01:30 +00:00
|
|
|
armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-shelby|armada-xp-linksys-mamba)
|
2015-03-20 12:15:40 +00:00
|
|
|
SKU=$(strings /dev/mtd3|sed -ne 's/^cert_region=//p')
|
2015-12-10 12:13:16 +00:00
|
|
|
WIFIMAC2G=$(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
|
|
|
WIFIMAC5G=$(macaddr_add $WIFIMAC2G +1)
|
2015-03-20 12:15:40 +00:00
|
|
|
case "$SKU" in
|
2015-04-12 15:04:14 +00:00
|
|
|
AP)
|
|
|
|
REGD=CN
|
|
|
|
;;
|
|
|
|
AU)
|
|
|
|
REGD=AU
|
|
|
|
;;
|
|
|
|
CA)
|
|
|
|
REGD=CA
|
2015-03-20 12:15:40 +00:00
|
|
|
;;
|
|
|
|
EU)
|
|
|
|
REGD=DE
|
|
|
|
;;
|
2015-04-12 15:04:14 +00:00
|
|
|
US)
|
|
|
|
REGD=US
|
|
|
|
;;
|
2015-03-20 12:15:40 +00:00
|
|
|
esac
|
2015-12-10 12:13:16 +00:00
|
|
|
|
|
|
|
case "$board" in
|
|
|
|
armada-xp-linksys-mamba)
|
|
|
|
WIFIMAC0=$WIFIMAC2G
|
|
|
|
WIFIMAC1=$WIFIMAC5G
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
WIFIMAC0=$WIFIMAC5G
|
|
|
|
WIFIMAC1=$WIFIMAC2G
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2015-03-20 12:15:40 +00:00
|
|
|
uci get wireless.radio0.country || uci set wireless.radio0.country=$REGD
|
2015-12-10 12:13:16 +00:00
|
|
|
uci get wireless.@wifi-iface[0].macaddr || uci set wireless.@wifi-iface[0].macaddr=$WIFIMAC0
|
2015-03-20 12:15:40 +00:00
|
|
|
uci get wireless.radio1.country || uci set wireless.radio1.country=$REGD
|
2015-12-10 12:13:16 +00:00
|
|
|
uci get wireless.@wifi-iface[1].macaddr || uci set wireless.@wifi-iface[1].macaddr=$WIFIMAC1
|
2015-03-20 12:15:40 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
uci commit wireless
|
|
|
|
|
|
|
|
exit 0
|