client: parse ARM CPU model

Apparently the format of /proc/cpuinfo has changed on some ARM Linuxes,
e.g. Raspbian Wheezy.
The CPU model is something like:

model name  : ARMv7 Processor rev 5 (v7l)

and the chars between "name" and ":" can be either spaces or a tab.
This commit is contained in:
David Anderson 2015-07-19 12:41:45 -07:00 committed by Rom Walton
parent 9b76d65b65
commit 6c27dd7204
1 changed files with 3 additions and 2 deletions

View File

@ -530,7 +530,7 @@ static void parse_cpuinfo_linux(HOST_INFO& host) {
#elif __powerpc__ || __sparc__
strstr(buf, "cpu\t\t: ")
#elif __arm__
strstr(buf, "Processor\t: ")
strstr(buf, "Processor\t: ") || strstr(buf, "model name")
#else
strstr(buf, "model name\t: ") || strstr(buf, "cpu model\t\t: ")
#endif
@ -559,7 +559,8 @@ static void parse_cpuinfo_linux(HOST_INFO& host) {
}
#endif
model_found = true;
strlcpy(buf2, strchr(buf, ':') + 2, sizeof(host.p_model) - strlen(host.p_model) - 1);
strlcpy(buf2, strchr(buf, ':') + 1, sizeof(host.p_model) - strlen(host.p_model) - 1);
strip_whitespace(buf2);
strcat(host.p_model, buf2);
}
}