aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/base-files/lib/brcm2708.sh
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2015-02-14 20:48:08 +0000
committerJohn Crispin <john@openwrt.org>2015-02-14 20:48:08 +0000
commitdc72499b5326531b603ec38410602ff7ed7f1287 (patch)
tree47bbc3b4bde91d31f96080ab166d704a63fbd151 /target/linux/brcm2708/base-files/lib/brcm2708.sh
parenteea462106f20fbd90acc6cfba21c73b9677b2752 (diff)
downloadupstream-dc72499b5326531b603ec38410602ff7ed7f1287.tar.gz
upstream-dc72499b5326531b603ec38410602ff7ed7f1287.tar.bz2
upstream-dc72499b5326531b603ec38410602ff7ed7f1287.zip
brcm2708: add board detection and LED support
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> SVN-Revision: 44447
Diffstat (limited to 'target/linux/brcm2708/base-files/lib/brcm2708.sh')
-rwxr-xr-xtarget/linux/brcm2708/base-files/lib/brcm2708.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/target/linux/brcm2708/base-files/lib/brcm2708.sh b/target/linux/brcm2708/base-files/lib/brcm2708.sh
new file mode 100755
index 0000000000..76870c6a39
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/brcm2708.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+brcm2708_board_detect() {
+ local machine
+ local name
+
+ machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /Hardware/ {print $2}' /proc/cpuinfo)
+
+ case "$machine" in
+ BCM2708)
+ name="Raspberry Pi"
+ ;;
+ BCM2709)
+ name="Raspberry Pi 2"
+ ;;
+ esac
+
+ [ -z "$name" ] && name="unknown"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$machine" > /tmp/sysinfo/board_name
+ echo "$name" > /tmp/sysinfo/model
+}
+
+brcm2708_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}