diff --git a/client/hostinfo_unix_test.cpp b/client/hostinfo_unix_test.cpp index acc37394e9..dadb74311b 100644 --- a/client/hostinfo_unix_test.cpp +++ b/client/hostinfo_unix_test.cpp @@ -56,6 +56,10 @@ int main(void) { #elif __arm__ strcpy(p_vendor, "ARM "); vendor_hack = vendor_found = true; +#elif __aarch64__ + strcpy(p_vendor, "ARM "); + vendor_hack = vendor_found = true; + model_hack = true; #endif strcpy(features, ""); @@ -96,6 +100,9 @@ int main(void) { strstr(buf, "cpu\t\t: ") #elif __arm__ strstr(buf, "Processor\t: ") || strstr(buf, "model name") +#elif __aarch64__ + // Hardware is a fallback available on ODROID devices + strstr(buf, "Processor\t: ") || strstr(buf, "CPU architecture: ") || strstr(buf, "Hardware\t: ") #else strstr(buf, "model name\t: ") || strstr(buf, "cpu model\t\t: ") #endif @@ -122,6 +129,18 @@ int main(void) { family = atoi(testc); continue; /* skip this line */ } +#endif +#ifdef __aarch64__ + /* depending on kernel version, CPU architecture can either be + * a number or a string. If a string, we have a model name, else we don't + * also checks "Hardware" for ODROID devices as a fallback*/ + char *testc = NULL; + testc = strrchr(buf, ':')+2; + if (!isdigit(*testc)) { + model_found = true; + strlcpy(p_model, strchr(buf, ':') + 2, sizeof(p_model)); + continue; /* skip this line */ + } #endif model_found = true; strlcpy(buf2, strchr(buf, ':') + 2, sizeof(p_model) - strlen(p_model) - 1);