WiringPi: Get model name from Device Tree if not able from cpuinfo

Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: I0ca6497da3a9b0123b552fe7c245f08915d69a39
This commit is contained in:
Yang Deokgyu
2019-12-23 18:38:15 +09:00
parent 8ec73fe14e
commit 0e022544ef
3 changed files with 34 additions and 15 deletions

View File

@@ -10,6 +10,9 @@ case "$1" in
configure)
if [ -c "/dev/gpiomem" ] && [ "$(stat -c "%a %G" "/dev/gpiomem")" != "660"*"odroid" ]; then
hardware=$(fgrep -a Hardware /proc/cpuinfo | head -1 | awk '{ printf("%s %s %s\n", $3, $4, $5) }' | xargs)
[ "$hardware",, != *"odroid"* ] \
&& [ -f "/sys/firmware/devicetree/base/model" ] \
&& hardware=$(cat /sys/firmware/devicetree/base/model)
case "$(echo $hardware | tr [:upper:] [:lower:])" in
*xu4)
cp -f /tmp/odroid-wiringpi/rules.d/99-odroid-wiringpi-exynos.rules /etc/udev/rules.d/