Changeset 1820
- Timestamp:
- 06/01/11 12:46:28 (2 years ago)
- Location:
- trunk/fon/fonbase
- Files:
-
- 2 added
- 1 removed
- 1 moved
-
files/lib (added)
-
files/lib/fon (added)
-
files/lib/fon/config.sh (moved) (moved from trunk/fon/fonbase/targets/f20n/lib/fon/config.sh) (7 diffs)
-
targets/f20/lib/fon/config.sh (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fon/fonbase/files/lib/fon/config.sh
r1819 r1820 5 5 6 6 lan_ifname="br-lan" 7 wifi_ifname=ra1 8 case "$ (cat /etc/fon_device)" in7 fon_device=$(cat /etc/fon_device) 8 case "$fon_device" in 9 9 fonera20n) 10 10 lan_devs="eth0.1" 11 11 mgmt_ifname="$lan_ifname" 12 12 wan_ifname="eth0.2" 13 wan_auto=0 14 wifi_device="rt3052" 13 15 wifi_ifname_mac="ra1" 14 wan_auto=0 16 wifi_ifname="ra1" 17 private_wifi_ifname="ra0" 18 wan_wifi_ifname="apcli0" 15 19 ;; 16 20 fonera20) … … 19 23 wan_ifname="eth0.1" 20 24 wan_auto=0 25 wifi_device="wifi0" 26 wifi_ifname="ath0" 27 private_wifi_ifname="ath1" 28 wan_wifi_ifname="ath2" 21 29 ;; 22 30 *) … … 28 36 29 37 get_serial() { 30 return dd if=$(find_mtd_part boardconfig) bs=$((0x1026)) skip=1 count=1 2>/dev/null | head -c10 38 case "$fon_device" in 39 fonera20n) 40 dd if=$(find_mtd_part boardconfig) bs=$((0x1026)) skip=1 count=1 2>/dev/null | head -c10 41 ;; 42 fonera20) 43 dd if=$(find_mtd_part boardconfig) bs=$((0x88)) skip=1 count=1 2>/dev/null | head -c10 44 ;; 45 esac 31 46 } 32 47 … … 106 121 } 107 122 [ "$proto" == "wifi" ] && { 108 uci_set "network" "wan" "ifname" " apcli0"123 uci_set "network" "wan" "ifname" "$wan_wifi_ifname" 109 124 proto=`uci get fon.wan.wmode` 110 125 } … … 157 172 158 173 config_wireless() { 159 E=`cat /proc/gpio_switch`160 174 local mode channel ssid encryption crypto wmode 161 175 export wifi_run=1 162 176 config_get channel advanced channel 163 177 config_get mode advanced bgmode 164 config_get ht advanced ht 165 config_get country advanced country 166 uci_add "wireless" "wifi-device" "rt3052" 167 uci_set "wireless" "rt3052" "type" "rt3052" 168 uci_set "wireless" "rt3052" "channel" "$channel" 169 uci_set "wireless" "rt3052" "ht" "${ht:-40}" 170 uci_set "wireless" "rt3052" "country" "${country:-ES}" 171 uci_set "wireless" "rt3052" "mode" "$mode" 172 uci_set "wireless" "rt3052" "disabled" "${E:-0}" 178 uci_add "wireless" "wifi-device" "$wifi_device" 179 uci_set "wireless" "$wifi_device" "channel" "$channel" 180 case $fon_device in 181 fonera20n) 182 config_get ht advanced ht 183 config_get country advanced country 184 uci_set "wireless" "$wifi_device" "type" "rt3052" 185 uci_set "wireless" "$wifi_device" "ht" "${ht:-40}" 186 uci_set "wireless" "$wifi_device" "country" "${country:-ES}" 187 uci_set "wireless" "$wifi_device" "mode" "$mode" 188 local wifi_switch=`cat /proc/gpio_switch` 189 uci_set "wireless" "$wifi_device" "disabled" "${wifi_switch:-0}" 190 ;; 191 fonera20) 192 config_get diversity advanced diversity 193 config_get rtxant advanced rtxant 194 case "$mode" in 195 B|b) mode=11b;; 196 G|g) mode=11g;; 197 *) mode=auto;; 198 esac 199 uci_set "wireless" "$wifi_device" "type" "atheros" 200 uci_set "wireless" "$wifi_device" "mode" "$mode" 201 uci_set "wireless" "$wifi_device" "diversity" "$diversity" 202 uci_set "wireless" "$wifi_device" "rxantenna" "$rtxant" 203 uci_set "wireless" "$wifi_device" "txantenna" "$rtxant" 204 uci_remove "wireless" "$wifi_device" "disabled" 2> /dev/null 205 ;; 206 esac 173 207 174 208 uci_remove "wireless" "public" 175 209 uci_add "wireless" "wifi-iface" "public" 176 uci_set "wireless" "public" "device" " rt3052"177 uci_set "wireless" "public" "ifname" " ra1"210 uci_set "wireless" "public" "device" "$wifi_device" 211 uci_set "wireless" "public" "ifname" "$wifi_ifname" 178 212 uci_set "wireless" "public" "network" "hotspotwifi" 213 uci_set "wireless" "public" "mode" "ap" 179 214 uci_set "wireless" "public" "ssid" "off" 180 215 uci_set "wireless" "public" "hidden" "0" 181 216 uci_set "wireless" "public" "encryption" "none" 217 182 218 config_get ssid private essid 183 219 config_get encryption private encryption 184 220 config_get wpa_crypto private wpa_crypto 185 221 uci_add "wireless" "wifi-iface" "private" 186 uci_set "wireless" "private" "device" " rt3052"187 uci_set "wireless" "private" "ifname" " ra0"222 uci_set "wireless" "private" "device" "$wifi_device" 223 uci_set "wireless" "private" "ifname" "$private_wifi_ifname" 188 224 uci_set "wireless" "private" "network" "lan" 225 uci_set "wireless" "private" "mode" "ap" 189 226 uci_set "wireless" "private" "ssid" "$ssid" 190 227 uci_set "wireless" "private" "hidden" "0" 191 228 case "$encryption" in 192 229 wpa*|WPA*|Mixed|mixed) 230 case "$fon_device" in 231 # The ra_wifi and madwifi / hostapd 232 # driver scripts accept their wpa 233 # parameters in different formats. 234 # Perhaps this should be unified 235 # sometime. 236 fonera20n) 237 uci_set "wireless" "private" "encryption" "$encryption" 238 uci_set "wireless" "private" "wpa_crypto" "$wpa_crypto" 239 ;; 240 fonera20) 241 case "$encryption" in 242 WPA|WPA1|wpa|wpa1) enc=psk;; 243 WPA2|wpa2) enc=psk2;; 244 Mixed|mixed) enc=psk-mixed;; 245 esac 246 uci_set "wireless" "private" "encryption" "$enc${wpa_crypto:+/$wpa_crypto}" 247 ;; 248 esac 193 249 pwd=`/sbin/uci get fon.private.password` 194 uci_set "wireless" "private" "encryption" "$encryption"195 250 uci_set "wireless" "private" "key" "$pwd" 196 uci_set "wireless" "private" "wpa_crypto" "$wpa_crypto"197 251 ;; 198 252 WEP|wep) … … 212 266 config_get ssid wan ssid 213 267 config_get auth wan auth 214 config_get crypto wan crypto215 268 config_get channel wan channel 216 269 uci_add "wireless" "wifi-iface" "uplink" 217 uci_set "wireless" "uplink" "device" " rt3052"218 uci_set "wireless" "uplink" "ifname" " apcli0"270 uci_set "wireless" "uplink" "device" "$wifi_device" 271 uci_set "wireless" "uplink" "ifname" "$wan_wifi_ifname" 219 272 uci_set "wireless" "uplink" "network" "wan" 220 273 uci_set "wireless" "uplink" "mode" "sta" 221 274 uci_set "wireless" "uplink" "ssid" "$ssid" 222 275 uci_set "wireless" "uplink" "hidden" "0" 223 uci_set "wireless" "rt3052" "channel" "$channel" 276 # TODO: Is this needed just for 2.0n? 277 [ "$fon_device" = "fonera20n" ] && uci_set "wireless" "$wifi_device" "channel" "$channel" 224 278 case "$auth" in 225 279 wpa*|WPA*|Mixed|mixed) 226 case "$auth" in 227 WPA|WPA1|wpa|wpa1) enc=WPAPSK;; 228 *) enc=WPA2PSK;; 280 case "$fon_device" in 281 fonera20n) 282 case "$auth" in 283 WPA|WPA1|wpa|wpa1) enc=WPAPSK;; 284 *) enc=WPA2PSK;; 285 esac 286 config_get crypto wan crypto 287 case "$crypto" in 288 aes|AES) crypt=AES;; 289 *) crypt=TKIP;; 290 esac 291 uci_set "wireless" "uplink" "wpa_crypto" "$crypt" 292 ;; 293 fonera20) 294 case "$auth" in 295 WPA|WPA1|wpa|wpa1) enc=psk;; 296 WPA2|wpa2) enc=psk2;; 297 Mixed|mixed) enc=psk-mixed;; 298 esac 299 ;; 229 300 esac 230 case "$crypto" in 231 aes|AES) crypt=AES;; 232 *) crypt=TKIP;; 233 esac 301 uci_set "wireless" "uplink" "encryption" "$enc" 234 302 pwd=`/sbin/uci get fon.wan.psk` 235 uci_set "wireless" "uplink" "encryption" "$enc"236 303 uci_set "wireless" "uplink" "key" "$pwd" 237 uci_set "wireless" "uplink" "wpa_crypto" "$crypt"238 304 ;; 239 305 WEP|wep) … … 263 329 264 330 config_fon() { 265 serial=` dd if=$(find_mtd_part boardconfig) bs=$((0x1026)) skip=1 count=1 2>/dev/null | head -c10`331 serial=`get_serial` 266 332 uci_set "fon" "private" "password" "$serial" 267 333 uci_set "system" "fon" "serial" "$serial"
