mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-25 21:59:32 +00:00
6b042217d7
The mwlwifi driver sets the default country code for EU (fi-
rmware region code 0x30) certified devices to FR (France),
not DE (Germany). Whilst this is a trivial fix, novice users
may not know how mwlwifi negatively reacts to a non-matching
country code and may leave the setting alone. Especially si-
nce it is under the advanced settings section in LuCI.
Relevant mwlwifi driver code:
0a550312dd
The mwlwifi driver readme states "Please don't change country
code and let mwlwifi set it for you." However, OpenWrt's current
behaviour does not adhere to this with its default, 'just flashed
from factory' setting for EU devices.
Signed-off-by: Jose Olivera <oliverajeo@gmail.com>
[rebase, extend commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit d0e8b8310f7079ccf250f7eddbdf8b9d319c274d)
57 lines
1.0 KiB
Bash
57 lines
1.0 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Copyright (C) 2015 OpenWrt.org
|
|
#
|
|
|
|
[ ! -e /etc/config/wireless ] && exit 0
|
|
|
|
. /lib/functions.sh
|
|
. /lib/functions/system.sh
|
|
|
|
board=$(board_name)
|
|
|
|
case "$board" in
|
|
linksys,caiman|linksys,cobra|linksys,mamba|linksys,shelby|linksys,venom)
|
|
SKU=$(strings /dev/mtd3|sed -ne 's/^cert_region=//p')
|
|
WIFIMAC2G=$(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
|
WIFIMAC5G=$(macaddr_add $WIFIMAC2G +1)
|
|
case "$SKU" in
|
|
AP)
|
|
REGD=CN
|
|
;;
|
|
AU)
|
|
REGD=AU
|
|
;;
|
|
CA)
|
|
REGD=CA
|
|
;;
|
|
EU)
|
|
REGD=FR
|
|
;;
|
|
US)
|
|
REGD=US
|
|
;;
|
|
esac
|
|
|
|
case "$board" in
|
|
linksys,mamba)
|
|
WIFIMAC0=$WIFIMAC2G
|
|
WIFIMAC1=$WIFIMAC5G
|
|
;;
|
|
*)
|
|
WIFIMAC0=$WIFIMAC5G
|
|
WIFIMAC1=$WIFIMAC2G
|
|
;;
|
|
esac
|
|
|
|
uci get wireless.radio0.country || uci set wireless.radio0.country=$REGD
|
|
uci get wireless.@wifi-iface[0].macaddr || uci set wireless.@wifi-iface[0].macaddr=$WIFIMAC0
|
|
uci get wireless.radio1.country || uci set wireless.radio1.country=$REGD
|
|
uci get wireless.@wifi-iface[1].macaddr || uci set wireless.@wifi-iface[1].macaddr=$WIFIMAC1
|
|
;;
|
|
esac
|
|
|
|
uci commit wireless
|
|
|
|
exit 0
|