alix-temperature 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # temperature.sh
  3. # this tool reads the lm86 from pcengines alix mainboards.
  4. # http://pcengines.ch/alix.htm
  5. # tested only on alix2d13 but should work on the other
  6. # alix2dxx and alix3dxx boards too.
  7. #
  8. # Copyright (C) 2011 Tobias Breckle <tobias.breckle@stz-bt.de>
  9. #
  10. # This program is free software: you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation, either version 3 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. CMD="i2cget -y 0 0x4c"
  23. TEMP_LOCAL=`$CMD 0x00`
  24. TEMP_REMOTE_HIGH=`$CMD 0x01`
  25. TEMP_REMOTE_LOW=`$CMD 0x10`
  26. let "TEMP_REMOTE_LOW >>= 5"
  27. let "TEMP_REMOTE_LOW = TEMP_REMOTE_LOW * 125"
  28. if [ "$1" = "local" ]
  29. then
  30. printf "Local:\t%d\n" $TEMP_LOCAL
  31. elif [ "$1" = "remote" ]
  32. then
  33. printf "Remote:\t%d,%d\n" $TEMP_REMOTE_HIGH $TEMP_REMOTE_LOW
  34. elif [ -z "$1" ]
  35. then
  36. printf "Local:\t%d\n" $TEMP_LOCAL
  37. printf "Remote:\t%d,%d\n" $TEMP_REMOTE_HIGH $TEMP_REMOTE_LOW
  38. fi