mirror of
https://codeberg.org/icewind/palantir.git
synced 2026-06-03 10:14:09 +02:00
rk3588 temperature
This commit is contained in:
parent
b0545a6d4e
commit
318af5a187
2 changed files with 14 additions and 4 deletions
|
|
@ -70,7 +70,8 @@ impl Device {
|
||||||
|
|
||||||
pub fn sensors(&self) -> impl Iterator<Item = io::Result<Sensor>> {
|
pub fn sensors(&self) -> impl Iterator<Item = io::Result<Sensor>> {
|
||||||
// determine early to avoid borrowing &self in iterator
|
// determine early to avoid borrowing &self in iterator
|
||||||
let is_cpu_thermal = self.name == "cpu_thermal";
|
let is_cpu_thermal = self.name == "cpu_thermal" || self.name == "soc_thermal";
|
||||||
|
let is_gpu_thermal = self.name == "gpu_thermal";
|
||||||
|
|
||||||
let sensors = read_dir(&self.base_path).into_iter().flatten();
|
let sensors = read_dir(&self.base_path).into_iter().flatten();
|
||||||
sensors
|
sensors
|
||||||
|
|
@ -91,13 +92,19 @@ impl Device {
|
||||||
|
|
||||||
let input_name = path.file_name().unwrap().to_str().unwrap();
|
let input_name = path.file_name().unwrap().to_str().unwrap();
|
||||||
|
|
||||||
// rpi cpu_thermal doesn't have labels, so we hardcode one
|
// rpi/rk3588 cpu_thermal doesn't have labels, so we hardcode one
|
||||||
if is_cpu_thermal && input_name == "temp1_input" {
|
if is_cpu_thermal && input_name == "temp1_input" {
|
||||||
return Ok(Sensor {
|
return Ok(Sensor {
|
||||||
input_path: path,
|
input_path: path,
|
||||||
name: "Tdie".into(),
|
name: "Tdie".into(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if is_gpu_thermal && input_name == "temp1_input" {
|
||||||
|
return Ok(Sensor {
|
||||||
|
input_path: path,
|
||||||
|
name: "edge".into(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let base_name = input_name.trim_end_matches("_input");
|
let base_name = input_name.trim_end_matches("_input");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ impl TemperatureSource {
|
||||||
let mut gpu_sensors = Vec::new();
|
let mut gpu_sensors = Vec::new();
|
||||||
|
|
||||||
for device in Device::list().flatten() {
|
for device in Device::list().flatten() {
|
||||||
if device.name() == "k10temp" || device.name() == "coretemp" {
|
if device.name() == "k10temp"
|
||||||
|
|| device.name() == "coretemp"
|
||||||
|
|| device.name() == "soc_thermal"
|
||||||
|
{
|
||||||
for sensor in device.sensors().flatten() {
|
for sensor in device.sensors().flatten() {
|
||||||
if sensor.name() == "Tdie" || sensor.name().starts_with("Core ") {
|
if sensor.name() == "Tdie" || sensor.name().starts_with("Core ") {
|
||||||
cpu_sensors.push(sensor.reader()?);
|
cpu_sensors.push(sensor.reader()?);
|
||||||
|
|
@ -25,7 +28,7 @@ impl TemperatureSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if device.name() == "amdgpu" {
|
if device.name() == "amdgpu" || device.name() == "gpu_thermal" {
|
||||||
for sensor in device.sensors().flatten() {
|
for sensor in device.sensors().flatten() {
|
||||||
if sensor.name() == "edge" {
|
if sensor.name() == "edge" {
|
||||||
gpu_sensors.push(sensor.reader()?);
|
gpu_sensors.push(sensor.reader()?);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue