我将 OpenWRT 安装到 TP-Link WR841ND 中。一切都按预期工作,但我无法让 wifi 开关工作。我按照上面描述的指南进行操作该路由器的 OpenWRT 页面。当我打开或关闭开关时,脚本/etc/hotplug.d/button/
根本不会被执行。
可能是什么原因?是否缺少某些软件包或内核模块?
我安装的包:
base-files - 117-r36088
busybox - 1.19.4-6
dnsmasq - 2.62-2
dropbear - 2011.54-2
firewall - 2-55.1
hotplug2 - 1.0-beta-4
iptables - 1.4.10-4
iw - 3.6-1
jshn - 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8
kernel - 3.3.8-1-d6597ebf6203328d3519ea3c3371a493
kmod-ath - 3.3.8+2012-09-07-3
kmod-ath9k - 3.3.8+2012-09-07-3
kmod-ath9k-common - 3.3.8+2012-09-07-3
kmod-cfg80211 - 3.3.8+2012-09-07-3
kmod-crypto-aes - 3.3.8-1
kmod-crypto-arc4 - 3.3.8-1
kmod-crypto-core - 3.3.8-1
kmod-gpio-button-hotplug - 3.3.8-1
kmod-ipt-conntrack - 3.3.8-1
kmod-ipt-core - 3.3.8-1
kmod-ipt-nat - 3.3.8-1
kmod-ipt-nathelper - 3.3.8-1
kmod-leds-gpio - 3.3.8-1
kmod-ledtrig-default-on - 3.3.8-1
kmod-ledtrig-netdev - 3.3.8-1
kmod-ledtrig-timer - 3.3.8-1
kmod-ledtrig-usbdev - 3.3.8-1
kmod-lib-crc-ccitt - 3.3.8-1
kmod-mac80211 - 3.3.8+2012-09-07-3
kmod-nls-base - 3.3.8-1
kmod-ppp - 3.3.8-1
kmod-pppoe - 3.3.8-1
kmod-pppox - 3.3.8-1
kmod-usb-core - 3.3.8-1
kmod-usb-ohci - 3.3.8-1
kmod-usb2 - 3.3.8-1
kmod-wdt-ath79 - 3.3.8-1
libblobmsg-json - 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8
libc - 0.9.33.2-1
libgcc - 4.6-linaro-1
libip4tc - 1.4.10-4
libiwinfo - 36
libiwinfo-lua - 36
libjson - 0.9-2
liblua - 5.1.4-8
libnl-tiny - 0.1-3
libubox - 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8
libubus - 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50
libubus-lua - 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50
libuci - 2013-01-04.1-1
libuci-lua - 2013-01-04.1-1
libxtables - 1.4.10-4
lua - 5.1.4-8
luci - 0.11.1-1
luci-app-firewall - 0.11.1-1
luci-i18n-english - 0.11.1-1
luci-lib-core - 0.11.1-1
luci-lib-ipkg - 0.11.1-1
luci-lib-nixio - 0.11.1-1
luci-lib-sys - 0.11.1-1
luci-lib-web - 0.11.1-1
luci-mod-admin-core - 0.11.1-1
luci-mod-admin-full - 0.11.1-1
luci-proto-core - 0.11.1-1
luci-proto-ppp - 0.11.1-1
luci-sgi-cgi - 0.11.1-1
luci-theme-base - 0.11.1-1
luci-theme-openwrt - 0.11.1-1
mtd - 18.1
netifd - 2013-01-29.2-4bb99d4eb462776336928392010b372236ac3c93
opkg - 618-3
ppp - 2.4.5-8
ppp-mod-pppoe - 2.4.5-8
swconfig - 10
uboot-envtools - 2012.04.01-1
ubus - 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50
ubusd - 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50
uci - 2013-01-04.1-1
uhttpd - 2012-10-30-e57bf6d8bfa465a50eea2c30269acdfe751a46fd
wifitoggle - 1-3
wpad-mini - 20120910-1
内核模块:
Module Size Used by Tainted: G
ath79_wdt 2240 1
ohci_hcd 16160 0
ledtrig_usbdev 2032 0
ledtrig_netdev 3184 0
nf_nat_irc 784 0
nf_conntrack_irc 2464 1 nf_nat_irc
nf_nat_ftp 976 0
nf_conntrack_ftp 4416 1 nf_nat_ftp
ipt_MASQUERADE 976 1
iptable_nat 2544 1
nf_nat 10256 4 nf_nat_irc,nf_nat_ftp,ipt_MASQUERADE,iptable_nat
pppoe 7488 0
xt_conntrack 2048 3
xt_CT 1216 0
xt_NOTRACK 448 0
iptable_raw 560 1
xt_state 608 0
nf_conntrack_ipv4 4384 6 iptable_nat,nf_nat
nf_defrag_ipv4 656 1 nf_conntrack_ipv4
nf_conntrack 38336 12 nf_nat_irc,nf_conntrack_irc,nf_nat_ftp,nf_conntrack_ftp,ipt_MASQUERADE,iptable_nat,nf_nat,xt_conntrack,xt_CT,xt_NOTRACK,xt_state,nf_conntrack_ipv4
ehci_hcd 33632 0
pppox 1152 1 pppoe
ipt_REJECT 1808 2
xt_TCPMSS 2560 1
ipt_LOG 6160 0
xt_comment 400 0
xt_multiport 1104 0
xt_mac 528 0
xt_limit 944 1
iptable_mangle 832 1
iptable_filter 592 1
ip_tables 8864 4 iptable_nat,iptable_raw,iptable_mangle,iptable_filter
xt_tcpudp 1632 4
x_tables 9984 18 ipt_MASQUERADE,iptable_nat,xt_conntrack,xt_CT,xt_NOTRACK,iptable_raw,xt_state,ipt_REJECT,xt_TCPMSS,ipt_LOG,xt_comment,xt_multiport,xt_mac,xt_limit,iptable_mangle,iptable_filter,ip_tables,xt_tcpudp
ppp_async 5952 0
ppp_generic 18848 3 pppoe,pppox,ppp_async
slhc 4368 1 ppp_generic
ath9k 84944 0
ath9k_common 1152 1 ath9k
ath9k_hw 329024 2 ath9k,ath9k_common
ath 14320 3 ath9k,ath9k_common,ath9k_hw
mac80211 252240 1 ath9k
usbcore 99200 4 ohci_hcd,ledtrig_usbdev,ehci_hcd
usb_common 480 1 usbcore
nls_base 4640 1 usbcore
crc_ccitt 944 1 ppp_async
cfg80211 153696 3 ath9k,ath,mac80211
compat 5776 5 ath9k,ath9k_common,ath9k_hw,mac80211,cfg80211
arc4 768 2
aes_generic 29808 0
crypto_algapi 9200 2 arc4,aes_generic
ledtrig_timer 1072 0
ledtrig_default_on 416 0
leds_gpio 1552 0
gpio_button_hotplug 3184 0
答案1
我升级到 OpenWRT 15.05.1,经过一番摆弄后,这似乎有效:我创建了一个脚本,其中/etc/hotplug.d/button/50-wifiswitch
包含
#/bin/sh
if [ "$BUTTON" = "rfkill" ] ; then
if [ "$ACTION" = "released" ] ; then
logger "Disabling wifi"
uci set 'wireless.@wifi-device[0].disabled=1'
elif [ "$ACTION" = "pressed" ] ; then
logger "Enabling wifi"
uci set 'wireless.@wifi-device[0].disabled=0'
else
logger "Unknown action: $ACTION"
exit 1
fi
wifi
fi
注意事项:
- 按钮名称为
rfkill
。 - 它实际上是一个开关,而不是切换按钮,因此 wifi 状态是由“按下”/“释放”决定的,而不是切换的。
答案2
您可能会遇到这个问题,因为 hotplug 正在被 procd 包取代,更多信息以及如何让按钮工作在这里: http://wiki.openwrt.org/doc/howto/hardware.button
当您的按钮正常工作时,请更新 wiki。