ale*_*ato 7 lubuntu sensors temperature lxpanel
lxpanel 中的温度监视器(我使用的是 Lubuntu 12.10)正在自动检测我的一个传感器,但我想给它一个备用传感器。
这是传感器的输出:
Adapter: Virtual device
temp1: +26.8°C (crit = +100.0°C)
temp2: +0.0°C (crit = +100.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +58.0°C (high = +80.0°C, crit = +90.0°C)
Core 2: +55.0°C (high = +80.0°C, crit = +90.0°C)
Run Code Online (Sandbox Code Playgroud)
看起来温度监视器正在自动拾取 temp1,但我想将其设置为 Core 0 或 Core 2。它有一个表示“传感器”的字符串,但我不确定那是什么。
我试过“Core 0”、“coretemp-isa-0000”和“/sys/devices/platform/coretemp.0/temp2_input”,但似乎都没有工作。
有什么想法吗?
1) 运行此命令以列出可用的 Thermal_zone 设备的类型:
ls -1 /sys/class/thermal/thermal_zone*/type | xargs -I % sh -c "echo % ; cat %"
您应该获得与此类似的输出:
/sys/class/thermal/thermal_zone0/type
acpitz
/sys/class/thermal/thermal_zone1/type
acpitz
/sys/class/thermal/thermal_zone2/type
x86_pkg_temp
Run Code Online (Sandbox Code Playgroud)
2) 找出您需要哪一个,对于CPU,它的类型应该类似于x86_pkg_temp. 在我的示例中,如果我想使用,x86_pkg_temp我会选择/sys/class/thermal/thermal_zone2/.
3)在“温度监视器”设置中指定它,确保它以斜杠结尾(末尾用“/”括起来,就像我的示例中一样):

完成了,现在应该可以按预期工作了。
今天开始使用 LUbuntu 桌面,发现自己也在寻找同样的问题。
在探索并破解开源代码之后,/plugins/thermal/thermal.c我找到了一些解决方案。首先,选项中的参数“Sensor”指的是它的位置,即目录。查看源代码,它可以在自动模式下检测 3 种类型的传感器目录,并在/proc/acpi/thermal_zone/、/sys/class/thermal/和中查找它们/sys/class/hwmon/hwmon[i]/,此处调用函数来查找这些目录:
static void
check_sensors( thermal *th )
{
// FIXME: scan in opposite order
find_sensors(th, PROC_THERMAL_DIRECTORY, NULL, proc_get_temperature, proc_get_critical);
find_sensors(th, SYSFS_THERMAL_DIRECTORY, SYSFS_THERMAL_SUBDIR_PREFIX, sysfs_get_temperature, sysfs_get_critical);
if (th->numsensors == 0)
find_hwmon_sensors(th);
g_info("thermal: Found %d sensors", th->numsensors);
}
Run Code Online (Sandbox Code Playgroud)
现在,看看设置配置时会发生什么,我们看到:
if(th->sensor == NULL) th->auto_sensor = TRUE;
if(th->auto_sensor) check_sensors(th);
else if (strncmp(th->sensor, "/sys/", 5) != 0)
add_sensor(th, th->sensor, th->sensor, proc_get_temperature, proc_get_critical);
else if (strncmp(th->sensor, "/sys/class/hwmon/", 17) != 0)
add_sensor(th, th->sensor, th->sensor, sysfs_get_temperature, sysfs_get_critical);
else
add_sensor(th, th->sensor, th->sensor, hwmon_get_temperature, hwmon_get_critical);
Run Code Online (Sandbox Code Playgroud)
据我了解,th->sensor设置为您在选项的“传感器”输入字段中指定的内容。
首先检查是否auto_sensor已设置,如果未设置,它将执行一系列其他检查。
分解这部分,如果你的传感器路径不包含/sys/在其中,它将使用proc_get函数,这是过时的acpi类型传感器,在新版本的Ubuntu中不使用。否则,如果您的路径包含/sys/class/hwmon它将使用hwmon函数,最后如果它是其他类型/sys/*,它将使用sysfs传感器类型。
基于此,我们可以得出结论,最简单的方法是指定传感器位于/sys/class/thermal/,例如/sys/class/thermal/thermal_zone1。如果我们选择/sys/class/hwmon/,它无论如何都不会选择正确的传感器,因为没有办法指定temp[i]_input要使用的确切值,并且如果我们使用非/sys/目录,它会假设我们使用过时的acpi/thermal_zone,这也不是理想的。您可以创建脚本,在您的主文件夹中创建带有 2 个文件trip_points和temperature.
trip_points看起来像这样,并不重要:
critical (S5): 110 C
passive: 105 C: tc1=2 tc2=10 tsp=100 devices=0xdf72e380
active[0]: 48 C: devices=0xc157fec0
Run Code Online (Sandbox Code Playgroud)
温度将是读取当前温度的温度,应如下所示:
temperature: 49 C
Run Code Online (Sandbox Code Playgroud)
最后,您需要脚本来从您想要使用的实际传感器更新这些文件,并安排它每 N 秒运行一次。该解决方案允许使用/sys/class/hwmon/hwmon1各种传感器并手动读取 LXpanel 热指示器使用的值。您还可以使用此方法使该热指示器显示其他类型的指示器,但这似乎是浪费精力,考虑到您可以使用另一个指示器来代替。如果需要的话,我将使用示例脚本进行更新,以便稍后执行此操作\我将为自己制作一个。
| 归档时间: |
|
| 查看次数: |
4876 次 |
| 最近记录: |