SHARE
TWEET

soctemp/pmutemp 0.0.3

a guest Oct 22nd, 2014 204 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. soctemp() {
  2.         # SoCTempAdjustment is needed because the A20 SoC delivers uncalibrated temp values
  3.         SoCTempAdjustment=1447
  4.  
  5.         # ensure module sunxi-dbgreg.ko is loaded
  6.         grep -q sunxi_dbgreg </proc/modules || ( modprobe sunxi-dbgreg ; sleep 0.1 )
  7.        
  8.         # prepare registers
  9.         echo 'f1c25000:27003f' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
  10.         echo 'f1c25010:40000' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
  11.         echo 'f1c25018:10fff' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
  12.         echo 'f1c25004:10' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
  13.        
  14.         # let the value be written to syslog
  15.         echo 'f1c25020' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/read;
  16.        
  17.         # wait 0.1 seconds
  18.         sleep 0.1
  19.        
  20.         # read return value from syslog and transform it into degrees Celsius
  21.         HexVal=$(tail /var/log/syslog | awk -F" 0x" '/ 0x/ {print $2}' | tail -n1 )
  22.         echo $(( 0x${HexVal} - ${SoCTempAdjustment} )) | awk '{printf ("%0.1f",$1/10); }'
  23. } # soctemp
  24.  
  25. pmutemp() {
  26.         awk '{printf ("%0.1f",$1/1000); }' </sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input
  27. } # pmutemp
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top