lantiq: move esi calls to dsl_cpe_control scripts to fix ordering wrt. loading vr9...
[openwrt/svn-archive/archive.git] / package / network / config / ltq-adsl-app / files / dsl_control
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2012 OpenWrt.org
3
4 START=99
5
6 EXTRA_COMMANDS="status lucistat"
7 EXTRA_HELP=" status Get DSL status information
8 lucistat Get status information if lua friendly format"
9
10 SERVICE_DAEMONIZE=1
11 SERVICE_WRITE_PID=1
12
13 [ -f /lib/functions/lantiq_dsl.sh ] && . /lib/functions/lantiq_dsl.sh
14
15 annex_b=10_00_10_00_00_04_00_00
16 annex_bdmt=10_00_00_00_00_00_00_00
17 annex_b2=00_00_10_00_00_00_00_00
18 annex_b2p=00_00_00_00_00_04_00_00
19 annex_a=04_01_04_00_00_01_00_00
20 annex_at1=01_00_00_00_00_00_00_00
21 annex_alite=00_01_00_00_00_00_00_00
22 annex_admt=04_00_00_00_00_00_00_00
23 annex_a2=00_00_04_00_00_00_00_00
24 annex_a2p=00_00_00_00_00_01_00_00
25 annex_l=00_00_00_00_04_00_00_00
26 annex_m=00_00_00_00_40_00_04_00
27 annex_m2=00_00_00_00_40_00_00_00
28 annex_m2p=00_00_00_00_00_00_04_00
29
30 start() {
31 local annex
32 local firmware
33 local xtu
34 config_load network
35 config_get annex dsl annex
36 config_get firmware dsl firmware
37
38 eval "xtu=\"\${annex_$annex}\""
39
40 [ -z "${firmware}" ] &&
41 firmware=/lib/firmware/adsl.bin
42 [ -f "${firmware}" ] || {
43 echo failed to find $firmware
44 return 1
45 }
46
47 esi $(printf '%012X' $((1+0x$(tr -d : </sys/class/net/eth0/address))))
48
49 service_start /sbin/dsl_cpe_control -i${xtu} \
50 -n /sbin/dsl_notify.sh \
51 -f ${firmware}
52 }
53
54 stop() {
55 DSL_NOTIFICATION_TYPE="DSL_INTERFACE_STATUS" \
56 DSL_INTERFACE_STATUS="DOWN" \
57 /sbin/dsl_notify.sh
58
59 service_stop /sbin/dsl_cpe_control
60 }
61