Add second TSC speed regular expression
[muen/mugenhwcfg.git] / src / creator.py
index 88f4139..e02f8f1 100644 (file)
@@ -78,24 +78,29 @@ class ProcessorCreator():
 
     def getSpeed(self, dmesgpath):
         "Gets speed value from dmesg"
-        regex = re.compile(r'.*Refined TSC clocksource calibration: '
-                           '(?P<speed>.*)')
+        regs = [re.compile(r'.*Refined TSC clocksource calibration: '
+                           '(?P<speed>.*)'),
+                re.compile(r'.*tsc: Detected (?P<speed>.*) processor')]
+
         result = 0
         try:
             data = extractor.extractData(dmesgpath)
-            match = regex.search(data)
-            if match is None:
-                message.addError("Could not find refined TSC clocksource "
-                                 "calibration results in: %s\n" % dmesgpath +
-                                 "Processor speed not found.")
-            result = util.getSpeedValue(match.group("speed"),
-                                        PROCESSOR_SPEED_KEYWORDS)
         except IOError:
             errstr = ("Could not read file: %s\n" % dmesgpath +
                       "Processor speed not found.")
             message.addError(errstr)
-        else:
-            return result
+
+        for regex in regs:
+            match = regex.search(data)
+            if match is not None:
+                result = util.getSpeedValue(match.group("speed"),
+                                            PROCESSOR_SPEED_KEYWORDS)
+                break
+
+        if not result:
+            message.addError("Could not find TSC speed in: %s\n" % dmesgpath)
+
+        return result
 
     def getVmxTimerRate(self, msrpaths, offset, vmxbitsize):
         # check for MSR