lantiq: add support for /tmp/sysinfo
authorJohn Crispin <john@openwrt.org>
Wed, 2 Jul 2014 16:33:11 +0000 (16:33 +0000)
committerJohn Crispin <john@openwrt.org>
Wed, 2 Jul 2014 16:33:11 +0000 (16:33 +0000)
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 41472

target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
target/linux/lantiq/base-files/etc/uci-defaults/01_leds
target/linux/lantiq/base-files/etc/uci-defaults/02_network
target/linux/lantiq/base-files/etc/uci-defaults/03_wireless-wps
target/linux/lantiq/base-files/lib/functions/lantiq.sh

index 427c5fc7a24e2d6fb0dd3bdf89d8e20a3936f3b3..5664c13ea81a3e8dadbfd1710772049c2e04d5ba 100644 (file)
@@ -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
index 70a14d9bd5533c1fb3da1adbf7c65d7899cce915..2b3293b79efd560675b1b0da90586aa83f85fd19 100644 (file)
@@ -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)
index 02f4f6a5fb3c44a7716ae1347c5a7e94cfbfbc81..22dea2a321b0b65dab67a614eb172b1f48120139 100644 (file)
@@ -68,7 +68,7 @@ payload="bridged"
 lan_mac=""
 wan_mac=""
 
-board=$(lantiq_board_id)
+board=$(lantiq_board_name)
 
 case "$board" in
 # adm6996
index f2412d7bc21674f7756b71e99a8f78b3c01331f1..e75fb8493fd6a98d034e9227560f6c3d65bee3db 100644 (file)
@@ -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
index ed76cd80144cfd69f7fdb10f299cda0136b7492e..88da794ca9df17f60f75755b5bd2667352ae68bb 100644 (file)
@@ -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"
 }