diff options
author | John Crispin <blogic@openwrt.org> | 2014-07-02 16:33:11 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2014-07-02 16:33:11 +0000 |
commit | 6ec3299aa86134ecc5f62b16d0a1b3cb3ca661f2 (patch) | |
tree | 425ff6d8992a517692faec437bd4e0ee795c4a15 /target/linux/lantiq/base-files | |
parent | e72b4b22910810762e27f3d966880b96ca7847e0 (diff) | |
download | upstream-6ec3299aa86134ecc5f62b16d0a1b3cb3ca661f2.tar.gz upstream-6ec3299aa86134ecc5f62b16d0a1b3cb3ca661f2.tar.bz2 upstream-6ec3299aa86134ecc5f62b16d0a1b3cb3ca661f2.zip |
lantiq: add support for /tmp/sysinfo
Signed-off-by: John Crispin <blogic@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41472 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/lantiq/base-files')
5 files changed, 28 insertions, 8 deletions
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 427c5fc7a2..5664c13ea8 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 @@ -33,7 +33,7 @@ rt2x00_eeprom_extract() { case "$FIRMWARE" in "RT2860.eeprom" ) - local board=$(lantiq_board_id) + local board=$(lantiq_board_name) case $board in ARV7510PW22|ARV7519PW|ARV752DPW|ARV752DPW22) rt2x00_eeprom_extract "board_config" 520 256 1 diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/01_leds b/target/linux/lantiq/base-files/etc/uci-defaults/01_leds index 70a14d9bd5..2b3293b79e 100644 --- a/target/linux/lantiq/base-files/etc/uci-defaults/01_leds +++ b/target/linux/lantiq/base-files/etc/uci-defaults/01_leds @@ -17,7 +17,7 @@ for a in `ls /sys/class/leds/`; do [ $? -eq 0 ] && ucidef_set_led_default $a $a $a `cat /sys/class/leds/$a/brightness` done -board=$(lantiq_board_id) +board=$(lantiq_board_name) case "$board" in VG3503J) diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/02_network b/target/linux/lantiq/base-files/etc/uci-defaults/02_network index 02f4f6a5fb..22dea2a321 100644 --- a/target/linux/lantiq/base-files/etc/uci-defaults/02_network +++ b/target/linux/lantiq/base-files/etc/uci-defaults/02_network @@ -68,7 +68,7 @@ payload="bridged" lan_mac="" wan_mac="" -board=$(lantiq_board_id) +board=$(lantiq_board_name) case "$board" in # adm6996 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 index f2412d7bc2..e75fb8493f 100644 --- a/target/linux/lantiq/base-files/etc/uci-defaults/03_wireless-wps +++ b/target/linux/lantiq/base-files/etc/uci-defaults/03_wireless-wps @@ -3,10 +3,10 @@ set_wps() { uci set wireless.$1.wps_pushbutton=0 - uci set wireless.$1.wps_device_name="OpenWrt - $(lantiq_board_name)" + uci set wireless.$1.wps_device_name="OpenWrt - $(lantiq_board_model)" } -board=$(lantiq_board_id) +board=$(lantiq_board_name) case $board in WBMR) config_load wireless diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq.sh b/target/linux/lantiq/base-files/lib/functions/lantiq.sh index ed76cd8014..88da794ca9 100644 --- a/target/linux/lantiq/base-files/lib/functions/lantiq.sh +++ b/target/linux/lantiq/base-files/lib/functions/lantiq.sh @@ -1,9 +1,29 @@ #!/bin/sh -lantiq_board_id() { - grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g" +lantiq_board_detect() { + name=`grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g"` + model=`grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/.* - \(.*\)/\1/g"` + [ -z "$name" ] && name="unknown" + [ -z "$model" ] && model="unknown" + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + echo $name > /tmp/sysinfo/board_name + echo $model > /tmp/sysinfo/model +} + +lantiq_board_model() { + local model + + [ -f /tmp/sysinfo/model ] && model=$(cat /tmp/sysinfo/model) + [ -z "$model" ] && model="unknown" + + echo "$model" } lantiq_board_name() { - grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/.* - \(.*\)/\1/g" + local name + + [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) + [ -z "$name" ] && name="unknown" + + echo "$name" } |