aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2012-03-31 20:53:30 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2012-03-31 20:53:30 +0200
commit5605030ed4ac28efe0430c2210fa507f97d9aa20 (patch)
treeae9b7a0ff19a41cb46a502af4cc09e62399e40c1
parent7a3699cf4c1102cddb7ace1c089364634c25a227 (diff)
downloadvicious-legacy-5605030ed4ac28efe0430c2210fa507f97d9aa20.tar.xz
thermal: change coretemp default, allow file as widget argument
Since Linux 3.0 most if not all people have temp1_input file missing, so default to temp2_input. But also allow an optional third argument to change to yet another file to avoid this kind of problem in the future.
-rw-r--r--widgets/thermal.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/widgets/thermal.lua b/widgets/thermal.lua
index 1906568..c81431f 100644
--- a/widgets/thermal.lua
+++ b/widgets/thermal.lua
@@ -22,7 +22,7 @@ local function worker(format, warg)
local zone = { -- Known temperature data sources
["sys"] = {"/sys/class/thermal/", file = "temp", div = 1000},
- ["core"] = {"/sys/devices/platform/", file = "temp1_input",div = 1000},
+ ["core"] = {"/sys/devices/platform/", file = "temp2_input",div = 1000},
["proc"] = {"/proc/acpi/thermal_zone/",file = "temperature"}
} -- Default to /sys/class/thermal
warg = type(warg) == "table" and warg or { warg, "sys" }
@@ -30,7 +30,7 @@ local function worker(format, warg)
-- Get temperature from thermal zone
local thermal = helpers.pathtotable(zone[warg[2]][1] .. warg[1])
- local data = thermal[zone[warg[2]].file]
+ local data = warg[3] and thermal[warg[3]] or thermal[zone[warg[2]].file]
if data then
if zone[warg[2]].div then
return {data / zone[warg[2]].div}