1 From a9401d9542fae575d9ce2bb534cd4e598e9c7b8e Mon Sep 17 00:00:00 2001
2 From: Michael Tremer <michael.tremer@ipfire.org>
3 Date: Tue, 28 Oct 2014 21:14:41 +0100
4 Subject: [PATCH 1/2] bogomips: Don't crash when no bogomips are available
6 The RPi doesn't provide bogomips in /proc/cpuinfo any more
7 and fireinfo crashed when trying to read that file
9 src/fireinfo/cpu.py | 14 +++++++++-----
10 src/fireinfo/system.py | 4 +++-
11 2 files changed, 12 insertions(+), 6 deletions(-)
13 diff --git a/src/fireinfo/cpu.py b/src/fireinfo/cpu.py
14 index 32d885db8124..541575af6bbb 100644
15 --- a/src/fireinfo/cpu.py
16 +++ b/src/fireinfo/cpu.py
17 @@ -80,12 +80,16 @@ class CPU(object):
19 Return the bogomips of this CPU.
22 - bogomips = self.__cpuinfo["bogomips"]
24 - bogomips = self.__cpuinfo["BogoMIPS"]
27 + for key in ("bogomips", "BogoMIPS"):
29 + bogomips = self.__cpuinfo[key]
33 - return float(bogomips)
35 + return float(bogomips)
39 diff --git a/src/fireinfo/system.py b/src/fireinfo/system.py
40 index 8e903e8e3449..890f58c05027 100644
41 --- a/src/fireinfo/system.py
42 +++ b/src/fireinfo/system.py
43 @@ -144,12 +144,14 @@ class System(object):
44 "model_string" : self.cpu.model_string,
45 "stepping" : self.cpu.stepping,
46 "flags" : self.cpu.flags,
47 - "bogomips" : self.cpu.bogomips,
48 "speed" : self.cpu.speed,
49 "family" : self.cpu.family,
50 "count" : self.cpu.count
53 + if self.cpu.bogomips:
54 + p["bogomips"] = self.cpu.bogomips
57 "green" : self.network.has_green(),
58 "blue" : self.network.has_blue(),