亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 23171 | 回復(fù): 6
打印 上一主題 下一主題

[其它] OpenWRT 信道自動(dòng)選擇 [復(fù)制鏈接]

論壇徽章:
40
水瓶座
日期:2013-08-15 11:26:422015年辭舊歲徽章
日期:2015-03-03 16:54:152015年亞洲杯之烏茲別克斯坦
日期:2015-03-27 14:01:172015年亞洲杯之約旦
日期:2015-03-31 15:06:442015亞冠之首爾
日期:2015-06-16 23:24:37IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-07-01 22:20:002015亞冠之德黑蘭石油
日期:2015-07-08 09:32:07IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-08-29 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-08-29 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-10-10 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-10-11 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-11-10 06:20:00
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2013-10-13 23:52 |只看該作者 |倒序?yàn)g覽
現(xiàn)在Openwrt的信道 auto 模式總是自動(dòng)鎖定在 1 上,其實(shí)這個(gè)是很久的問題,這里是啟動(dòng)腳本 修改則個(gè)加上自己的信道選擇算法 就可以自動(dòng)選擇信道了
  1. #!/bin/sh
  2. # Copyright (C) 2006 OpenWrt.org

  3. DEBUG=off

  4. . /lib/functions.sh

  5. usage() {
  6.     cat <<EOF
  7. Usage: $0 [down|detect]
  8. enables (default), disables or detects a wifi configuration.
  9. EOF
  10.     exit 1
  11. }
  12. find_net_config() {(

  13. best=$(autochannel)
  14. uci_channel=$(uci get wireless.radio0.channel)                        
  15. if [ "$uci_channel" = "auto" ];then                                   
  16.         channel=$best;                                          
  17.         orig=$(cat /var/run/hostapd-phy0.conf | grep "channel=")      
  18.         if [ -z $orig ];then                                          
  19.                 $orig='channel=1'                                    
  20.         fi                                                            
  21.         sed -i "s/$orig/channel=$channel/g" /var/run/hostapd-phy0.conf
  22. fi   
  23.         
  24.     local vif="$1"
  25.     local cfg
  26.     local ifname
  27.     config_get cfg "$vif" network
  28.     [ -z "$cfg" ] && {
  29.         include /lib/network
  30.         scan_interfaces
  31.         config_get ifname "$vif" ifname
  32.         cfg="$(find_config "$ifname")"
  33.     }
  34.     [ -z "$cfg" ] && return 0
  35.     echo "$cfg"
  36. )}
  37. bridge_interface() {(
  38.     local cfg="$1"
  39.     [ -z "$cfg" ] && return 0
  40.     include /lib/network
  41.     scan_interfaces
  42.     for cfg in $cfg; do
  43.         config_get iftype "$cfg" type
  44.         [ "$iftype" = bridge ] && config_get "$cfg" ifname
  45.         prepare_interface_bridge "$cfg"
  46.         return $?
  47.     done
  48. )}
  49. prepare_key_wep() {
  50.     local key="$1"
  51.     local hex=1
  52.     echo -n "$key" | grep -qE "[^a-fA-F0-9]" && hex=0
  53.     [ "${#key}" -eq 10 -a $hex -eq 1 ] || \
  54.     [ "${#key}" -eq 26 -a $hex -eq 1 ] || {
  55.         [ "${key:0:2}" = "s:" ] && key="${key#s:}"
  56.             key="$(echo -n "$key" | hexdump -ve '1/1 "%02x" ""')"
  57.     }
  58.     echo "$key"
  59. }
  60. wifi_fixup_hwmode() {
  61.     local device="$1"
  62.     local default="$2"
  63.     local hwmode hwmode_11n
  64.     config_get channel "$device" channel
  65.    
  66.     config_get hwmode "$device" hwmode
  67.     case "$hwmode" in
  68.         11bg) hwmode=bg;;
  69.         11a) hwmode=a;;
  70.         11b) hwmode=b;;
  71.         11g) hwmode=g;;
  72.         11n*)
  73.             hwmode_11n="${hwmode##11n}"
  74.             case "$hwmode_11n" in
  75.                 a|g) ;;
  76.                 default) hwmode_11n="$default"
  77.             esac
  78.             config_set "$device" hwmode_11n "$hwmode_11n"
  79.         ;;
  80.         *)
  81.             hwmode=
  82.             if [ "${channel:-0}" -gt 0 ]; then
  83.                 if [ "${channel:-0}" -gt 14 ]; then
  84.                     hwmode=a
  85.                 else
  86.                     hwmode=g
  87.                 fi
  88.             else
  89.                 hwmode="$default"
  90.             fi
  91.         ;;
  92.     esac
  93.     config_set "$device" hwmode "$hwmode"
  94. }
  95. wifi_updown() {
  96.     [ enable = "$1" ] && {
  97.         wifi_updown disable "$2"
  98.         scan_wifi
  99.     }
  100.     for device in ${2:-$DEVICES}; do (
  101.         config_get disabled "$device" disabled
  102.         [ 1 == "$disabled" ] && {
  103.             echo "'$device' is disabled"
  104.             set disable
  105.         }
  106.         config_get iftype "$device" type
  107.         if eval "type ${1}_$iftype" 2>/dev/null >/dev/null; then
  108.             eval "scan_$iftype '$device'"
  109.             eval "${1}_$iftype '$device'" || echo "$device($iftype): ${1} failed"
  110.         else
  111.             echo "$device($iftype): Interface type not supported"
  112.         fi
  113.     ); done
  114. }
  115. wifi_detect() {
  116.     for driver in ${2:-$DRIVERS}; do (
  117.         if eval "type detect_$driver" 2>/dev/null >/dev/null; then
  118.             eval "detect_$driver" || echo "$driver: Detect failed" >&2
  119.         else
  120.             echo "$driver: Hardware detection not supported" >&2
  121.         fi
  122.     ); done
  123. }
  124. start_net() {(
  125.     local iface="$1"
  126.     local config="$2"
  127.     local vifmac="$3"
  128.     [ -f "/var/run/$iface.pid" ] && kill "$(cat /var/run/${iface}.pid)" 2>/dev/null
  129.     [ -z "$config" ] || {
  130.         include /lib/network
  131.         scan_interfaces
  132.         for config in $config; do
  133.             setup_interface "$iface" "$config" "" "$vifmac"
  134.         done
  135.     }
  136. )}
  137. set_wifi_up() {
  138.     local cfg="$1"
  139.     local ifname="$2"
  140.     uci_set_state wireless "$cfg" up 1
  141.     uci_set_state wireless "$cfg" ifname "$ifname"
  142. }
  143. set_wifi_down() {
  144.     local cfg="$1"
  145.     local vifs vif vifstr
  146.     [ -f "/var/run/wifi-${cfg}.pid" ] &&
  147.         kill "$(cat "/var/run/wifi-${cfg}.pid")" 2>/dev/null
  148.     uci_revert_state wireless "$cfg"
  149.     config_get vifs "$cfg" vifs
  150.     for vif in $vifs; do
  151.         uci_revert_state wireless "$vif"
  152.     done
  153. }
  154. scan_wifi() {
  155.     local cfgfile="$1"
  156.     DEVICES=
  157.     config_cb() {
  158.         local type="$1"
  159.         local section="$2"
  160.         # section start
  161.         case "$type" in
  162.             wifi-device)
  163.                 append DEVICES "$section"
  164.                 config_set "$section" vifs ""
  165.                 config_set "$section" ht_capab ""
  166.             ;;
  167.         esac
  168.         # section end
  169.         config_get TYPE "$CONFIG_SECTION" TYPE
  170.         case "$TYPE" in
  171.             wifi-iface)
  172.                 config_get device "$CONFIG_SECTION" device
  173.                 config_get vifs "$device" vifs
  174.                 append vifs "$CONFIG_SECTION"
  175.                 config_set "$device" vifs "$vifs"
  176.             ;;
  177.         esac
  178.     }
  179.     config_load "${cfgfile:-wireless}"
  180. }
  181. DEVICES=
  182. DRIVERS=
  183. include /lib/wifi
  184. scan_wifi
  185. case "$1" in
  186.     down) wifi_updown "disable" "$2";;
  187.     detect) wifi_detect "$2";;
  188.     --help|help) usage;;
  189.     *) wifi_updown "enable" "$2";;
  190. esac
復(fù)制代碼

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2013-10-14 20:02 |只看該作者
贊一個(gè)

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2013-12-06 09:36 |只看該作者
你好,我想問問,你的這個(gè)腳本是要修改那一個(gè)文件的呢???

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2013-12-29 17:52 |只看該作者
回復(fù) 3# nan1888

一般在/lib/wifi/目錄下都會(huì)有一個(gè)驅(qū)動(dòng)腳本,你可以自己寫一個(gè)wlan.sh腳本,讀取/etc/config/wireless配置文件
得到無線網(wǎng)卡信息,如驅(qū)動(dòng)信息,然后映射到/lib/wifi/下的驅(qū)動(dòng)腳本操作函數(shù)就可以了。


   

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2014-02-12 13:20 |只看該作者
回復(fù) 4# ssjmhyvi 那你文章里的腳本是在哪里的呢???


   

論壇徽章:
8
2015年辭舊歲徽章
日期:2015-03-03 16:54:15午馬
日期:2015-02-04 12:00:07羊年新春福章
日期:2015-02-04 11:57:56雙子座
日期:2014-12-02 11:44:59金牛座
日期:2014-10-08 16:47:08獅子座
日期:2014-08-29 13:37:46巳蛇
日期:2014-08-26 17:32:29NBA常規(guī)賽紀(jì)念章
日期:2015-05-04 22:32:03
6 [報(bào)告]
發(fā)表于 2014-03-20 09:34 |只看該作者
樓主高手,學(xué)習(xí)了。

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2014-03-20 13:18 |只看該作者
真不錯(cuò)的想法,也很實(shí)用!
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP