From 5d8e0585ac778f4dde3ead2cee576695c351c628 Mon Sep 17 00:00:00 2001 From: blogic Date: Sat, 15 Dec 2012 02:01:00 +0000 Subject: [lantiq] cleanup basefiles git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34698 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/lantiq/base-files/etc/diag.sh | 42 +++++++++++++++++ .../base-files/etc/hotplug.d/button/10-generic.sh | 3 ++ .../etc/hotplug.d/firmware/10-rt2x00-eeprom | 5 +-- target/linux/lantiq/base-files/etc/inittab | 1 - .../linux/lantiq/base-files/etc/uci-defaults/leds | 52 +++++----------------- .../lantiq/base-files/etc/uci-defaults/network | 32 +++---------- .../lantiq/base-files/lib/functions/lantiq.sh | 9 ++++ target/linux/lantiq/base-files/lib/lantiq.sh | 17 ------- .../linux/lantiq/base-files/lib/preinit/42_athfix | 2 +- 9 files changed, 75 insertions(+), 88 deletions(-) create mode 100644 target/linux/lantiq/base-files/etc/diag.sh create mode 100644 target/linux/lantiq/base-files/lib/functions/lantiq.sh delete mode 100644 target/linux/lantiq/base-files/lib/lantiq.sh (limited to 'target/linux/lantiq') 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..d0088f5bc --- /dev/null +++ b/target/linux/lantiq/base-files/etc/diag.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# Copyright (C) 2012 OpenWrt.org + +[ -d /sys/class/leds/power/ ] || return + +set_state() { + [ -d /sys/class/leds/power1/ ] && { + + case "$1" in + preinit) + echo heartbeat >/sys/class/leds/power/trigger + ;; + failsafe) + echo none >/sys/class/leds/power/trigger + echo timer >/sys/class/leds/power1/trigger + echo 100 >/sys/class/leds/power1/delay_on + echo 100 >/sys/class/leds/power1/delay_off + ;; + done) + echo none >/sys/class/leds/power/trigger + echo none >/sys/class/leds/power1/trigger + echo 1 >/sys/class/leds/power/brightness + ;; + esac + return + } + + case "$1" in + preinit) + echo heartbeat >/sys/class/leds/power/trigger + ;; + failsafe) + echo timer >/sys/class/leds/power/trigger + echo 100 >/sys/class/leds/power/delay_on + echo 100 >/sys/class/leds/power/delay_off + ;; + done) + echo none >/sys/class/leds/power/trigger + echo 1 >/sys/class/leds/power/brightness + ;; + 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..1d1467ade 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 @@ -7,11 +7,14 @@ case "${BUTTON}" in BTN_0) logger "reset pressed" + echo "REBOOT" > /dev/console + sleep 3 sync reboot ;; BTN_1) logger "factory pressed" + echo "FACTORY RESET" > /dev/console jffs2_mark_erase "rootfs_data" sync reboot 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..e58ca34de 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 @@ -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/leds b/target/linux/lantiq/base-files/etc/uci-defaults/leds index 64b080f33..747a71504 100755 --- a/target/linux/lantiq/base-files/etc/uci-defaults/leds +++ b/target/linux/lantiq/base-files/etc/uci-defaults/leds @@ -5,51 +5,21 @@ # . /lib/functions/uci-defaults.sh -. /lib/lantiq.sh +. /lib/functions/lantiq.sh -board=$(lantiq_board_name) +[ -e "/sys/class/leds/wifi" ] && ucidef_set_led_wlan "wifi" "wifi" "wifi" "phy0tx" +[ -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" -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" - ;; +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 -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" - ;; +board=$(lantiq_board_id) -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" +case "$board" in +*) ;; esac diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/network b/target/linux/lantiq/base-files/etc/uci-defaults/network index b40134d93..e1459b9fc 100755 --- a/target/linux/lantiq/base-files/etc/uci-defaults/network +++ b/target/linux/lantiq/base-files/etc/uci-defaults/network @@ -12,7 +12,6 @@ set_atm_wan() { local payload=$4 uci batch < /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) -- cgit v1.2.3