diff --git a/drivers/thermal/thermal_procfs.c b/drivers/thermal/thermal_procfs.c index 849547af32..ff5f03f5e3 100644 --- a/drivers/thermal/thermal_procfs.c +++ b/drivers/thermal/thermal_procfs.c @@ -146,15 +146,26 @@ static ssize_t thermal_procfs_read(FAR struct file *filep, { ins->cdev->ops->get_state(ins->cdev, ¤t); 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->temperature, ins->trip, ins->upper, ins->lower, - ins->cdev->name, - current, - ins->target); + ins->cdev->name); + + 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)