lantiq: Update to the latest DSL driver / application versions
[openwrt/svn-archive/archive.git] / package / network / config / ltq-vdsl-app / files / dsl_control
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2012 OpenWrt.org
3
4 # needs to start before the atm layer which starts at 50
5 START=48
6
7 EXTRA_COMMANDS="status lucistat"
8 EXTRA_HELP=" status Get DSL status information
9 lucistat Get status information if lua friendly format"
10
11 SERVICE_DAEMONIZE=1
12 SERVICE_WRITE_PID=1
13
14 [ -f /lib/functions/lantiq_dsl.sh ] && . /lib/functions/lantiq_dsl.sh
15
16 # G.992.1 Annex A
17 # G.992.2 Annex A
18 # G.992.3 Annex A
19 # G.992.4 Annex A
20 # G.992.5 Annex A
21 # G.993.2 Annex A/B/C
22 xtse_adsl_a="04 01 04 01 00 01 00 00"
23
24 # G.992.1 Annex B
25 # G.992.3 Annex B
26 # G.992.5 Annex B
27 # G.993.2 Annex A/B/C
28 xtse_adsl_b="10 00 10 00 00 04 00 00"
29
30 # G.992.1 Annex B
31 # G.992.3 Annex B
32 # G.992.3 Annex J
33 # G.992.5 Annex B
34 # G.992.5 Annex J
35 # G.993.2 Annex A/B/C
36 xtse_adsl_j="10 00 10 40 00 04 01 00"
37
38 xtse_vdsl="00 00 00 00 00 00 00 07"
39
40 start() {
41 local annex
42 local firmware
43 local xtse
44 local xtse_adsl
45 local mode
46
47 config_load network
48 config_get annex dsl annex
49 config_get firmware dsl firmware
50 config_get xfer_mode dsl xfer_mode
51
52 [ -z "${xfer_mode}" ] && xfer_mode=ptm
53
54 case "${xfer_mode}" in
55 atm)
56 insmod ltq_atm_vr9
57 mode=1
58 ;;
59 *)
60 insmod ltq_ptm_vr9
61 mode=2
62 ;;
63 esac
64
65 eval "xtse_adsl=\"\${xtse_adsl_$annex}\""
66 if [ "${xtse_adsl}" ]; then
67 xtse=$xtse_adsl
68 else
69 xtse=$xtse_vdsl
70 fi
71
72 [ -z "${firmware}" ] && firmware=/lib/firmware/vdsl.bin
73 [ -f "${firmware}" ] || {
74 echo failed to find $firmware
75 return 1
76 }
77
78 service_start /sbin/vdsl_cpe_control \
79 -i `echo $xtse | sed "s/ /_/g"` \
80 -n /sbin/dsl_notify.sh \
81 -f ${firmware} \
82 -M ${mode}
83 }
84
85 stop() {
86 DSL_NOTIFICATION_TYPE="DSL_INTERFACE_STATUS" \
87 DSL_INTERFACE_STATUS="DOWN" \
88 /sbin/dsl_notify.sh
89
90 service_stop /sbin/vdsl_cpe_control
91 }