layer2interface: adapt to new dsl hotplug event

This commit is contained in:
Sukru Senli 2018-01-04 18:41:32 +01:00
parent 3bb9e81912
commit 0bc8affb30
5 changed files with 30 additions and 53 deletions

View file

@ -0,0 +1,20 @@
if [ "$STATUS" == "up" -o "$STATUS" == "down" ]; then
uci_toggle_state layer2_interface adsl status down
uci_toggle_state layer2_interface vdsl status down
if [ "ADSL" == "$MODE" ]; then
if [ "$STATUS" == "up" ]; then
uci_toggle_state layer2_interface adsl status up
fi
fi
if [ "VDSL2" == "$MODE" -o "G.fast" == "$MODE" ]; then
if [ "$STATUS" == "up" ]; then
uci_toggle_state layer2_interface vdsl status up
fi
fi
/etc/init.d/dsl reload
fi

View file

@ -1,22 +0,0 @@
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

@ -1,29 +0,0 @@
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

View file

@ -0,0 +1,8 @@
if [ "$STATUS" == "up" ]; then
ubus call led.dsl set '{"state":"ok"}'
elif [ "$STATUS" == "down" ]; then
ubus call led.dsl set '{"state":"off"}'
elif [ "$STATUS" == "training" ]; then
ubus call led.dsl set '{"state":"alert"}'
fi

View file

@ -152,7 +152,7 @@ create_adsl_devices() {
local adslstatus
config_load layer2_interface
config_get adslstatus adsl device
config_get adslstatus adsl status
if [ "$adslstatus" == "up" ]; then
echo "Creating ATM Device(s)"
@ -233,7 +233,7 @@ remove_vdsl_devices() {
create_vdsl_devices() {
local vdslstatus
config_load layer2_interface
config_get vdslstatus vdsl device
config_get vdslstatus vdsl status
if [ "$vdslstatus" == "up" ]; then
echo "Creating PTM Device(s)"