From 141eec256543df987eed9994a32d74af5c17a608 Mon Sep 17 00:00:00 2001 From: Deokgyu Yang Date: Mon, 7 Sep 2020 17:45:31 +0900 Subject: [PATCH] Odroid-C1: Fix to keep compatibility with Odroid-C series which are not having proper model name like "Hardkernel ODROID-C1". Signed-off-by: Deokgyu Yang Change-Id: Ifcb1923435f2e7c1500d9ce14bd84b1e7ae0060d --- wiringPi/wiringPi.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c index f0fdaa5..768298a 100644 --- a/wiringPi/wiringPi.c +++ b/wiringPi/wiringPi.c @@ -435,17 +435,24 @@ int piGpioLayout (void) { buf = strchr(line, '-'); modelCodename = buf != NULL ? buf : strchr(line, ' '); - if (modelCodename == NULL) - wiringPiFailure(WPI_FATAL, "** Model string on this board is not well formatted **"); - modelCodename++; + if (modelCodename == NULL) { + if (strcmp(line, "ODROIDC") == 0) { + // Compatibility for Odroid-C series that are not having proper model name + libwiring.model = MODEL_ODROID_C1; + } else { + wiringPiFailure(WPI_FATAL, "** Model string on this board is not well formatted **"); + } + } else { + modelCodename++; - libwiring.model = 0; - for (i = 1; i <= sizeOfAssignedModelNames; i++) { - model = strstr(piModelNames[i], "-"); + libwiring.model = 0; + for (i = 1; i <= sizeOfAssignedModelNames; i++) { + model = strstr(piModelNames[i], "-"); - if (strcasestr(model, modelCodename) != NULL) { - libwiring.model = i; - break; + if (strcasestr(model, modelCodename) != NULL) { + libwiring.model = i; + break; + } } }