aboutsummaryrefslogtreecommitdiff
path: root/thermal.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2009-10-02 20:52:46 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2009-10-02 20:52:46 +0200
commitddf9646b5eb8f016bb226a48112382cd6e5496f7 (patch)
tree4474b6c299c81cae159716583e9f4ea12cdd9605 /thermal.lua
parent0e863a52491851b69a2e4a4865bd65fe37496d22 (diff)
downloadvicious-legacy-ddf9646b5eb8f016bb226a48112382cd6e5496f7.tar.xz
thermal: added some comments
We still stick to ACPI thermal zones because they are most commonly exposed (with proper ACPI modules loaded). But if you can find another source of temperature exposed trough /sys use it. Current code should match a lot of sources, but in some cases you will want to modify it a bit, add a dot, or limit to two numbers (except when the value is 100+, you don't want to miss the fact your CPU is melting).
Diffstat (limited to 'thermal.lua')
-rw-r--r--thermal.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/thermal.lua b/thermal.lua
index 02e7f3c..5c39884 100644
--- a/thermal.lua
+++ b/thermal.lua
@@ -15,8 +15,11 @@ module("vicious.thermal")
-- {{{ Thermal widget type
local function worker(format, thermal_zone)
- -- Get thermal zone
+ -- Get an ACPI thermal zone
local f = io.open("/proc/acpi/thermal_zone/" .. thermal_zone .. "/temperature")
+ -- Fix your ACPI setup, or find another source of temperature
+ -- exposed trough /sys, if a thermal_zone can't be found.
+ if not f then return {"N/A"} end
local line = f:read("*line")
f:close()