mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-20 01:20:35 +08:00
Compare commits
2 Commits
8cb899e0fd
...
wifilife
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec14c79368 | ||
|
|
8b60cb1ab3 |
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=wifilife
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=d3b7410b262225edff6b6b10a3bfd4e6a63fe877
|
||||
PKG_SOURCE_VERSION:=c56c761795739a419cc766919304d32d16d24540
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
ifeq ($(CONFIG_WIFILIFE_OPEN),y)
|
||||
@@ -59,6 +59,8 @@ define Package/wifilife/install
|
||||
$(1)/etc/uci-defaults/997-wifilife-add-owsd-wifi
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wifiagent $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/nodexcluder $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/nodefinder $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,wifilife))
|
||||
|
||||
27
wifilife/files/nodefinder
Executable file
27
wifilife/files/nodefinder
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /tmp/nodefinder.pid ]; then
|
||||
kill -9 $(cat /tmp/nodefinder.pid) 2>/dev/null
|
||||
rm -f /tmp/nodefinder.pid
|
||||
fi
|
||||
|
||||
[ "$1" == "stop" ] && exit
|
||||
|
||||
radio5g=$(uci show wireless | grep "band='a'" | cut -d'.' -f2)
|
||||
wiface5g=$(uci show wireless | grep wifi-iface | grep "device='$radio5g'" | head -1 | cut -d'.' -f2)
|
||||
ifname5g="$(uci -q get wireless.$wiface5g.ifname)"
|
||||
ssid5g="$(uci -q get wireless.$wiface5g.ssid)"
|
||||
[ -n "$ssid5g" -a -n "$ifname5g" ] || exit
|
||||
|
||||
[ "$(uci -q get owsd.ubusproxy.enable)" == "1" ] || exit
|
||||
[ -f /usr/sbin/wlctl ] || exit
|
||||
|
||||
while true; do
|
||||
for wifix in $(ubus list | grep "/wifix"); do
|
||||
mac5g=$(ubus call $wifix status '{"vif":"rai0"}' | grep bssid | awk '{print$2}' | tr -d '",')
|
||||
wlctl -i $ifname5g rrm_nbr_list | grep -qi "$mac5g" || ubus call wifix scan "{\"radio\":\"$radio5g\",\"ssid\":\"$ssid5g\"}"
|
||||
done
|
||||
sleep 10
|
||||
done &
|
||||
|
||||
echo $! >/tmp/nodefinder.pid
|
||||
36
wifilife/files/nodexcluder
Executable file
36
wifilife/files/nodexcluder
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
if [ -f /tmp/nodexcluder.pid ]; then
|
||||
kill -9 $(cat /tmp/nodexcluder.pid) 2>/dev/null
|
||||
rm -f /tmp/nodexcluder.pid
|
||||
fi
|
||||
|
||||
[ "$1" == "stop" ] && exit
|
||||
|
||||
[ "$(uci -q get owsd.ubusproxy.enable)" == "1" ] || exit
|
||||
|
||||
MACS=""
|
||||
|
||||
ubus listen ubus.object.add | \
|
||||
while read event ; do
|
||||
json_load "$event"
|
||||
if json_select ubus.object.add >/dev/null; then
|
||||
json_get_var path path
|
||||
case $path in
|
||||
*/wifix)
|
||||
MAC=$(ubus call $path status '{"vif":"rai0"}' | grep bssid | awk '{print$2}' | tr -d '",')
|
||||
MACS="$MACS $MAC"
|
||||
for wa in $(ubus list | grep wifi.agent); do
|
||||
for mac in $MACS; do
|
||||
ubus call $wa cmd "{\"id\":3,\"data\":\"$mac\"}"
|
||||
done
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done &
|
||||
|
||||
echo $(($!-1)) $! >/tmp/nodexcluder.pid
|
||||
|
||||
@@ -19,10 +19,15 @@ start_service() {
|
||||
procd_set_param command ${PROG} -c -d -l
|
||||
fi
|
||||
procd_close_instance
|
||||
|
||||
nodexcluder
|
||||
nodefinder
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
nodexcluder stop
|
||||
nodefinder stop
|
||||
service_stop ${PROG}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user