From 0b11325f1fb3ac81a72348c2432394233ddc5542 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 5 May 2012 03:43:54 +0200 Subject: Possible solution for coretemp files reading (github issue #38) Apparently, temp1_label does not follow the same naming pattern as the rest of label files. --- src/Plugins/Monitors/CoreTemp.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Plugins/Monitors/CoreTemp.hs b/src/Plugins/Monitors/CoreTemp.hs index f7b5c95..2880751 100644 --- a/src/Plugins/Monitors/CoreTemp.hs +++ b/src/Plugins/Monitors/CoreTemp.hs @@ -17,6 +17,9 @@ module Plugins.Monitors.CoreTemp where import Plugins.Monitors.Common import Plugins.Monitors.CoreCommon + +import Data.Char (isDigit) + -- | -- Core temperature default configuration. Default template contains only one -- core temperature, user should specify custom template in order to get more @@ -31,9 +34,10 @@ coreTempConfig = mkMConfig -- Function retrieves monitor string holding the core temperature -- (or temperatures) runCoreTemp :: [String] -> Monitor String -runCoreTemp _ = let path = ["/sys/bus/platform/devices/coretemp.", "/temp", "_input"] - lbl = Just ("_label", read . drop 5) +runCoreTemp _ = let path = ["/sys/bus/platform/devices/coretemp.", + "/temp", + "_input"] + lbl = Just ("_label", read . (dropWhile (not . isDigit))) divisor = 1e3 :: Double failureMessage = "CoreTemp: N/A" in checkedDataRetrieval failureMessage path lbl (/divisor) show - -- cgit v1.2.3