summaryrefslogtreecommitdiff
path: root/package/madwifi
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-03-26 16:56:39 +0000
committerFelix Fietkau <nbd@openwrt.org>2011-03-26 16:56:39 +0000
commit2c875b2edcc906567e1e97d5bde46719498ad631 (patch)
treecb86b244d81d48a09f6b79b2c04015a435cd8dbb /package/madwifi
parent6c7170b923273c768a8afcc7f9f83803f9ebf74e (diff)
downloadmtk-20170518-2c875b2edcc906567e1e97d5bde46719498ad631.zip
mtk-20170518-2c875b2edcc906567e1e97d5bde46719498ad631.tar.gz
mtk-20170518-2c875b2edcc906567e1e97d5bde46719498ad631.tar.bz2
madwifi: add support for translating country codes into internal country code numbers (based on a patch by Manuel Munz)
SVN-Revision: 26306
Diffstat (limited to 'package/madwifi')
-rwxr-xr-xpackage/madwifi/files/lib/wifi/madwifi.sh16
-rw-r--r--package/madwifi/files/lib/wifi/madwifi_countrycodes.txt239
2 files changed, 249 insertions, 6 deletions
diff --git a/package/madwifi/files/lib/wifi/madwifi.sh b/package/madwifi/files/lib/wifi/madwifi.sh
index a5a63f7..21a5cf7 100755
--- a/package/madwifi/files/lib/wifi/madwifi.sh
+++ b/package/madwifi/files/lib/wifi/madwifi.sh
@@ -79,7 +79,7 @@ disable_atheros() (
config_get phy "$device" phy
set_wifi_down "$device"
-
+
include /lib/network
cd /proc/sys/net
for dev in *; do
@@ -104,8 +104,12 @@ enable_atheros() {
[ -n "$regdomain" ] && echo "$regdomain" > /proc/sys/dev/$phy/regdomain
config_get country "$device" country
- [ -z "$country" ] && country="0"
- echo "$country" > /proc/sys/dev/$phy/countrycode
+ case "$country" in
+ [A-Za-z]*) country=`grep -i "$country" /lib/wifi/madwifi_countrycodes.txt |cut -d " " -f 2`;;
+ [0-9]*) ;;
+ *) country="" ;;
+ esac
+ [ -n "$country" ] && echo "$country" > /proc/sys/dev/$phy/countrycode
config_get_bool outdoor "$device" outdoor "0"
echo "$outdoor" > /proc/sys/dev/$phy/outdoor
@@ -165,7 +169,7 @@ enable_atheros() {
esac
;;
esac
-
+
[ -x "$(which gpioctl 2>/dev/null)" ] || antenna=
gpioctl "dirout" "$antgpio" >/dev/null 2>&1
case "$gpioval" in
@@ -192,12 +196,12 @@ enable_atheros() {
config_get enc "$vif" encryption
config_get eap_type "$vif" eap_type
config_get mode "$vif" mode
-
+
case "$mode" in
sta) config_get_bool nosbeacon "$device" nosbeacon;;
adhoc) config_get_bool nosbeacon "$vif" sw_merge 1;;
esac
-
+
[ "$nosbeacon" = 1 ] || nosbeacon=""
ifname=$(wlanconfig "$ifname" create wlandev "$phy" wlanmode "$mode" ${nosbeacon:+nosbeacon})
[ $? -ne 0 ] && {
diff --git a/package/madwifi/files/lib/wifi/madwifi_countrycodes.txt b/package/madwifi/files/lib/wifi/madwifi_countrycodes.txt
new file mode 100644
index 0000000..624048b
--- /dev/null
+++ b/package/madwifi/files/lib/wifi/madwifi_countrycodes.txt
@@ -0,0 +1,239 @@
+AF 4
+AL 8
+DZ 12
+AS 16
+AD 20
+AO 24
+AI 660
+AQ 10
+AG 28
+AR 32
+AM 51
+AW 533
+AU 36
+AT 40
+AZ 31
+BS 44
+BH 48
+BD 50
+BB 52
+BY 112
+BE 56
+BZ 84
+BJ 204
+BM 60
+BT 64
+BO 68
+BA 70
+BW 72
+BV 74
+BR 76
+IO 86
+VG 92
+BN 96
+BG 100
+BF 854
+BI 108
+KH 116
+CM 120
+CA 124
+CV 132
+KY 136
+CF 140
+TD 148
+CL 152
+CN 156
+CX 162
+CC 166
+CO 170
+KM 174
+CD 180
+CG 178
+CK 184
+CR 188
+CI 384
+CU 192
+CY 196
+CZ 203
+DK 208
+DJ 262
+DM 212
+DO 214
+EC 218
+EG 818
+SV 222
+GQ 226
+ER 232
+EE 233
+ET 231
+FO 234
+FK 238
+FJ 242
+FI 246
+FR 250
+GF 254
+PF 258
+TF 260
+GA 266
+GM 270
+GE 268
+DE 276
+GH 288
+GI 292
+GR 300
+GL 304
+GD 308
+GP 312
+GU 316
+GT 320
+GN 324
+GW 624
+GY 328
+HT 332
+HM 334
+VA 336
+HN 340
+HK 344
+HR 191
+HU 348
+IS 352
+IN 356
+ID 360
+IR 364
+IQ 368
+IE 372
+IL 376
+IT 380
+JM 388
+JP 392
+JO 400
+KZ 398
+KE 404
+KI 296
+KP 408
+KR 410
+KW 414
+KG 417
+LA 418
+LV 428
+LB 422
+LS 426
+LR 430
+LY 434
+LI 438
+LT 440
+LU 442
+MO 446
+MK 807
+MG 450
+MW 454
+MY 458
+MV 462
+ML 466
+MT 470
+MH 584
+MQ 474
+MR 478
+MU 480
+YT 175
+MX 484
+FM 583
+MD 498
+MC 492
+MN 496
+MS 500
+MA 504
+MZ 508
+MM 104
+NA 516
+NR 520
+NP 524
+AN 530
+NL 528
+NC 540
+NZ 554
+NI 558
+NE 562
+NG 566
+NU 570
+NF 574
+MP 580
+NO 578
+OM 512
+PK 586
+PW 585
+PS 275
+PA 591
+PG 598
+PY 600
+PE 604
+PH 608
+PN 612
+PL 616
+PT 620
+PR 630
+QA 634
+RE 638
+RO 642
+RU 643
+RW 646
+SH 654
+KN 659
+LC 662
+PM 666
+VC 670
+WS 882
+SM 674
+ST 678
+SA 682
+SN 686
+CS 891
+SC 690
+SL 694
+SG 702
+SK 703
+SI 705
+SB 90
+SO 706
+ZA 710
+GS 239
+ES 724
+LK 144
+SD 736
+SR 740
+SJ 744
+SZ 748
+SE 752
+CH 756
+SY 760
+TW 158
+TJ 762
+TZ 834
+TH 764
+TL 626
+TG 768
+TK 772
+TO 776
+TT 780
+TN 788
+TR 792
+TM 795
+TC 796
+TV 798
+VI 850
+UG 800
+UA 804
+AE 784
+GB 826
+UM 581
+US 840
+UY 858
+UZ 860
+VU 548
+VE 862
+VN 704
+WF 876
+EH 732
+YE 887
+ZM 894
+ZW 716