summaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/lantiq/base-files')
-rw-r--r--target/linux/lantiq/base-files/etc/diag.sh24
-rw-r--r--target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh49
-rw-r--r--target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom7
-rw-r--r--target/linux/lantiq/base-files/etc/inittab1
-rwxr-xr-xtarget/linux/lantiq/base-files/etc/uci-defaults/01_leds35
-rwxr-xr-xtarget/linux/lantiq/base-files/etc/uci-defaults/02_network (renamed from target/linux/lantiq/base-files/etc/uci-defaults/network)43
-rw-r--r--target/linux/lantiq/base-files/etc/uci-defaults/03_wireless-wps16
-rwxr-xr-xtarget/linux/lantiq/base-files/etc/uci-defaults/leds58
-rw-r--r--target/linux/lantiq/base-files/lib/functions/lantiq.sh9
-rw-r--r--target/linux/lantiq/base-files/lib/lantiq.sh17
-rw-r--r--target/linux/lantiq/base-files/lib/preinit/42_athfix2
11 files changed, 147 insertions, 114 deletions
diff --git a/target/linux/lantiq/base-files/etc/diag.sh b/target/linux/lantiq/base-files/etc/diag.sh
new file mode 100644
index 000000000..9e0e1701c
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/diag.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Copyright (C) 2012-2013 OpenWrt.org
+
+. /lib/functions/leds.sh
+
+status_led="power"
+
+set_state() {
+ case "$1" in
+ preinit)
+ status_led_set_heartbeat
+ ;;
+ failsafe)
+ [ -d /sys/class/leds/power1 ] && {
+ status_led_off
+ led_timer "power1" 100 100
+ } || status_led_set_timer 100 100
+ ;;
+ done)
+ status_led_on
+ led_off "power1"
+ ;;
+ esac
+}
diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh b/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh
index b2fdda23f..4b305fbdf 100644
--- a/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh
@@ -4,18 +4,49 @@
. /lib/functions.sh
+logger "$BUTTON pressed for $SEEN seconds"
+
+local rfkill_state=0
+
+wifi_rfkill_set() {
+ uci set wireless.$1.disabled=$rfkill_state
+}
+
+wifi_rfkill_check() {
+ local disabled
+ config_get disabled $1 disabled
+ [ "$disabled" = "1" ] || rfkill_state=1
+}
+
case "${BUTTON}" in
- BTN_0)
- logger "reset pressed"
- sync
- reboot
+ reset)
+ if [ "$SEEN" -lt 1 ]
+ then
+ echo "REBOOT" > /dev/console
+ sync
+ reboot
+ elif [ "$SEEN" -gt 5 ]
+ then
+ echo "FACTORY RESET" > /dev/console
+ firstboot && reboot &
+ fi
;;
- BTN_1)
- logger "factory pressed"
- jffs2_mark_erase "rootfs_data"
- sync
- reboot
+
+ wps)
+ for dir in /var/run/hostapd-*; do
+ [ -d "$dir" ] || continue
+ hostapd_cli -p "$dir" wps_pbc
+ done
+ ;;
+
+ rfkill)
+ config_load wireless
+ config_foreach wifi_rfkill_check wifi-device
+ config_foreach wifi_rfkill_set wifi-device
+ uci commit wireless
+ wifi up
;;
+
*)
logger "unknown button ${BUTTON}"
;;
diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
index 1eee55e22..e3509bdd2 100644
--- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -12,7 +12,7 @@ rt2x00_eeprom_extract() {
local count=$3
local mtd
- . /etc/functions.sh
+ . /lib/functions.sh
mtd=$(find_mtd_part $part)
[ -n "$mtd" ] || \
@@ -23,12 +23,11 @@ rt2x00_eeprom_extract() {
}
[ -e /lib/firmware/$FIRMWARE ] && exit 0
-
-. /lib/lantiq.sh
+. /lib/functions/lantiq.sh
case "$FIRMWARE" in
"RT2860.eeprom" )
- local board=$(lantiq_board_name)
+ local board=$(lantiq_board_id)
case $board in
ARV7525PW|ARV752DPW)
rt2x00_eeprom_extract "board_config" 1040 272
diff --git a/target/linux/lantiq/base-files/etc/inittab b/target/linux/lantiq/base-files/etc/inittab
index 96afec9e7..46a1312c6 100644
--- a/target/linux/lantiq/base-files/etc/inittab
+++ b/target/linux/lantiq/base-files/etc/inittab
@@ -1,4 +1,3 @@
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K stop
ttyLTQ0::askfirst:/bin/ash --login
-ttyLTQ1::askfirst:/bin/ash --login
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/01_leds b/target/linux/lantiq/base-files/etc/uci-defaults/01_leds
new file mode 100755
index 000000000..bdf131170
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/01_leds
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 OpenWrt.org
+# based on ar71xx
+#
+
+. /lib/functions/uci-defaults.sh
+. /lib/functions/lantiq.sh
+
+[ -e "/sys/class/leds/wifi" ] && ucidef_set_led_wlan "wifi" "wifi" "wifi" "phy0tpt"
+[ -e "/sys/class/leds/usb" ] && ucidef_set_led_usbdev "usb" "usb" "usb" "1-1"
+[ -e "/sys/class/leds/dsl" ] && ucidef_set_led_netdev "dsl" "dsl" "dsl" "pppoe-wan"
+
+for a in `ls /sys/class/leds/`; do
+ grep -q "\[none\]" /sys/class/leds/$a/trigger
+ [ $? -eq 0 ] && ucidef_set_led_default $a $a $a `cat /sys/class/leds/$a/brightness`
+done
+
+board=$(lantiq_board_id)
+
+case "$board" in
+VG3503J)
+ ucidef_set_led_netdev "lan1" "lan1" "bt:green:lan1" "eth0"
+ ucidef_set_led_netdev "lan2" "lan2" "bt:green:lan2" "eth1"
+ ucidef_set_led_netdev "port1" "port1" "bt:green:port1" "eth0"
+ ucidef_set_led_netdev "port2" "port2" "bt:green:port2" "eth1"
+ ucidef_set_led_netdev "vdsl" "vdsl" "bt:green:dsl" "ptm0"
+ ;;
+*)
+ ;;
+esac
+
+ucidef_commit_leds
+
+exit 0
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/network b/target/linux/lantiq/base-files/etc/uci-defaults/02_network
index b40134d93..06390a73d 100755
--- a/target/linux/lantiq/base-files/etc/uci-defaults/network
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/02_network
@@ -12,7 +12,6 @@ set_atm_wan() {
local payload=$4
uci batch <<EOF
set network.atm='atm-bridge'
-set network.atm.unit='0'
set network.atm.vpi='$vpi'
set network.atm.vci='$vci'
set network.atm.encaps='$encaps'
@@ -22,21 +21,15 @@ set network.wan.ifname='nas0'
set network.wan.proto='pppoe'
set network.wan.username='foo'
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'
+set network.wan.ipv6='1'
+set network.wan6='interface'
+set network.wan6.ifname='@wan'
+set network.wan6.proto='dhcpv6'
EOF
}
. /lib/functions/uci-defaults.sh
-. /lib/lantiq.sh
+. /lib/functions/lantiq.sh
touch /etc/config/network
@@ -47,40 +40,42 @@ vpi=1
vci=32
encaps="llc"
payload="bridged"
-fwannex=$(lantiq_dsl_fwannex)
-board=$(lantiq_board_name)
-dsl=$(lantiq_soc_has_adsl)
+
+board=$(lantiq_board_id)
case "$board" in
-# annex B with adm6996
+# adm6996
ARV4520PW)
ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "eth0" "1" "1"
ucidef_add_switch_vlan "eth0" "1" "3 2 1 0 5t"
- set_adsl "b" "b2p"
;;
-GIGASX76X)
+ACMP252|GIGASX76X)
ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "eth0" "1" "1"
ucidef_add_switch_vlan "eth0" "1" "4 3 2 1 5t"
- set_adsl "b" "b2p"
;;
-# annex A with ar8316
+# ar8316
ARV4519PW|ARV7518PW)
ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "eth0" "1" "1"
ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
- set_adsl "a" "a2p"
;;
-ARV7525PW|ARV4525PW|*)
- set_adsl "$fwannex" "${fwannex}2p"
+WBMR)
+ ucidef_add_switch "eth0" "1" "0"
+ ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 4 5"
+ ;;
+
+VG3503J)
+ ucidef_set_interface_lan 'eth0 eth1'
;;
esac
-[ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
+[ -z "$(ls /lib/modules/`uname -r`/ltq_atm*)" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
+
uci commit network
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/03_wireless-wps b/target/linux/lantiq/base-files/etc/uci-defaults/03_wireless-wps
new file mode 100644
index 000000000..f2412d7bc
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/03_wireless-wps
@@ -0,0 +1,16 @@
+. /lib/functions.sh
+. /lib/functions/lantiq.sh
+
+set_wps() {
+ uci set wireless.$1.wps_pushbutton=0
+ uci set wireless.$1.wps_device_name="OpenWrt - $(lantiq_board_name)"
+}
+
+board=$(lantiq_board_id)
+case $board in
+WBMR)
+ config_load wireless
+ config_foreach set_wps wifi-iface
+ uci commit wireless
+ ;;
+esac
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/leds b/target/linux/lantiq/base-files/etc/uci-defaults/leds
deleted file mode 100755
index 64b080f33..000000000
--- a/target/linux/lantiq/base-files/etc/uci-defaults/leds
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2011 OpenWrt.org
-# based on ar71xx
-#
-
-. /lib/functions/uci-defaults.sh
-. /lib/lantiq.sh
-
-board=$(lantiq_board_name)
-
-case "$board" in
-ARV4520PW|ARV452CPW)
- ucidef_set_led_netdev "wifi" "wifi" "soc:blue:wifi" "wlan0"
- ucidef_set_led_usbdev "usb" "USB" "soc:blue:usb" "1-1"
- ucidef_set_led_default "fxs1" "fxs1" "soc:blue:fxs1" "1"
- ucidef_set_led_default "fxs2" "fxs2" "soc:blue:fxs2" "1"
- ucidef_set_led_default "online" "online" "soc:blue:internet" "1"
- ;;
-
-ARV7525PW)
- ucidef_set_led_netdev "wifi" "wifi" "soc:green:wifi" "wlan0"
- ucidef_set_led_default "fxs1" "fxs1" "soc:green:fxs1" "1"
- ucidef_set_led_default "fxs2" "fxs2" "soc:green:fxs2" "1"
- ucidef_set_led_default "dsl" "dsl" "soc:red:dsl" "1"
- ucidef_set_led_default "online" "online" "soc:green:online" "1"
- ;;
-
-ARV4525PW)
- ucidef_set_led_netdev "wifi" "wifi" "soc:green:wifi" "wlan0"
- ucidef_set_led_default "fxs1" "fxs1" "soc:green:fxs1" "1"
- ucidef_set_led_default "fxs2" "fxs2" "soc:green:fxs2" "1"
- ucidef_set_led_default "dsl" "dsl" "soc:green:dsl" "1"
- ucidef_set_led_default "online" "online" "soc:green:online" "1"
- ;;
-
-GIGASX76X)
- ucidef_set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
- ucidef_set_led_netdev "online" "online" "soc:green:online" "pppoe-wan"
- ucidef_set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
- ;;
-
-ARV4519PW)
- ucidef_set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
- ucidef_set_led_netdev "internet" "internet" "soc:green:internet" "pppoe-wan"
- ucidef_set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
- ;;
-
-ARV7518PW)
- ucidef_set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
- ucidef_set_led_netdev "internet" "internet" "soc:green:internet" "pppoe-wan"
- ucidef_set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
- ;;
-esac
-
-ucidef_commit_leds
-
-exit 0
diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq.sh b/target/linux/lantiq/base-files/lib/functions/lantiq.sh
new file mode 100644
index 000000000..ed76cd801
--- /dev/null
+++ b/target/linux/lantiq/base-files/lib/functions/lantiq.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+lantiq_board_id() {
+ grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g"
+}
+
+lantiq_board_name() {
+ grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/.* - \(.*\)/\1/g"
+}
diff --git a/target/linux/lantiq/base-files/lib/lantiq.sh b/target/linux/lantiq/base-files/lib/lantiq.sh
deleted file mode 100644
index e4f1471a9..000000000
--- a/target/linux/lantiq/base-files/lib/lantiq.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-lantiq_soc_has_adsl() {
- ls /lib/modules/*/drv_dsl_cpe_api.ko
-}
-
-lantiq_soc_name() {
- grep ^system /proc/cpuinfo | sed "s/system type.*: \(.*\)/\1/g"
-}
-
-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"
-}
diff --git a/target/linux/lantiq/base-files/lib/preinit/42_athfix b/target/linux/lantiq/base-files/lib/preinit/42_athfix
index 114aaffc8..d182fbf34 100644
--- a/target/linux/lantiq/base-files/lib/preinit/42_athfix
+++ b/target/linux/lantiq/base-files/lib/preinit/42_athfix
@@ -1,6 +1,6 @@
#!/bin/sh
-. /lib/lantiq.sh
+. /lib/functions/lantiq.sh
init_atheeprom() {
local board=$(lantiq_board_name)