Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add to /etc/zsh/zprofile
- if [ -d /etc/profile.d ]; then
- for i in /etc/profile.d/*.sh; do
- if [ -r $i ]; then
- . $i
- fi
- done
- unset i
- fi
- Add as /etc/profile.d/get-thermal-data.sh
- #/bin/sh
- soctemp() {
- # ensure module sunxi-dbgreg.ko is loaded
- grep -q sunxi_dbgreg </proc/modules || modprobe sunxi-dbgreg
- # prepare registers
- echo 'f1c25000:27003f' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
- echo 'f1c25010:40000' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
- echo 'f1c25018:10fff' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
- echo 'f1c25004:10' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
- # write value to syslog
- echo 'f1c25020' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/read;
- # wait 0.1 seconds
- sleep 0.1
- # read return value from syslog and transform it into degrees Celsius
- HexVal=$(tail /var/log/syslog | awk -F" 0x" '/ 0x/ {print $2}' | tail -n1 | tr '[:lower:]' '[:upper:]')
- RawVal=$(echo "ibase=16; ${HexVal}" | bc)
- echo "scale=1; (${RawVal}-1447)/10" | bc
- } # soctemp
- pmutemp() {
- read RawVal </sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input
- echo "scale=1; (${RawVal}/1000" | bc
- } # pmutemp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement