Client: test cpu detection on aarch64 (armv8)

This commit is contained in:
Christian Beer 2016-06-17 16:24:49 +02:00
parent 1285474ca1
commit a6675cf29e
1 changed files with 19 additions and 0 deletions

View File

@ -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);