hrx

radeon-power_profile

hrx
Jan 26th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. EXEC_NAME=`basename $0`;
  4.  
  5. TARGET="/sys/class/drm/card0/device/power_profile"
  6. CURRENT_PROFILE=`cat ${TARGET}`
  7.  
  8. append_profile() {
  9.         local PROFILE=$1
  10.         echo -n "  ${PROFILE}"
  11.         if [ "x${CURRENT_PROFILE}x" == "x${PROFILE}x" ]; then
  12.                 echo -n " (current)"
  13.         fi
  14.         echo
  15. }
  16.  
  17. if [ $# != 1 ]; then
  18.         echo "usage: ${EXEC_NAME} <profile>"
  19.         echo
  20.         echo "Valid profiles:"
  21.         for AVAILABLE_PROFILE in low high default auto; do
  22.                 append_profile ${AVAILABLE_PROFILE}
  23.         done
  24.         exit 0
  25. fi
  26.  
  27. PROFILE="$1"
  28.  
  29. if [ "x${PROFILE}x" == "xlowx" ] || [ "x${PROFILE}x" == "xhighx" ] || [ "x${PROFILE}x" == "xautox" ] || [ "x${PROFILE}x" == "xdefaultx" ]; then
  30.         echo "${PROFILE}" > ${TARGET}
  31. else
  32.         logger "[${EXEC_NAME}] WARN: Invalid power_profile '${PROFILE}'"
  33.         exit 1
  34. fi
  35.  
  36. exit 0
Advertisement
Add Comment
Please, Sign In to add comment