add annex selection support to ltq_dsl package
authorJohn Crispin <john@openwrt.org>
Tue, 14 Feb 2012 15:05:49 +0000 (15:05 +0000)
committerJohn Crispin <john@openwrt.org>
Tue, 14 Feb 2012 15:05:49 +0000 (15:05 +0000)
SVN-Revision: 30518

package/ltq-dsl-app/files/dsl_control
package/ltq-dsl/Makefile
target/linux/lantiq/base-files/etc/uci-defaults/network
target/linux/lantiq/base-files/lib/lantiq.sh

index df31c39e5d99cf74ed44947010349831a71963dd..67e82b6d0af0e020bcbabbf9d7c9844526d078fa 100644 (file)
@@ -2,6 +2,8 @@
 # Copyright (C) 2008 OpenWrt.org
 START=99
 
+. /lib/functions.sh
+
 EXTRA_COMMANDS="status lucistat"
 EXTRA_HELP="   status  Get DSL status information
        lucistat  Get status information if lua friendly format"
@@ -255,12 +257,40 @@ lucistat() {
        echo "return dsl"
 }
 
+
+annex_b=10_00_10_00_00_04_00_00
+annex_bdmt=10_00_00_00_00_00_00_00
+annex_b2=00_00_10_00_00_00_00_00
+annex_b2p=00_00_00_00_00_04_00_00
+annex_a=04_01_04_00_00_01_00_00
+annex_at1=01_00_00_00_00_00_00_00
+annex_alite=00_01_00_00_00_00_00_00
+annex_admt=04_00_00_00_00_00_00_00
+annex_a2=00_00_04_00_00_00_00_00
+annex_a2p=00_00_00_00_00_01_00_00
+annex_l=00_00_00_00_04_00_00_00
+annex_m=00_00_00_00_40_00_04_00
+annex_m2=00_00_00_00_40_00_00_00
+annex_m2p=00_00_00_00_00_00_04_00
+
 #
 # Simple start routine
 #
 start() {
+       local annex
+       local xtu
+       config_load network
+       config_get annex atm annex
+
+       # get xtu
+       eval "xtu=\"\${annex_$annex}\""
+
+       # check for invalid annex mode
+       [ -n "${annex}" -a -z "${xtu}" ] &&
+               echo "unknown annex mode $annex"
+
        # start CPE dsl daemon in the background
-       service_start /sbin/dsl_cpe_control -i \
+       service_start /sbin/dsl_cpe_control -i${xtu} \
                        -n /sbin/dsl_notify.sh \
                        -f /lib/firmware/ModemHWE.bin
 }
index 973967eb63fa70acd2eb1d6a60be281b78c64760..0e2a9328a87d6984bcc8e28edc16a445ada26bf6 100644 (file)
@@ -160,7 +160,8 @@ endef
 
 define Package/kmod-ltq-dsl-firmware-$(BUILD_VARIANT)/install
        $(INSTALL_DIR) $(1)/lib/firmware/
-       $(CP) $(PKG_BUILD_DIR)/$(FW_NAME)/ltq-dsl-fw-$(BUILD_VARIANT).bin $(1)/lib/firmware/ModemHWE.bin
+       $(CP) $(PKG_BUILD_DIR)/$(FW_NAME)/ltq-dsl-fw-$(BUILD_VARIANT).bin $(1)/lib/firmware/dsl-fw-$(word 1, $(subst -, ,$(BUILD_VARIANT))).bin
+       ln -s /lib/firmware/dsl-fw-$(word 1, $(subst -, ,$(BUILD_VARIANT))).bin $(1)/lib/firmware/ModemHWE.bin
 endef
 
 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-a-danube))
index 3b7fe266217d71bca9c44d0f95ab2cc714e60f80..09f6bd7bfffbc2e7bbbd97cf24df8e5c8039ea1a 100755 (executable)
@@ -52,7 +52,6 @@ set_atm_wan() {
        local vci=$2
        local encaps=$3
        local payload=$4
-
        uci batch <<EOF
 set network.atm='atm-bridge'
 set network.atm.unit='0'
@@ -60,6 +59,8 @@ set network.atm.vpi='$vpi'
 set network.atm.vci='$vci'
 set network.atm.encaps='$encaps'
 set network.atm.payload='$payload'
+set network.atm.fwannex='$annex'
+set network.atm.annex='$annex'
 set network.wan='interface'
 set network.wan.ifname='nas0'
 set network.wan.proto='pppoe'
@@ -68,6 +69,16 @@ set network.wan.password='bar'
 EOF
 }
 
+set_adsl() {
+       local fwannex=$1
+       local annex=$2
+       uci batch <<EOF
+set network.adsl='adsl-device'
+set network.adsl.fwannex='$fwannex'
+set network.adsl.annex='$annex'
+EOF
+}
+
 set_interfaces_lan_wan() {
        local lan_ifname=$1
        local wan_ifname=$2
@@ -109,17 +120,20 @@ touch /etc/config/network
 set_interface_loopback
 set_interface_lan 'eth0'
 
-dsl=$(lantiq_soc_has_adsl)
-[ -z "$dsl" ] || set_atm_wan '1' '32' 'llc' 'bridged'
 
-board=$(lantiq_board_name)
+vpi=1
+vci=32
+encaps="llc"
+payload="bridged"
+fwannex=$(lantiq_dsl_fwannex)
+annex="$fwannex"
 
+board=$(lantiq_board_name)
 case "$board" in
 GIGASX76X)
        set_interface_lan "eth0.1"
        add_switch "eth0" "1" "1"
        add_switch_vlan "eth0" "1" "1 2 3 4 5t"
-       set_atm_wan "1" "32" "llc" "bridged"
        ;;
 
 *)
@@ -128,6 +142,10 @@ GIGASX76X)
        ;;
 esac
 
+dsl=$(lantiq_soc_has_adsl)
+[ -z "$dsl" ] || set_atm_wan "$vpi" "vci" "$encaps" "$payload" "$annex"
+[ -z "$fwannex" ] || set_adsl "$fwannex" "$annex"
+
 uci commit network
 
 exit 0
index 3d36ed03fee56fd2f2415b662ccbb43f02463835..e4f1471a9e0fe8b6a9d418a3255bfdd9e8ed6927 100644 (file)
@@ -11,3 +11,7 @@ lantiq_soc_name() {
 lantiq_board_name() {
        grep ^machine /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g"
 }
+
+lantiq_dsl_fwannex() {
+       ls /lib/firmware/dsl-fw-*.bin 2> /dev/null | sed "s/.*\([ab]\)\.bin/\1/g"
+}