]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/fireinfo/0001-bogomips-Don-t-crash-when-no-bogomips-are-available.patch
fireinfo: Import latest patches
[people/pmueller/ipfire-2.x.git] / src / patches / fireinfo / 0001-bogomips-Don-t-crash-when-no-bogomips-are-available.patch
CommitLineData
bfb421f1
MT
1From a9401d9542fae575d9ce2bb534cd4e598e9c7b8e Mon Sep 17 00:00:00 2001
2From: Michael Tremer <michael.tremer@ipfire.org>
3Date: Tue, 28 Oct 2014 21:14:41 +0100
405d20bc 4Subject: [PATCH 1/3] bogomips: Don't crash when no bogomips are available
bfb421f1
MT
5
6The RPi doesn't provide bogomips in /proc/cpuinfo any more
7and fireinfo crashed when trying to read that file
8---
9 src/fireinfo/cpu.py | 14 +++++++++-----
10 src/fireinfo/system.py | 4 +++-
11 2 files changed, 12 insertions(+), 6 deletions(-)
12
13diff --git a/src/fireinfo/cpu.py b/src/fireinfo/cpu.py
14index 32d885db8124..541575af6bbb 100644
15--- a/src/fireinfo/cpu.py
16+++ b/src/fireinfo/cpu.py
17@@ -80,12 +80,16 @@ class CPU(object):
18 """
19 Return the bogomips of this CPU.
20 """
21- try:
22- bogomips = self.__cpuinfo["bogomips"]
23- except KeyError:
24- bogomips = self.__cpuinfo["BogoMIPS"]
25+ bogomips = None
26+
27+ for key in ("bogomips", "BogoMIPS"):
28+ try:
29+ bogomips = self.__cpuinfo[key]
30+ except KeyError:
31+ continue
32
33- return float(bogomips)
34+ if bogomips:
35+ return float(bogomips)
36
37 @property
38 def model(self):
39diff --git a/src/fireinfo/system.py b/src/fireinfo/system.py
40index 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
51 }
52
53+ if self.cpu.bogomips:
54+ p["bogomips"] = self.cpu.bogomips
55+
56 p["network"] = {
57 "green" : self.network.has_green(),
58 "blue" : self.network.has_blue(),
59--
601.9.3
61