layer2interface: dsl hotplug scripts

This commit is contained in:
Sukru Senli 2017-12-26 13:19:30 +01:00
parent dcb010903d
commit faf327efea
2 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,22 @@
include /lib/network
if [ "ADSL" == "$INTERFACE" -o "VDSL2" == "$INTERFACE" ]; then
if [ "ADSL" == "$INTERFACE" ]; then
if [ "$ACTION" == "remove" ]; then
uci_toggle_state layer2_interface adsl device down
else
uci_toggle_state layer2_interface adsl device up
fi
fi
if [ "VDSL2" == "$INTERFACE" ]; then
if [ "$ACTION" == "remove" ]; then
uci_toggle_state layer2_interface vdsl device down
else
uci_toggle_state layer2_interface vdsl device up
fi
fi
/etc/init.d/dsl reload
fi

View file

@ -0,0 +1,29 @@
wantest() {
local wandev=$(db get hw.board.ethernetWanPort)
local ledontest
ledontest=$(cat /sys/class/net/$wandev/operstate)
if [ "$ledontest" == "up" ]; then
return 0
fi
return 1
}
if [ "$INTERFACE" == "led" ]; then
if [ "$ACTION" == "link_up" ]; then
ubus call led.dsl set '{"state":"ok"}'
fi
if [ "$ACTION" == "link_down" ]; then
ubus call led.dsl set '{"state":"off"}'
# $(wantest) && ubus call led.wan set '{"state":"ok"}'
fi
if [ "$ACTION" == "started_training" ]; then
ubus call led.dsl set '{"state":"alert"}'
fi
if [ "$ACTION" == "looking_for_carrier" ]; then
ubus call led.dsl set '{"state":"notice"}'
fi
fi