From eab5960f5d2d6bd15119ff8f613b8d8f2df88287 Mon Sep 17 00:00:00 2001 From: Norbert Zeh Date: Mon, 8 Aug 2011 17:40:04 -0300 Subject: Cope with new file system layout of CPU temperature sensor readings Either due to a change in lm_sensors or in the kernel itself, the core temperature readings are no longer found in one directory per core but in multiple files in the same directory. What's worse is that the file names have little to do with the actual core number. This patch addresses this and is flexible enough to handle the old layout and the new one. --- src/Plugins/Monitors/CoreTemp.hs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/Plugins/Monitors/CoreTemp.hs') diff --git a/src/Plugins/Monitors/CoreTemp.hs b/src/Plugins/Monitors/CoreTemp.hs index a24b284..f7b5c95 100644 --- a/src/Plugins/Monitors/CoreTemp.hs +++ b/src/Plugins/Monitors/CoreTemp.hs @@ -31,11 +31,9 @@ coreTempConfig = mkMConfig -- Function retrieves monitor string holding the core temperature -- (or temperatures) runCoreTemp :: [String] -> Monitor String -runCoreTemp _ = do - let dir = "/sys/bus/platform/devices" - file = "temp1_input" - pattern = "coretemp." - divisor = 1e3 :: Double - failureMessage = "CoreTemp: N/A" - checkedDataRetrieval failureMessage dir file pattern (/divisor) show +runCoreTemp _ = let path = ["/sys/bus/platform/devices/coretemp.", "/temp", "_input"] + lbl = Just ("_label", read . drop 5) + divisor = 1e3 :: Double + failureMessage = "CoreTemp: N/A" + in checkedDataRetrieval failureMessage path lbl (/divisor) show -- cgit v1.2.3