This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 88cc4b11208541d7bc489db5103cd6a59ad60a4a
Author: wangjianyu3 <[email protected]>
AuthorDate: Fri Dec 15 20:14:05 2023 +0800

    Thermal/procfs: Disabled immediately after enabling.
    
    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]>
---
 drivers/thermal/thermal_procfs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_procfs.c b/drivers/thermal/thermal_procfs.c
index 67b018584d..b3dbcbb7f1 100644
--- a/drivers/thermal/thermal_procfs.c
+++ b/drivers/thermal/thermal_procfs.c
@@ -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;
 }
 

Reply via email to