Patch to add support for Raspberry Pi CPU Temp

Bug #1587139 reported by ironstorm
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
byobu
Fix Released
Wishlist
Unassigned

Bug Description

Raspberry Pi has a cpu temperature value available at /sys/class/thermal/thermal_zone0/temp, the value must be divided by 1000 for the temperature in celsius.

Tested on a Raspberry Pi 3, but sys class value dates back to 2013 (Raspberry Pi 1) and should run on all RPis.

The attached patch adds this value to /usr/lib/byobu/cpu_temp... (also attached as a file)

--- /usr/lib/byobu/cpu_temp 2016-05-30 12:24:12.267170477 -0400
+++ /usr/lib/byobu/cpu_temp 2016-05-30 12:25:59.836096951 -0400
@@ -21,7 +21,7 @@

 __cpu_temp_detail() {
        local i
- for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature; do
+ for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
                [ -r "$i" ] || continue
                printf "%s\n" "$i:"
                cat "$i"/*
@@ -30,9 +30,9 @@

 __cpu_temp() {
        local i t unit
- for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature; do
+ for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
                case "$i" in
- *temp*_input)
+ *temp*_input|*thermal_zone*/temp)
                                [ -s "$i" ] && read t < "$i" && t=$(($t/1000))
                        ;;
                        *)

Related branches

Revision history for this message
ironstorm (ironstorm-gmail) wrote :
Changed in byobu:
importance: Undecided → Wishlist
status: New → In Progress
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

bzr commit -m '* usr/lib/byobu/cpu_temp: LP: #1587139
  - add cpu temp support for rpi1, rpi2, and rpi3' --fixes 'lp:1587139'
Committing to: /srv/media/src/byobu/byobu/
modified debian/changelog
modified usr/lib/byobu/cpu_temp
Committed revision 2515.

Changed in byobu:
status: In Progress → Fix Committed
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

This is fantastic!

Tested and working on rpi1 and rpi2 here :-)

Changed in byobu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.