[PATCH powerd 2/2] fall back to device tree if olpc-hwinfo is unavailable
Sascha Silbe
silbe at activitycentral.com
Tue May 22 16:11:47 EDT 2012
olpc-hwinfo is shipped as part of olpc-utils, which does a lot of
changes to the system that are not suitable for most systems other
than XOs running OLPC OS. olpc-hwinfo will still be used if available,
but in addition to reading the DMI information (only available on x86,
i.e. on XO-1 and XO-1.5) we now check the device tree (if available),
thereby adding XO-1.75 support.
Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
---
powerd | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/powerd b/powerd
index c6d9487..028e666 100755
--- a/powerd
+++ b/powerd
@@ -793,6 +793,31 @@ read_hwinfo()
hwversion=$(olpc-hwinfo model)
return
fi
+ if [ -r /proc/device-tree/banner-name ]
+ then
+ case "$(</proc/device-tree/banner-name)" in
+ OLPC\ *)
+ hwvendor=OLPC
+ hwname=XO
+ ;;&
+ OLPC\ [BC][0-9])
+ hwversion=1
+ return
+ ;;
+ OLPC\ D[0-9])
+ hwversion=1.5
+ return
+ ;;
+ OLPC\ 1[ABC][0-9])
+ hwversion=1.75
+ return
+ ;;
+ OLPC\ 2[ABC][0-9])
+ hwversion=3
+ return
+ ;;
+ esac
+ fi
read hwvendor < /sys/class/dmi/id/sys_vendor ||
hwvendor="n/a"
read hwname < /sys/class/dmi/id/product_name ||
--
1.7.10
More information about the Devel
mailing list