aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLisa Nguyen <lisa.nguyen@linaro.org>2016-07-25 21:46:51 -0700
committerLisa Nguyen <lisa.nguyen@linaro.org>2016-09-12 16:42:01 -0700
commitc190ca5a4842a5e7428f49e71a936879cf38f35e (patch)
tree2882b14be9f862271d02537d548e8f4dd99f7bd1
parent002f481f06b8aaa9b0cffdd56dea94f0b47978cd (diff)
thermal: Get correct PID for heat_cpu based on OS
When running the ps command, Android lists the pids in the second column whereas Ubuntu lists the pids in the first column. Check the os first before extracting the pid. Signed-off-by: Lisa Nguyen <lisa.nguyen@linaro.org>
-rwxr-xr-xthermal/thermal_03.sh8
-rwxr-xr-xthermal/thermal_06.sh7
2 files changed, 13 insertions, 2 deletions
diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh
index 69ffa1b..790c9c3 100755
--- a/thermal/thermal_03.sh
+++ b/thermal/thermal_03.sh
@@ -44,7 +44,13 @@ check_temperature_change() {
init_temp=$(cat $dirpath/temp)
$CPU_HEAT_BIN &
- cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
+
+ get_os
+ if [ $? -eq 1 ]; then
+ cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
+ else
+ cpu_pid=$(ps | grep heat_cpu| awk '{print $2}')
+ fi
test -z $cpu_pid && cpu_pid=0
check "start cpu heat binary" "test $cpu_pid -ne 0"
test $cpu_pid -eq 0 && return
diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh
index 5e699e5..d8bcd23 100755
--- a/thermal/thermal_06.sh
+++ b/thermal/thermal_06.sh
@@ -50,7 +50,12 @@ check_trip_point_change() {
trip_type=0
trip_type_path=0
$CPU_HEAT_BIN &
- cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
+ if [ $? -eq 1 ]; then
+ cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
+ else
+ cpu_pid=$(ps | grep heat_cpu| awk '{print $2}')
+ fi
+
test -z $cpu_pid && cpu_pid=0
check "start cpu heat binary" "test $cpu_pid -ne 0"
test $cpu_pid -eq 0 && return