2014-08-30 09:32:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2014 The Linux Foundation. All rights reserved.
|
|
|
|
# Copyright (C) 2011 OpenWrt.org
|
|
|
|
#
|
|
|
|
|
|
|
|
IPQ806X_BOARD_NAME=
|
|
|
|
IPQ806X_MODEL=
|
|
|
|
|
|
|
|
ipq806x_board_detect() {
|
|
|
|
local machine
|
|
|
|
local name
|
|
|
|
|
|
|
|
machine=$(cat /proc/device-tree/model)
|
|
|
|
|
|
|
|
case "$machine" in
|
|
|
|
*"AP148")
|
|
|
|
name="ap148"
|
|
|
|
;;
|
2017-03-14 16:04:28 +00:00
|
|
|
*"4040")
|
|
|
|
name="fritz4040"
|
|
|
|
;;
|
2016-05-27 14:26:42 +00:00
|
|
|
*"C2600")
|
|
|
|
name="c2600"
|
|
|
|
;;
|
2016-01-19 10:16:36 +00:00
|
|
|
*"D7800")
|
|
|
|
name="d7800"
|
|
|
|
;;
|
2015-04-21 07:15:47 +00:00
|
|
|
*"DB149")
|
|
|
|
name="db149"
|
|
|
|
;;
|
2016-10-25 06:40:34 +00:00
|
|
|
*"NBG6817")
|
|
|
|
name="nbg6817"
|
|
|
|
;;
|
2015-09-04 14:46:06 +00:00
|
|
|
*"R7500")
|
|
|
|
name="r7500"
|
|
|
|
;;
|
2016-08-19 20:56:24 +00:00
|
|
|
*"R7500v2")
|
|
|
|
name="r7500v2"
|
|
|
|
;;
|
2016-05-13 06:13:15 +00:00
|
|
|
*"Linksys EA8500"*)
|
|
|
|
name="ea8500"
|
|
|
|
;;
|
2016-06-21 09:55:00 +00:00
|
|
|
*"R7800")
|
|
|
|
name="r7800"
|
|
|
|
;;
|
2016-11-23 17:51:15 +00:00
|
|
|
*"VR2600v")
|
|
|
|
name="vr2600v"
|
|
|
|
;;
|
2014-08-30 09:32:58 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
[ -z "$name" ] && name="unknown"
|
|
|
|
|
|
|
|
[ -z "$IPQ806X_BOARD_NAME" ] && IPQ806X_BOARD_NAME="$name"
|
|
|
|
[ -z "$IPQ806X_MODEL" ] && IPQ806X_MODEL="$machine"
|
|
|
|
|
|
|
|
[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
|
|
|
|
|
|
|
|
echo "$IPQ806X_BOARD_NAME" > /tmp/sysinfo/board_name
|
|
|
|
echo "$IPQ806X_MODEL" > /tmp/sysinfo/model
|
|
|
|
}
|
|
|
|
|
|
|
|
ipq806x_board_name() {
|
|
|
|
local name
|
|
|
|
|
|
|
|
[ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
|
|
|
|
[ -z "$name" ] && name="unknown"
|
|
|
|
|
|
|
|
echo "$name"
|
|
|
|
}
|
2016-09-30 19:36:50 +00:00
|
|
|
|
|
|
|
ipq806x_get_dt_led() {
|
|
|
|
local label
|
|
|
|
local ledpath
|
2017-05-10 08:44:18 +00:00
|
|
|
local basepath="/proc/device-tree/base"
|
2016-09-30 19:36:50 +00:00
|
|
|
local nodepath="$basepath/aliases/led-$1"
|
|
|
|
|
|
|
|
[ -f "$nodepath" ] && ledpath=$(cat "$nodepath")
|
|
|
|
[ -n "$ledpath" ] && label=$(cat "$basepath$ledpath/label")
|
|
|
|
|
|
|
|
echo "$label"
|
|
|
|
}
|