From d054e73f5d490e617136743a7c3ec3dcd1c251b8 Mon Sep 17 00:00:00 2001 From: leeboby Date: Thu, 19 Sep 2019 09:18:49 +0800 Subject: [PATCH] add select_boards function --- build | 35 ++++++++++++++++++++++++++++++++++- wiringPi/OrangePi.c | 3 +++ 2 files changed, 37 insertions(+), 1 deletion(-) mode change 100755 => 100644 wiringPi/OrangePi.c diff --git a/build b/build index 6844946..24a600b 100755 --- a/build +++ b/build @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e # build # Simple wiringPi build and install script @@ -43,6 +43,37 @@ check_make_ok() { fi } +select_boards() +{ + local cnt=0 + local choice + local call=${1} + + boards=("OrangePi_PC2" "OrangePi_A64" "OrangePi_ZERO" "OrangePi_H3" "OrangePi_LITE2" "OrangePi_H3_ZEROPLUS2" "OrangePi_3") + + printf "All available boards:\n" + for var in ${boards[@]} ; do + printf "%4d. %s\n" $cnt ${boards[$cnt]} + ((cnt+=1)) + done + + while true ; do + read -p "Choice: " choice + if [ -z "${choice}" ] ; then + continue + fi + + if [ -z "${choice//[0-9]/}" ] ; then + if [ $choice -ge 0 -a $choice -lt $cnt ] ; then + export PLATFORM="${boards[$choice]}" + echo $PLATFORM + break + fi + fi + printf "Invalid input ...\n" + done +} + sudo=${WIRINGPI_SUDO-sudo} if [ x$1 = "xclean" ]; then @@ -103,6 +134,8 @@ if [ x$1 != "x" ]; then exit 1 fi + select_boards + echo "wiringPi Build script" echo "=====================" echo diff --git a/wiringPi/OrangePi.c b/wiringPi/OrangePi.c old mode 100755 new mode 100644 index 7009bcb..c5d524e --- a/wiringPi/OrangePi.c +++ b/wiringPi/OrangePi.c @@ -1574,6 +1574,9 @@ int isOrangePi(void) /* Non-support */ char *OrangePi_string = "none"; #endif + //printf("OrangePi String is %s\n", OrangePi_string); + + return 1; if ((cpuFd = fopen("/proc/cpuinfo", "r")) == NULL) piGpioLayoutOops ("Unable to open /proc/cpuinfo") ;