ltq-vdsl-app: re-add lowlevel settings
[librecmc/librecmc.git] / package / network / config / ltq-vdsl-app / files / dsl_control
index bededb261214f72761157564923819f0321048a6..4ddc1d7880e240b32aca93db8388329e4f5db9ae 100644 (file)
@@ -3,30 +3,31 @@
 
 # needs to start before the atm layer which starts at 50
 START=48
+USE_PROCD=1
 
 EXTRA_COMMANDS="status lucistat"
 EXTRA_HELP="   status  Get DSL status information
        lucistat  Get status information if lua friendly format"
 
-SERVICE_DAEMONIZE=1
-SERVICE_WRITE_PID=1
-
 [ -f /lib/functions/lantiq_dsl.sh ] && . /lib/functions/lantiq_dsl.sh
-XDSL_CTRL=vdsl_cpe_control
 
+#
+# ITU-T G.997.1 (06/2012) - Section 7.3.1.1.1 (xTU transmission system enabling (XTSE))
+# ITU-T G.997.1 Amendment 2 (04/2013) - Section 2.1 - (Vectoring mode enable (VECTORMODE_ENABLE))
+#
 # G.992.1 Annex A
-# G.992.2 Annex A
-# G.992.3 Annex A
-# G.992.4 Annex A
-# G.992.5 Annex A
+# G.992.3 Annex A / L-US1 / L_US-2 / M
+# G.992.5 Annex A / M
 # G.993.2 Annex A/B/C
-xtse_adsl_a="04 01 04 01 00 01 00 00"
+# G.993.5 Annex A/B/C
+xtse_xdsl_a="04_00_04_00_4C_01_04_0F"
 
 # G.992.1 Annex B
 # G.992.3 Annex B
 # G.992.5 Annex B
 # G.993.2 Annex A/B/C
-xtse_adsl_b="10 00 10 00 00 04 00 00"
+# G.993.5 Annex A/B/C
+xtse_xdsl_b="10_00_10_00_00_04_00_0F"
 
 # G.992.1 Annex B
 # G.992.3 Annex B
@@ -34,41 +35,28 @@ xtse_adsl_b="10 00 10 00 00 04 00 00"
 # G.992.5 Annex B
 # G.992.5 Annex J
 # G.993.2 Annex A/B/C
-xtse_adsl_j="10 00 10 40 00 04 01 00"
-
-xtse_vdsl="00 00 00 00 00 00 00 07"
-
-xdsl_scr() {
-       val=`echo $2 | sed "s/ / 0x/g"`
-       echo "[WaitForConfiguration]={
-#G997XTUSEC_g997xtusecs 0x$val
-}
+# G.993.5 Annex A/B/C
+xtse_xdsl_j="10_00_10_40_00_04_01_0F"
 
-[WaitForLinkActivate]={
-}
-
-[WaitForRestart]={
-}
-
-[Common]={
-}" > /tmp/$1.scr
-}
+#
+# ITU-T G.994.1 (06/2012) - Table 2 (Mandatory carrier sets)
+#
 
 # A43
-tone_adsl_a="0x142"
-tone_vdsl_a="0x142"
+tone_adsl_a="0x142" # A43C + J43 + A43
+tone_vdsl_a="0x142" # A43C + J43 + A43
 
 # A43 + V43
-tone_adsl_av="0x142"
-tone_vdsl_av="0x146"
+tone_adsl_av="0x142" # A43C + J43 + A43
+tone_vdsl_av="0x146" # A43C + J43 + A43 + V43
 
 # B43
-tone_adsl_b="0x1"
-tone_vdsl_b="0x1"
+tone_adsl_b="0x81" # B43 + B43c
+tone_vdsl_b="0x1" # B43
 
 # B43 + V43
-tone_adsl_bv="0x1"
-tone_vdsl_bv="0x5"
+tone_adsl_bv="0x81" # B43 + B43c
+tone_vdsl_bv="0x5" # B43 + V43
 
 lowlevel_cfg() {
        echo "# VRX Low Level Configuration File
@@ -125,15 +113,19 @@ lowlevel_cfg() {
     0" > /tmp/lowlevel.cfg
 }
 
-start() {
+service_triggers() {
+       procd_add_reload_trigger network
+}
+
+start_service() {
        local annex
        local firmware
        local tone
        local tone_adsl
        local tone_vdsl
        local xtse
-       local xtse_adsl
        local mode
+       local lowlevel
 
        config_load network
        config_get tone dsl tone
@@ -145,53 +137,45 @@ start() {
 
        case "${xfer_mode}" in
        atm)
-               insmod ltq_atm_vr9
+               LOAD=ltq_atm_vr9
+               UNLOAD=ltq_ptm_vr9
                mode=1
                ;;
        *)
-               insmod ltq_ptm_vr9
+               LOAD=ltq_ptm_vr9
+               UNLOAD=ltq_atm_vr9
                mode=2
                ;;
        esac
 
-       eval "xtse_adsl=\"\${xtse_adsl_$annex}\""
-       if [ "${xtse_adsl}" ]; then
-               xtse=$xtse_adsl
-       else
-               xtse_adsl=$xtse_adsl_a
-               xtse=$xtse_vdsl
-       fi
-
-       eval "tone_adsl=\"\${tone_adsl_$tone}\""
-       [ -z "${tone_adsl}" ] && tone_adsl=$tone_adsl_av
+       eval "xtse=\"\${xtse_xdsl_$annex}\""
 
-       eval "tone_vdsl=\"\${tone_vdsl_$tone}\""
-       [ -z "${tone_vdsl}" ] && tone_vdsl=$tone_vdsl_av
-               
        [ -z "${firmware}" ] && firmware=/lib/firmware/vdsl.bin
        [ -f "${firmware}" ] || {
                echo failed to find $firmware
                return 1
        }
 
-       xdsl_scr adsl "${xtse_adsl}"
-       xdsl_scr vdsl "${xtse_vdsl}"
-       lowlevel_cfg "${tone_adsl}" "${tone_vdsl}"
+       eval "tone_adsl=\"\${tone_adsl_$tone}\""
+       eval "tone_vdsl=\"\${tone_vdsl_$tone}\""
+       [ -n "${tone_adsl}" ] && [ -n "${tone_vdsl}" ] && {
+               lowlevel_cfg "${tone_adsl}" "${tone_vdsl}"
+               lowlevel="-l /tmp/lowlevel.cfg"
+       }
 
-       service_start /sbin/vdsl_cpe_control \
-                       -i `echo $xtse | sed "s/ /_/g"` \
+       procd_open_instance
+       procd_set_param command /sbin/vdsl_cpe_control_wrapper \
+                       -i$xtse \
                        -n /sbin/dsl_notify.sh \
                        -f ${firmware} \
-                       -a /tmp/adsl.scr \
-                       -A /tmp/vdsl.scr \
-                       -l /tmp/lowlevel.cfg \
+                       $lowlevel \
                        -M ${mode}
+       procd_append_param env "LOAD=$LOAD" "UNLOAD=$UNLOAD"
+       procd_close_instance
 }
 
-stop() {
+stop_service() {
        DSL_NOTIFICATION_TYPE="DSL_INTERFACE_STATUS" \
        DSL_INTERFACE_STATUS="DOWN" \
                /sbin/dsl_notify.sh
-
-       service_stop /sbin/vdsl_cpe_control
 }