summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2013-07-07 11:23:23 +0300
committerRoman Yeryomin <roman@advem.lv>2013-07-07 11:23:23 +0300
commit8c501c30deaaf309e5f8e976263a1b113443831b (patch)
tree7377c9cdb1ac83a5b7d4ee298582f1634ab16b69
parent984e5eb211a858be19f57d0186203b20758d846f (diff)
Fix wireless scripts. Closes #18.
Signed-off-by: Roman Yeryomin <roman@advem.lv>
-rw-r--r--package/hostapd-rtk/files/hostapd.sh30
-rwxr-xr-xtarget/linux/realtek/base-files/lib/wifi/realtek.sh63
2 files changed, 83 insertions, 10 deletions
diff --git a/package/hostapd-rtk/files/hostapd.sh b/package/hostapd-rtk/files/hostapd.sh
index 6fd95a9e3..45ce0af07 100644
--- a/package/hostapd-rtk/files/hostapd.sh
+++ b/package/hostapd-rtk/files/hostapd.sh
@@ -26,7 +26,7 @@ hostapd_set_bss_options() {
config_get max_num_sta "$device" max_num_sta
[ -n $max_num_sta ] && max_num_sta="31"
append "$var" "max_num_sta=$max_num_sta" "$N"
-
+
append "$var" "ctrl_interface=/var/run/hostapd-$phy" "$N"
append "$var" "wmm_enabled=1" "$N"
@@ -290,6 +290,34 @@ hostapd_setup_vif() {
hostapd_set_log_options hostapd_cfg "$device"
hostapd_set_bss_options hostapd_cfg "$vif"
+ if [ "$driver" = "realtek" ]; then
+ config_get htmode "$device" htmode
+ case "$htmode" in
+ *HT40-*)
+ append hostapd_cfg "use40M=1" "$N"
+ append hostapd_cfg "shortGI40M=1" "$N"
+ append hostapd_cfg "2ndchoffset=1" "$N"
+ ;;
+ *HT40+*)
+ append hostapd_cfg "use40M=1" "$N"
+ append hostapd_cfg "shortGI40M=1" "$N"
+ append hostapd_cfg "2ndchoffset=2" "$N"
+ ;;
+ *)
+ append hostapd_cfg "use40M=0" "$N"
+ append hostapd_cfg "shortGI40M=0" "$N"
+ append hostapd_cfg "2ndchoffset=0" "$N"
+ ;;
+ esac
+
+ # for 40MHz only mode
+ #TODO: enable after realtek merge with hostapd?
+ #append hostapd_cfg "coexist=0" "$N"
+
+ # enable Space-Time Block Coding for better throughput
+ append hostapd_cfg "stbc=1" "$N"
+ fi
+
case "$hwmode" in
*bg|*gdt|*gst|*fh) hwmode=g;;
*adt|*ast) hwmode=a;;
diff --git a/target/linux/realtek/base-files/lib/wifi/realtek.sh b/target/linux/realtek/base-files/lib/wifi/realtek.sh
index 7fc4745ae..1dd1b90d1 100755
--- a/target/linux/realtek/base-files/lib/wifi/realtek.sh
+++ b/target/linux/realtek/base-files/lib/wifi/realtek.sh
@@ -73,6 +73,7 @@ disable_realtek() (
echo disable_realtek phy=$phy device=$device
+ #doesn't work?
set_wifi_down "$device"
include /lib/network
@@ -86,8 +87,9 @@ disable_realtek() (
# done
echo unbridge "$phy"
-
unbridge "$phy"
+ ifconfig "$phy" down
+
return 0
)
@@ -117,7 +119,7 @@ enable_realtek() {
sta)
iwconfig "$phy" mode managed
config_get addr "$device" bssid
- [ -z "$addr" ] || {
+ [ -z "$addr" ] || {
iwconfig "$phy" ap "$addr"
}
;;
@@ -132,7 +134,7 @@ enable_realtek() {
[ -n "$rate" ] && iwconfig "$phy" rate "${rate%%.*}"
config_get_bool hidden "$vif" hidden 0
- iwpriv "$phy" enh_sec "$hidden"
+ iwpriv "$phy" set_mib hiddenAP="$hidden"
config_get frag "$vif" frag
[ -n "$frag" ] && iwconfig "$phy" frag "${frag%%.*}"
@@ -187,19 +189,59 @@ enable_realtek() {
local net_cfg bridge
net_cfg="$(find_net_config "$vif")"
- echo net_cfg=$net_cfg
+ echo net_cfg=$net_cfg > /dev/ttyS0
+ # dirty workaround for wlan0 not appearing when router is started
+ bridge="br-lan"
+
+ # set led to link/tx/rx (data,management) mode
+ # have to be here because router will lock in wlan0 will be up durig this
+ iwpriv "$ifname" set_mib led_type=11
+
+ sleep 4
+ brctl show > /dev/ttyS0
[ -z "$net_cfg" ] || {
- bridge="$(bridge_interface "$net_cfg")"
- echo vif=$vif bridge=$bridge
- echo tree config_set "$vif" bridge "$bridge"
+ #bridge="$(bridge_interface "$net_cfg")"
+ echo vif=$vif bridge=$bridge > /dev/ttyS0
+ echo tree config_set "$vif" bridge "$bridge" > /dev/ttyS0
config_set "$vif" bridge "$bridge"
- echo house start_net "$ifname" "$net_cfg"
+ echo house start_net "$ifname" "$net_cfg" > /dev/ttyS0
- set | grep CONFIG_
+ set | grep CONFIG_ > /dev/ttyS0
start_net "$ifname" "$net_cfg"
}
+ sleep 1
+ brctl show > /dev/ttyS0
+
+ # start hostapd anyway for now, it's much more stable than native ap mode
+ start_hostapd=1
+
+ [ -n "$start_hostapd" ] || {
+ config_get htmode "$device" htmode
+ case "$htmode" in
+ *HT40-*)
+ iwpriv "$ifname" set_mib use40M=1
+ iwpriv "$ifname" set_mib shortGI40M=1
+ iwpriv "$ifname" set_mib 2ndchoffset=1
+ ;;
+ *HT40+*)
+ iwpriv "$ifname" set_mib use40M=1
+ iwpriv "$ifname" set_mib shortGI40M=1
+ iwpriv "$ifname" set_mib 2ndchoffset=2
+ ;;
+ esac
+
+ # for 40MHz only mode
+ #TODO: enable after realtek merge with hostapd?
+ #iwpriw "$ifname" set_mib coexist=0
+ # enable Space-Time Block Coding for better throughput
+ #iwpriv "$ifname" set_mib stbc=1
+
+ #sleep 1
+ ifconfig "$ifname" up
+ }
+ #doesn't work?
set_wifi_up "$vif" "$ifname"
case "$mode" in
@@ -257,6 +299,9 @@ config wifi-device wlan$devidx
option type realtek
option channel 11
option macaddr $(cat /sys/class/net/${dev}/address)
+ #TODO: enable after realtek merge with hostapd
+ #option hwmode 11ng
+ option htmode HT40-
# UNCOMMENT THIS LINE TO DISABLE WIFI:
# option disabled 1