From 6c27dd7204eeff6d7467dbab7889a169fef99798 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 19 Jul 2015 12:41:45 -0700 Subject: [PATCH] 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. --- client/hostinfo_unix.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/hostinfo_unix.cpp b/client/hostinfo_unix.cpp index 7c466f4b07..b2593e7f5a 100644 --- a/client/hostinfo_unix.cpp +++ b/client/hostinfo_unix.cpp @@ -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); } }