Closed Kazenin closed 7 years ago
Image below for better understanding
Does the sensors
command show you the temperatures? If not, you may have to (carefully) run sensors-detect
.
If sensors
does show you the temperatures, please post your glxosd_config.lua
to rule out any configuration issues.
Thanks for answer my friend. sensors
command show the temperatures. See below
$ sensors coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +55.0°C (high = +80.0°C, crit = +100.0°C) Core 0: +55.0°C (high = +80.0°C, crit = +100.0°C) Core 1: +49.0°C (high = +80.0°C, crit = +100.0°C) Core 2: +52.0°C (high = +80.0°C, crit = +100.0°C) Core 3: +52.0°C (high = +80.0°C, crit = +100.0°C)
acpitz-virtual-0 Adapter: Virtual device temp1: +27.8°C (crit = +105.0°C) temp2: +29.8°C (crit = +105.0°C)
asus-isa-0000 Adapter: ISA adapter cpu_fan: 850 RPM
My glxosd_config.lua
:
--[[ The main configuration file for GLXOSD. This is a basic Lua script that sets the GLXOSD_CONFIG global to the configuration to be used.
It is preferable that you create a copy of this file in
$XDG_CONFIG_HOME/glxosd/ (or ~/.config/glxosd/ if $XDG_CONFIG_HOME isn't
set) because the global version may be replaced during an update.
For full documentation, please see
https://glxosd.nickguletskii.com/docs/config/
To customise paths, please see paths.lua.
ConfigurationManager.config_file("paths.lua")
--[[ The master opacity. This is the coefficient for all opacity values. ]] local MASTER_OPACITY = 1
--[[ A table of colors that will be used later on in the config. Each color is represented by a table that has four keys: r, g, b and a. ]] local COLORS_CONFIG = { -- The default text color DEFAULT = {r = 1, g = 0, b = 1, a = 1 MASTER_OPACITY}, -- The color of the text outline OUTLINE = {r = 0, g = 0, b = 1, a = 0 MASTER_OPACITY}, -- The color to be used to highlight critical temperatures, low FPS, etc... BAD_VALUE = {r = 1, g = 0, b = 0, a = 1 MASTER_OPACITY}, -- The color to be used to highlight high temperatures and other warnings WARNING_VALUE = {r = 1, g = 1, b = 0, a = 1 MASTER_OPACITY}, -- The color to be used to highlight acceptable temperatures and normal FPS GOOD_VALUE = {r = 0, g = 1, b = 0, a = 1 MASTER_OPACITY}, -- Completely transparent NONE = {r = 0, g = 0, b = 0, a = 0 MASTER_OPACITY} }
--[[ The default config for all OSD section headers. ]] local DEFAULT_HEADER_CONFIG = { -- If set to true, display section headers. enabled = true,
--[[
General markup configuration.
For available options, please see the section about markup in the
documentation.
]]
color = COLORS_CONFIG.DEFAULT,
font_size = 20,
underline = {
enabled = true,
color = COLORS_CONFIG.DEFAULT
}
}
local FrameDataProvider_formats_short = { header = "Frame timings", fps = "FPS: ", fps_number = "%.2f", average_frame_duration = "AFD: %.2f ms", osd_averate_time_spent_per_frame = "OSDATSPF: %.2f ms", no_data = "Collecting..." }
local FrameDataProvider_formats_long = { header = "Frame timings", fps = "Frames Per Second: ", fps_number = "%.2f", average_frame_duration = "Average Frame Duration: %.2f ms", osd_averate_time_spent_per_frame = "Average time spent by OSD per frame: %.2f ms", no_data = "Collecting frame data..." }
local LibsensorsDataProvider_formats = { header = "Sensors" }
local NVMLDataProvider_formats_long = { header = "NVIDIA GPUs", temperature = "Temperature: ", throttled = "(thrtl)", graphics_clock = "Graphics clock: %d", sm_clock = "SM clock: %d", memory_clock = "Memory clock: %d", gpu_utilisation = "GPU utilisation: %d%%", memory_utilisation = "Memory utilisation: %d%%" }
--[[ The config for the OSD. ]] local OSD_CONFIG = { --[[ The time in milliseconds between OSD redraws. This is done to lower the overhead because reuploading the text to the GPU every frame is expensive. ]] refresh_time = 1000,
--[[
The alignment of the OSD's bounding box in respect to the view.
Acceptable values for align_to_h:
* left - aligns the left side of the OSD to the left side of the view
* right - aligns the right side of the OSD to the right side of the view
* right_absolute - aligns the left side of the OSD to the right side of
the view
Acceptable values for align_to_v:
* top - aligns the top side of the OSD to the top side of the view
* bottom - aligns the bottom side of the OSD to the bottom side of the
view
* bottom_absolute - aligns the top side of the OSD to the bottom side of
the view
]]
align_to_h = "left",
align_to_v = "top",
--[[
The position of the OSD in respect to the corner it's aligned to.
]]
offset_x = 0,
offset_y = 0,
--[[
The font to be used. This is a Fontconfig font query string.
]]
font = "Ubuntu:Bold",
--[[
The text size.
]]
font_size = 16,
--[[
Text alignment in respect to the OSD's bounding box.
Possible values: left, right, center
]]
text_alignment = "left",
--[[
Outline configuration
]]
outline = {
--[[
The type of the outline. Possible values include:
* none - no outline
* outer - outer rim of the symbols
* inner - inner rim of the symbols
* inside - the interior of the symbols
]]
type = "outer",
--[[
The thickness of the outline.
]]
thickness = 0.5,
--[[
The color of the outline.
]]
color = COLORS_CONFIG.OUTLINE
},
--[[
Value used for gamma correction.
]]
gamma = 1,
--[[
LCD filtering may improve the appearance of the text.
Set this setting to true to enable LCD filtering and to false to disable
it.
]]
lcd_filter_enabled = true,
--[[
Settings for the underline, overline and strikethrough.
Pretty self-explanatory.
]]
underline = {
enabled = false,
color = COLORS_CONFIG.NONE
},
overline = {
enabled = false,
color = COLORS_CONFIG.NONE
},
strikethrough = {
enabled = false,
color = COLORS_CONFIG.NONE
},
--[[
The color of the text.
]]
color = COLORS_CONFIG.DEFAULT,
--[[
The background color of each symbol.
]]
background_color = COLORS_CONFIG.NONE,
--[[
The key combination that toggles the OSD visibility. Set to nil to
disable.
]]
toggle_key_combo = {
--[[
The name of the main key.
]]
main_key = "F10",
--[[
A list of modifier keys that have to be pressed when the main key is
pressed.
Possible values include: shift, alt, control, caps. Use an empty
list to make a key combo that doesn't require any modifier keys.
]]
modifiers = {"shift"}
},
--[[
The list of data providers to collect data from.
Each data provider is described by three key-value pairs:
* path - the path to the data provider's main file
* enabled - whether this data provider is currently enabled or not
* config - the configuration to pass to the data provider
]]
osd_data_providers = {
{
path = "plugins/OSD/dataproviders/FrameDataProvider",
enabled = true,
config = {
--[[
If the FPS is lower than this setting, the default
formatter_function will highlight the FPS as a bad value.
]]
low_fps = 55,
--[[
The FrameDataProvider provides the data from the last
complete chunk (timespan) of n milliseconds, where n is the
value of refresh_time.
]]
refresh_time = 3000,
--[[
The color of acceptable values (e.g. high enough FPS).
]]
acceptable_value_color = COLORS_CONFIG.GOOD_VALUE,
--[[
The color of unacceptable values (e.g. low FPS).
]]
unacceptable_value_color = COLORS_CONFIG.BAD_VALUE,
--[[
An ordered list of the statistics to be displayed. You can
reorder or remove these to customise in what order and what
statistics are displayed.
]]
data_order = {
-- Frames Per Second (over the last timespan).
"FPS",
-- Average Frame Duration (over the timespan).
"AFD",
--[[
OSD Average Time Spent Per Frame - time spent by GLXOSD
per frame on average over the last timespan.
]]
"OSDATSPF"
},
--[[
The function used for formatting the text on the OSD.
This can be used to completely customize what data is shown
and how it is formatted.
]]
formatter_function = ConfigurationManager
.config_file("OSD/dataproviders/FrameDataProvider/formatterfunction.lua"),
--[[
The style of the header of the section.
]]
header_style = DEFAULT_HEADER_CONFIG,
--[[
The strings and formats for the this data provider.
]]
format = FrameDataProvider_formats_short
}
},
{
path = "plugins/OSD/dataproviders/LibsensorsDataProvider",
enabled = true,
config = {
--[[
The function used to filter out chips that you don't want to
be displayed in the OSD.
This function has two parameters:
* self - the instance of the data provider
* chip - the chip to be considered.
For more information, please see the default formatter
function located in
OSD/dataproviders/LibsensorsDataProvider/formatterfunction.lua
]]
chip_filter_function = function(self, chip)
return true
end,
--[[
The function used to filter out features that you don't want
to be displayed in the OSD.
This function has three parameters:
* self - the instance of the data provider
* chip - the chip to be considered.
For more information, please see the default formatter
function located in
OSD/dataproviders/LibsensorsDataProvider/formatterfunction.lua
]]
feature_filter_function = function(self, chip, feature)
--[[
For example, you can use the following line
to hide per-core temperatures on Intel CPUs:
]]
--return not string.match(feature.label, "Core.*")
return true
end,
--[[
If the temperature is above the maximum temperature for the
device minus max_temperature_warning_threshold, the
temperature will be highlighted.
]]
max_temperature_warning_threshold = 10,
--[[
The color to be used in case the maximum acceptable
temperature is unknown.
]]
default_temperature_color = COLORS_CONFIG.DEFAULT,
--[[
The color to be used if the color is under the maximum
temperature for the device minus the warning threshold.
]]
good_temperature_color = COLORS_CONFIG.GOOD_VALUE,
--[[
The color to be used if the color is over the maximum
temperature for the device minus the warning threshold, but
under the maximum temperature for the device.
]]
warning_temperature_color = COLORS_CONFIG.WARNING_VALUE,
--[[
The color to be used if the color is over the maximum
temperature for the device.
]]
overheating_temperature_color = COLORS_CONFIG.BAD_VALUE,
--[[
The function used for formatting the text on the OSD.
This can be used to completely customize what data is shown
and how it is formatted.
]]
formatter_function = ConfigurationManager
.config_file("OSD/dataproviders/LibsensorsDataProvider/formatterfunction.lua"),
--[[
The style of the header of the section.
]]
header_style = DEFAULT_HEADER_CONFIG,
--[[
The strings and formats for the this data provider.
]]
format = LibsensorsDataProvider_formats
}
},
{
path = "plugins/OSD/dataproviders/NVMLDataProvider",
enabled = true,
config = {
--[[
The color to be used in case the slowdown and shutdown
temperatures are unknown.
]]
default_temperature_color = COLORS_CONFIG.DEFAULT,
--[[
The color to be used to represent normal temperatures.
]]
normal_temperature_color = COLORS_CONFIG.GOOD_VALUE,
--[[
The color to be used to represent temperatures that cause
a slowdown of the graphics card.
]]
slowdown_temperature_color = COLORS_CONFIG.WARNING_VALUE,
--[[
The color to be used to represent temperatures that may
cause a graphics card shutdown.
]]
shutdown_temperature_color = COLORS_CONFIG.BAD_VALUE,
--[[
The ordered set of the statistics to be displayed.
You can reorder or remove these to customise in what order
and what statistics are displayed.
]]
data_order = {
"temperature",
"gpu_utilisation",
"memory_utilisation",
"graphics_clock",
"memory_clock",
"sm_clock",
},
--[[
The function used for formatting the text on the OSD.
This can be used to completely customize what data is shown
and how it is formatted.
]]
formatter_function = ConfigurationManager
.config_file("OSD/dataproviders/NVMLDataProvider/formatterfunction.lua"),
--[[
The style of the header of the section.
]]
header_style = DEFAULT_HEADER_CONFIG,
--[[
The strings and formats for the this data provider.
]]
format = NVMLDataProvider_formats_long
}
}
}
}
--[[ The config for the frame timing logging (benchmarking) plugin. ]] TIME_RECORDER_CONFIG = { --[[ The directory to write the time logs to. ]] benchmark_output_directory = "/tmp/",
--[[
The key combination to toggle the OSD visibility. Set to nil to disable.
]]
start_benchmark_key = {
--[[
The name of the main key.
]]
main_key = "F9",
--[[
The list of modifier keys.
Possible values include: shift, alt, control, caps.
]]
modifiers = {"shift"}
},
--[[
The key combination to toggle the OSD visibility. Set to nil to disable.
You can use the same key as start_benchmark_key.
]]
end_benchmark_key = {
--[[
The name of the main key.
]]
main_key = "F9",
--[[
The list of modifier keys.
Possible values include: shift, alt, control, caps.
]]
modifiers = {"shift"}
},
--[[
If this is set to true, GLXOSD will not execute potentially expensive
tasks such as rendering the OSD while logging frame timings.
]]
enable_minimise_overhead_mode_during_benchmark = true
}
GLXOSD_CONFIG = {
--[[
The list of GLXOSD plugins.
Each plugin is described by three key-value pairs:
* path - the path to the plugin's main file
* enabled - whether this plugin is currently enabled or not
* config - the configuration to pass to the plugin
]]
plugins = {
{
path = "plugins/OSD/OSD",
enabled = true,
config = OSD_CONFIG
},
{
path = "plugins/TimeRecorder/TimeRecorder",
enabled = true,
config = TIME_RECORDER_CONFIG
}
}
}
return GLXOSD_CONFIG
Hmm, maybe SELinux is preventing GLXOSD from accessing sensor data? If that is not the case, I'll try to set up a Fedora test VM tomorrow.
Maybe not, because Selinux is disabled here. Thanks for help mate
Hmm, I've installed Fedora in a VM and GLXOSD does show sensors here. Is there any output in the terminal when you run glxosd glxgears
? And what is the output of sensors -u
?
Hi Nick,
Well, below the output of glxosd glxgears
$ glxosd glxgears Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. 698 frames in 5.0 seconds = 139.520 FPS 720 frames in 5.0 seconds = 143.997 FPS 720 frames in 5.0 seconds = 143.999 FPS
and now, sensors -u
$ sensors -u coretemp-isa-0000 Adapter: ISA adapter Physical id 0: temp1_input: 38.000 temp1_max: 80.000 temp1_crit: 100.000 temp1_crit_alarm: 0.000 Core 0: temp2_input: 37.000 temp2_max: 80.000 temp2_crit: 100.000 temp2_crit_alarm: 0.000 Core 1: temp3_input: 35.000 temp3_max: 80.000 temp3_crit: 100.000 temp3_crit_alarm: 0.000 Core 2: temp4_input: 36.000 temp4_max: 80.000 temp4_crit: 100.000 temp4_crit_alarm: 0.000 Core 3: temp5_input: 37.000 temp5_max: 80.000 temp5_crit: 100.000 temp5_crit_alarm: 0.000
acpitz-virtual-0 Adapter: Virtual device temp1: temp1_input: 27.800 temp1_crit: 105.000 temp2: temp2_input: 29.800 temp2_crit: 105.000
asus-isa-0000 Adapter: ISA adapter cpu_fan: fan1_input: 0.000
Have you modified any of the formatter functions (specifically, the one located in OSD/dataproviders/LibsensorsDataProvider/formatterfunction.lua
)? This is really weird, because with the default config the OSD shouldn't be showing asus-isa-0000
at all, since it has no temperature information.
Yes, I change line 22 from:
local chip_temperature_found = false
to:
local chip_temperature_found = true
But I modified to default again.
Nick, any idea?
My paths.lua to show nvidia information:
local io = require("io") local ffi = require("ffi") local arch = ConfigurationManager.config_file("arch.lua")
local function get_nvidia_driver_version() local f = io.open("/proc/driver/nvidia/version", "r") if not f then return nil end local res = f:read("*line"):match("Kernel Module%s+([0-9]+)%.") f:close() return res end
local NVIDIA_DRIVER_VERSION = get_nvidia_driver_version() or "unknown"
PATH_CONFIG = { x64 = { x64 = { libGL = "libGL.so.1", libX11 = "libX11.so.6", libfreetype_gl = "libglxosd-freetype-gl.so.3", libfontconfig = "libfontconfig.so.1", libsensors = "/usr/lib64/libsensors.so.4", libnvidia_ml = "/usr/lib64/libnvidia-ml.so.1" }, x86 = { libGL = "libGL.so.1", libX11 = "libX11.so.6", libfreetype_gl = "libglxosd-freetype-gl.so.3", libfontconfig = "libfontconfig.so.1", libsensors = "/usr/lib/libsensors.so.4", libnvidia_ml = "/usr/lib/libnvidia-ml.so.1" } }, x86 = { x86 = { libGL = "libGL.so.1", libX11 = "libX11.so.6", libfreetype_gl = "libglxosd-freetype-gl.so.3", libfontconfig = "libfontconfig.so.1", libsensors = "/usr/lib/libsensors.so.4", libnvidia_ml = "/usr/lib/libnvidia-ml.so.1" } } }
CURRENT_PATH_CONFIG = PATH_CONFIG[arch.kernel_architecture][ffi.arch]
Hi, sorry for the long wait, I've been very busy and forgot about this issue. It is hard to debug this because I don't have the same hardware as you (I only have one chip) and there is no way to create mock devices for libsensors.
Please try replacing the contents of /usr/share/glxosd/glxosd/plugins/OSD/dataproviders/LibsensorsDataProvider.lua
with the following (backup the original file first) and paste a fragment of the output produced by glxosd glxgears
:
--[[
Copyright (C) 2016 Nick Guletskii
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local ffi = require("ffi")
local sens = require("ffi/libsensors")
local DummyStatistics = require("plugins/OSD/dataproviders/DummyDataProvider")
local MarkupElement = require("rendering/MarkupElement")
if not sens then
return DummyStatistics
end
sens.sensors_init(nil);
local LibsensorsDataProvider = {
}
LibsensorsDataProvider.__index = LibsensorsDataProvider;
function LibsensorsDataProvider:begin_frame ()
end
function LibsensorsDataProvider:end_frame ()
end
function LibsensorsDataProvider:begin_timespan ()
end
local function subfeatures(chip, feature)
local subfeature_number = ffi_types.int_ref();
local subfeatures = {}
while true do
local subfeature = sens.sensors_get_all_subfeatures(chip, feature, subfeature_number)
if subfeature == nil then
break
end
local name = ffi.string(subfeature[0].name)
local val = ffi_types.double_ref()
sens.sensors_get_value(chip, subfeature[0].number, val)
print(" " .. LIBSENSORS_SUBFEATURE_TYPES[tonumber(subfeature[0].type)] .. " " .. val[0])
subfeatures[name] = {
type=LIBSENSORS_SUBFEATURE_TYPES[tonumber(subfeature[0].type)],
value = val[0]
}
end
return subfeatures
end
local function features(chip)
local feature_number = ffi_types.int_ref();
local features = {}
while true do
local feature = sens.sensors_get_features(chip, feature_number)
if feature == nil then
break
end
local name = ffi.string(feature[0].name)
local label_s = sens.sensors_get_label(chip,feature[0])
print(" " .. ffi.string(label_s))
if label_s ~= nil then
local label = ffi.string(label_s);
ffi.C.free(label_s)
features[name] = {
label = label,
subfeatures = subfeatures(chip, feature)
}
end
end
features['Aa'] = {
label = "Aaaa",
subfeatures = {TEMP_INPUT={type='TEMP_INPUT',value=10}}
}
return features
end
local function chips()
local chip_number = ffi_types.int_ref();
local chips = {}
while true do
local chip = sens.sensors_get_detected_chips(nil, chip_number)
if chip == nil then
break
end
local chipNameBuffer = ffi_types.char_arr(256);
local num = sens.sensors_snprintf_chip_name(chipNameBuffer, 256, chip);
local name = ffi.string(chipNameBuffer, num)
chips[chip[0].addr] = {
name=name,
features = features(chip)
}
end
return chips
end
function LibsensorsDataProvider:end_timespan ()
end
function LibsensorsDataProvider:get_text()
local status, res = pcall(function()
local tbl = self.config.formatter_function(self, chips(), MarkupElement)
assert(tbl and type(tbl) == "table", "The Libsensors data provider formatter function must return a table of elements!")
tbl = remove_nils_from_array(tbl);
for _,v in ipairs(tbl) do
check_class(v, "MarkupElement")
end
return tbl
end)
if not status then
log_error("Libsensors data provider plugin error: formatter function threw and error: " .. res)
return {
MarkupElement.new({
text ="Libsensors data provider plugin error.\nPlease check the log.\n"
})
}
end
return res
end
function LibsensorsDataProvider.new(config)
local self ={}
setmetatable(self, LibsensorsDataProvider)
self.config = config
return self
end
return LibsensorsDataProvider
Hi my friend. Sorry to disturb you. I made the changes and follow the output:
Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. Physical id 0 TEMP_INPUT 44 TEMP_MAX 80 TEMP_CRIT 100 TEMP_CRIT_ALARM 0 Core 0 TEMP_INPUT 43 TEMP_MAX 80 TEMP_CRIT 100 TEMP_CRIT_ALARM 0 Core 1 TEMP_INPUT 46 TEMP_MAX 80 TEMP_CRIT 100 TEMP_CRIT_ALARM 0 Core 2 TEMP_INPUT 42 TEMP_MAX 80 TEMP_CRIT 100 TEMP_CRIT_ALARM 0 Core 3 TEMP_INPUT 41 TEMP_MAX 80 TEMP_CRIT 100 TEMP_CRIT_ALARM 0 temp1 TEMP_INPUT 27.8 TEMP_CRIT 105 temp2 TEMP_INPUT 29.8 TEMP_CRIT 105 cpu_fan FAN_INPUT 0 Physical id 0 TEMP_INPUT 44 TEMP_MAX 80 TEMP_CRIT 100 TEMP_CRIT_ALARM 0
Thank you, I have a hypothesis, but I can't test it on my machine due to a lack of sensors. Could you now replace the contents of /usr/share/glxosd/glxosd/plugins/OSD/dataproviders/LibsensorsDataProvider.lua
with the following?
--[[
Copyright (C) 2016 Nick Guletskii
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local ffi = require("ffi")
local sens = require("ffi/libsensors")
local DummyStatistics = require("plugins/OSD/dataproviders/DummyDataProvider")
local MarkupElement = require("rendering/MarkupElement")
if not sens then
return DummyStatistics
end
sens.sensors_init(nil);
local LibsensorsDataProvider = {
}
LibsensorsDataProvider.__index = LibsensorsDataProvider;
function LibsensorsDataProvider:begin_frame ()
end
function LibsensorsDataProvider:end_frame ()
end
function LibsensorsDataProvider:begin_timespan ()
end
local function subfeatures(chip, feature)
local subfeature_number = ffi_types.int_ref();
local subfeatures = {}
while true do
local subfeature = sens.sensors_get_all_subfeatures(chip, feature, subfeature_number)
if subfeature == nil then
break
end
local name = ffi.string(subfeature[0].name)
local val = ffi_types.double_ref()
sens.sensors_get_value(chip, subfeature[0].number, val)
subfeatures[name] = {
type=LIBSENSORS_SUBFEATURE_TYPES[tonumber(subfeature[0].type)],
value = val[0]
}
end
return subfeatures
end
local function features(chip)
local feature_number = ffi_types.int_ref();
local features = {}
while true do
local feature = sens.sensors_get_features(chip, feature_number)
if feature == nil then
break
end
local name = ffi.string(feature[0].name)
local label_s = sens.sensors_get_label(chip,feature[0])
if label_s ~= nil then
local label = ffi.string(label_s);
ffi.C.free(label_s)
features[name] = {
label = label,
subfeatures = subfeatures(chip, feature)
}
end
end
return features
end
local function chips()
local chip_number = ffi_types.int_ref();
local chips = {}
while true do
local chip = sens.sensors_get_detected_chips(nil, chip_number)
if chip == nil then
break
end
local chipNameBuffer = ffi_types.char_arr(256);
local num = sens.sensors_snprintf_chip_name(chipNameBuffer, 256, chip);
local name = ffi.string(chipNameBuffer, num)
chips[chip_number[0]] = {
name=name,
features = features(chip)
}
end
return chips
end
function LibsensorsDataProvider:end_timespan ()
end
function LibsensorsDataProvider:get_text()
local status, res = pcall(function()
local tbl = self.config.formatter_function(self, chips(), MarkupElement)
assert(tbl and type(tbl) == "table", "The Libsensors data provider formatter function must return a table of elements!")
tbl = remove_nils_from_array(tbl);
for _,v in ipairs(tbl) do
check_class(v, "MarkupElement")
end
return tbl
end)
if not status then
log_error("Libsensors data provider plugin error: formatter function threw and error: " .. res)
return {
MarkupElement.new({
text ="Libsensors data provider plugin error.\nPlease check the log.\n"
})
}
end
return res
end
function LibsensorsDataProvider.new(config)
local self ={}
setmetatable(self, LibsensorsDataProvider)
self.config = config
return self
end
return LibsensorsDataProvider
It worked!! I am so happy! Due to the large amount of hardware available on the market, it is difficult to state that it will work on all computers, correct? Because several friends who use GLXOSD have already asked me what it can be and how I do not understand exactly how the software works, I decided to ask you who is the developer. Thank you my friend.
Thank you very much for this bug report and for helping me diagnose the issue! I will try to push out a new release with the fix tomorrow.
It's hard to test libsensors-reliant software because there doesn't seem to be a way to create fake devices. In other words, to test that it works on some hardware, you have to own the hardware and there isn't any way around that.
The fact that someone actually uses GLXOSD is really heartwarming, because a year ago I was considering scrapping the project altogether. If you have any other issues, please do report them, and I will do my best to find some time to fix them (and don't forget to bother me if I forget about it for a few days ;) )
Hi, I'm a fedora user and I use GLXOSD from compilation but, I can't get to configure sensors view. I have lm_sensors package installed and configured. Any tip?