From 03fd2468251d6201f2e5a161e5357c329c164ea9 Mon Sep 17 00:00:00 2001 From: erpalma Date: Tue, 22 Dec 2020 09:46:17 +0100 Subject: [PATCH] Print a warning if different MSR values are read. Fix #231 --- lenovo_fix.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lenovo_fix.py b/lenovo_fix.py index a3f9ca7..48bdc35 100755 --- a/lenovo_fix.py +++ b/lenovo_fix.py @@ -182,7 +182,9 @@ def readmsr(msr, from_bit=0, to_bit=63, cpu=None, flatten=False): os.close(f) output.append(get_value_for_bits(val, from_bit, to_bit)) if flatten: - return output[0] if len(set(output)) == 1 else output + if len(set(output)) > 1: + warning('Found multiple values for {:s} (0x{:x}). This should never happen.') + return output[0] return output[cpu] if cpu is not None else output except (IOError, OSError) as e: if e.errno == EPERM or e.errno == EACCES: