ltq-*dsl-app: dsl_control: remove unneeded check for lantiq_dsl.sh
[openwrt/staging/hauke.git] / package / network / config / ltq-vdsl-app / files / dsl_control
index 1d4129fc7d583a04a59c53841bff26c1eedd9c62..9c5df4cccd821626c3e8c215da43c37908294a30 100644 (file)
@@ -1,15 +1,14 @@
 #!/bin/sh /etc/rc.common
 # Copyright (C) 2012 OpenWrt.org
 
-# needs to start before the atm layer which starts at 50
-START=48
+START=97
 USE_PROCD=1
 
-EXTRA_COMMANDS="status lucistat"
-EXTRA_HELP="   status  Get DSL status information
-       lucistat  Get status information if lua friendly format"
+EXTRA_COMMANDS="dslstat lucistat"
+EXTRA_HELP="   dslstat Get DSL status information
+       lucistat Get status information in lua friendly format"
 
-[ -f /lib/functions/lantiq_dsl.sh ] && . /lib/functions/lantiq_dsl.sh
+. /lib/functions/lantiq_dsl.sh
 
 #
 # ITU-T G.997.1 (06/2012) - Section 7.3.1.1.1 (xTU transmission system enabling (XTSE))
@@ -109,7 +108,7 @@ locs 0 $1
 }
 
 [Common]={
-}" > /tmp/adsl.scr
+}" > /tmp/dsl.scr
 }
 
 lowlevel_cfg() {
@@ -180,6 +179,7 @@ start_service() {
        local xtse
        local xfer_mode
        local line_mode
+       local tc_layer
        local mode
        local lowlevel
        local snr
@@ -194,28 +194,27 @@ start_service() {
 
        eval "xtse=\"\${xtse_xdsl_$annex}\""
 
-       [ -z "${xfer_mode}" ] && xfer_mode=ptm
-
        case "${xfer_mode}" in
        atm)
-               # in most cases atm is used on top of adsl
-               [ -z "${line_mode}" ] && line_mode=adsl
+               tc_layer="-T1:0x1:0x1_1:0x1:0x1"
                ;;
-       *)
-               # in most cases ptm is used on top of vdsl
-               [ -z "${line_mode}" ] && line_mode=vdsl
+       ptm)
+               tc_layer="-T2:0x1:0x1_2:0x1:0x1"
                ;;
        esac
 
        case "${line_mode}" in
        adsl)
-               mode=1
+               mode="-M1"
 
-               # mask out VDSL bits when ATM is requested
+               # mask out VDSL bits when ADSL is requested
                xtse="${xtse%_*}_00"
                ;;
-       *)
-               mode=2
+       vdsl)
+               mode="-M2"
+
+               # mask out ADSL bits when VDSL is requested
+               xtse="00_00_00_00_00_00_00_${xtse##*_}"
                ;;
        esac
 
@@ -253,7 +252,9 @@ start_service() {
                                fi
                                ;;
                        b*|j*)
-                               if [ -f "/lib/firmware/lantiq-vrx200-b.bin" ]; then
+                               if [ -f "/lib/firmware/vr9_dsl_fw_annex_b.bin" ]; then
+                                       firmware="/lib/firmware/vr9_dsl_fw_annex_b.bin"
+                               elif [ -f "/lib/firmware/lantiq-vrx200-b.bin" ]; then
                                        firmware="/lib/firmware/lantiq-vrx200-b.bin"
                                elif [ -f "/tmp/lantiq-vrx200-b.bin" ]; then
                                        firmware="/tmp/lantiq-vrx200-b.bin"
@@ -291,7 +292,7 @@ start_service() {
        [ -z "${snr}" ] || {
            # for SNR offset setting
            autoboot_script "$snr"
-           autoboot="-a /tmp/adsl.scr"
+           autoboot="-a /tmp/dsl.scr -A /tmp/dsl.scr"
        }
 
        procd_open_instance
@@ -300,7 +301,8 @@ start_service() {
                        -n /sbin/dsl_notify.sh \
                        -f ${firmware} \
                        $lowlevel \
-                       -M ${mode} \
+                       ${mode} \
+                       ${tc_layer} \
                        $autoboot
        procd_close_instance
 }