mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-12 03:58:40 +01:00
layer2interface: dsl hotplug scripts
This commit is contained in:
parent
dcb010903d
commit
faf327efea
2 changed files with 51 additions and 0 deletions
22
layer2interface/broadcom/etc/hotplug.d/dsl/10-dsl
Normal file
22
layer2interface/broadcom/etc/hotplug.d/dsl/10-dsl
Normal 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
|
||||
|
||||
29
layer2interface/broadcom/etc/hotplug.d/dsl/20-dsl-leds
Normal file
29
layer2interface/broadcom/etc/hotplug.d/dsl/20-dsl-leds
Normal 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
|
||||
|
||||
Loading…
Add table
Reference in a new issue