Hey guys,
I don't know if this is the right mailing list to post this, so please correct
me if I'm wrong ;)
I'm using vicious thermal widget in order to keep track of my CPU temperature.
However, a recent kernel update changes the sysfs structure and the thermal
widget is expecting a file `temp1_input`.
This file does not exist on my system, but there are other files
`temp{2,3,4,5}_input`. Since there is no possibility to change the filename
used for temperature reading, I came up with this patch to use an optional
third argument for the filename when instantiating the widget.
Existing users of this widget will experience no difference, while users with
an odd sysfs structure like me can easily specify the correct filename for the
widget.
Is this the right approach to this issue or can I further improve the handling
of those non-default files?
Thanks,
Philipp
>From 30b8a0cc57c4504b53d12849c4d185c41a872c32 Mon Sep 17 00:00:00 2001
From: Philipp Ittershagen <[email protected]>
Date: Fri, 30 Mar 2012 17:27:27 +0200
Subject: [PATCH] thermal: Allow non-default filename of thermal input.
---
widgets/thermal.lua | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/widgets/thermal.lua b/widgets/thermal.lua
index 1906568..ec56c6e 100644
--- a/widgets/thermal.lua
+++ b/widgets/thermal.lua
@@ -30,7 +30,11 @@ 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]
+ -- Users may define a specific input file
+ local file = zone[warg[2]].file
+ if warg[3] then file = warg[3] end
+
+ local data = thermal[file]
if data then
if zone[warg[2]].div then
return {data / zone[warg[2]].div}
--
1.7.9.5