fix b/g mode selection for madwifi, update documentation

SVN-Revision: 5973
This commit is contained in:
Felix Fietkau 2007-01-04 01:29:01 +00:00
parent 80c5a55e3e
commit c15d072541
2 changed files with 51 additions and 7 deletions

View file

@ -1,7 +1,9 @@
The WiFi settings are configured in the file \texttt{/etc/config/wireless} The WiFi settings are configured in the file \texttt{/etc/config/wireless}
(currently supported on Broadcom only). When booting the router for the first time (currently supported on Broadcom and Atheros). When booting the router for the first time
it should detect your card and create a sample configuration that looks like this: it should detect your card and create a sample configuration that looks like this:
\paragraph{Sample Broadcom wireless config:}
\begin{Verbatim} \begin{Verbatim}
config wifi-device "wl0" config wifi-device "wl0"
option type "broadcom" option type "broadcom"
@ -15,6 +17,22 @@ config wifi-iface
option encryption "none" option encryption "none"
\end{Verbatim} \end{Verbatim}
\paragraph{Sample Atheros wireless config:}
\begin{Verbatim}
config wifi-device "wifi0"
option type "atheros"
option channel "5"
option mode "11g"
config wifi-iface
option device "wifi0"
option mode "ap"
option ssid "OpenWrt"
option hidden "0"
option encryption "none"
\end{Verbatim}
There are two types of config sections in this file. The '\texttt{wifi-device}' refers to There are two types of config sections in this file. The '\texttt{wifi-device}' refers to
the physical wifi interface and '\texttt{wifi-iface}' configures a virtual interface on top the physical wifi interface and '\texttt{wifi-iface}' configures a virtual interface on top
of that (if supported by the driver). of that (if supported by the driver).
@ -25,11 +43,14 @@ of that (if supported by the driver).
\item \texttt{type} \\ \item \texttt{type} \\
The driver to use for this interface. The driver to use for this interface.
\item \texttt{mode} \\
The frequency band (\texttt{b}, \texttt{g}, \texttt{bg}, \texttt{a})
\item \texttt{country} \\ \item \texttt{country} \\
The country code used to determine the regulatory settings. The country code used to determine the regulatory settings.
\item \texttt{channel} \\ \item \texttt{channel} \\
The wifi channel (1-14, depending on your country setting). The wifi channel (e.g. 1-14, depending on your country setting).
\item \texttt{maxassoc} \\ \item \texttt{maxassoc} \\
Maximum number of associated clients Maximum number of associated clients
@ -56,6 +77,7 @@ of that (if supported by the driver).
WDS point-to-point link WDS point-to-point link
\end{itemize} \end{itemize}
\item \texttt{network} \\ \item \texttt{network} \\
Selects the interface section from \texttt{/etc/config/network} to be Selects the interface section from \texttt{/etc/config/network} to be
used with this interface used with this interface
@ -85,10 +107,10 @@ of that (if supported by the driver).
\paragraph{Limitations:} \paragraph{Limitations:}
Only the following mode combinations are supported:
\begin{itemize} \begin{itemize}
\item \textbf{Broadcom}: \\ \item \textbf{Broadcom}: \\
Only the following mode combinations are supported:
\begin{itemize} \begin{itemize}
\item 1x \texttt{sta}, 0-3x \texttt{ap} \item 1x \texttt{sta}, 0-3x \texttt{ap}
\item 1-4x \texttt{ap} \item 1-4x \texttt{ap}
@ -98,6 +120,13 @@ of that (if supported by the driver).
WDS links can only be used in pure AP mode and can't use WEP (except when sharing the WDS links can only be used in pure AP mode and can't use WEP (except when sharing the
settings with the master interface, which is done automatically). settings with the master interface, which is done automatically).
\item \textbf{Atheros}: \\
\begin{itemize}
\item 1x \texttt{sta}, 0-4x \texttt{ap}
\item 1-4x \texttt{ap}
\item 1x \texttt{adhoc}
\end{itemize}
\end{itemize} \end{itemize}

View file

@ -73,6 +73,7 @@ enable_atheros() {
config_get vifs "$device" vifs config_get vifs "$device" vifs
disable_atheros "$device" disable_atheros "$device"
local first=1
for vif in $vifs; do for vif in $vifs; do
nosbeacon= nosbeacon=
config_get ifname "$vif" ifname config_get ifname "$vif" ifname
@ -89,8 +90,22 @@ enable_atheros() {
} }
config_set "$vif" ifname "$ifname" config_set "$vif" ifname "$ifname"
[ "$first" = 1 ] && {
# only need to change freq band and channel on the first vif
config_get "$device" mode config_get "$device" mode
iwpriv "$ifname" mode "${mode:-11g}" pureg=0
case "$mode" in
*b) mode=11b;;
*bg) mode=11g;;
*g) mode=11g; pureg=1;;
*a) mode=11a;;
*) mode=11g;;
esac
iwconfig "$ifname" channel 0
iwpriv "$ifname" mode "$mode"
iwpriv "$ifname" pureg "$pureg"
iwconfig "$ifname" channel "$channel"
}
config_get wds "$vif" wds config_get wds "$vif" wds
case "$wds" in case "$wds" in
@ -120,7 +135,6 @@ enable_atheros() {
config_get ssid "$vif" ssid config_get ssid "$vif" ssid
;; ;;
esac esac
iwconfig "$ifname" channel "$channel"
ifconfig "$ifname" up ifconfig "$ifname" up
local net_cfg bridge local net_cfg bridge
@ -145,6 +159,7 @@ enable_atheros() {
# FIXME: implement wpa_supplicant calls here # FIXME: implement wpa_supplicant calls here
;; ;;
esac esac
first=0
done done
} }