Skip to content

Commit

Permalink
Thermal/procfs: Disabled immediately after enabling.
Browse files Browse the repository at this point in the history
When exec "echo 1 > /proc/thermal/cpu-thermal", procfs get "\n" after "1", treat as disable:
```
 #1  0x000000000040f452 in thermal_procfs_write (filep=0x7ffff3d241e8, buffer=0x7ffff3d344fc "\n", buflen=1) at thermal/thermal_procfs.c:179
```

Signed-off-by: wangjianyu3 <[email protected]>
  • Loading branch information
JianyuWang0623 authored and xiaoxiang781216 committed Sep 23, 2024
1 parent d5ffed6 commit 88cc4b1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/thermal/thermal_procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ static ssize_t thermal_procfs_write(FAR struct file *filep,
{
FAR struct thermal_procfs_s *p = filep->f_priv;

thermal_zone_enable(p->zdev, atoi(buffer) ? true : false);
if (!strncmp(buffer, "1", 1))
{
thermal_zone_enable(p->zdev, true);
}
else if (!strncmp(buffer, "0", 1))
{
thermal_zone_enable(p->zdev, false);
}

return buflen;
}

Expand Down

0 comments on commit 88cc4b1

Please sign in to comment.