Thermal/procfs: Do not print invalid target cooling state directly
Diff - z:cpu-thermal t:48 t:1 h:16 l:0 c:fan0 s:0|4294967295 + z:cpu-thermal t:48 t:1 h:16 l:0 c:fan0 s:0|(invalid) The invalid value 4294967295(THERMAL_NO_TARGET, defined as UINT_MAX(0xffffffff)) may bother users. Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
e06ff62063
commit
975eddaac5
1 changed files with 15 additions and 4 deletions
|
@ -146,15 +146,26 @@ static ssize_t thermal_procfs_read(FAR struct file *filep,
|
||||||
{
|
{
|
||||||
ins->cdev->ops->get_state(ins->cdev, ¤t);
|
ins->cdev->ops->get_state(ins->cdev, ¤t);
|
||||||
procfs_sprintf(buffer, buflen, &offset,
|
procfs_sprintf(buffer, buflen, &offset,
|
||||||
"z:%s t:%d t:%d h:%u l:%u c:%s s:%u|%u\n",
|
"z:%s t:%d t:%d h:%u l:%u c:%s ",
|
||||||
ins->zdev->name,
|
ins->zdev->name,
|
||||||
ins->zdev->temperature,
|
ins->zdev->temperature,
|
||||||
ins->trip,
|
ins->trip,
|
||||||
ins->upper,
|
ins->upper,
|
||||||
ins->lower,
|
ins->lower,
|
||||||
ins->cdev->name,
|
ins->cdev->name);
|
||||||
current,
|
|
||||||
ins->target);
|
if (ins->target == THERMAL_NO_TARGET)
|
||||||
|
{
|
||||||
|
procfs_sprintf(buffer, buflen, &offset, "s:%u|%s",
|
||||||
|
current, "(invalid)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
procfs_sprintf(buffer, buflen, &offset, "s:%u|%u",
|
||||||
|
current, ins->target);
|
||||||
|
}
|
||||||
|
|
||||||
|
procfs_sprintf(buffer, buflen, &offset, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
|
|
Loading…
Reference in a new issue