forked from GPUOpen-Tools/gpu_performance_api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenable_set_device_clock_android.sh
More file actions
97 lines (82 loc) · 2.22 KB
/
Copy pathenable_set_device_clock_android.sh
File metadata and controls
97 lines (82 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
##=============================================================================
## Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
## \author AMD Developer Tools Team
## \file
## \brief Script to change the file permission for device clock setting on Android
##=============================================================================
#
function ShowHelp
{
echo "Usage:"
echo " $0 -t <IP address[:port]>"
echo
echo " -t --target <IP address[:port]>"
echo " IP address and port for the target android device, if port is not specified, adb default port is used"
echo " -h, --help"
echo " Display this help and exit"
}
adb_exists=`adb --version`
if [ $# -eq 0 ]; then
ShowHelp
exit 1
fi
if [ -z "$adb_exists" ]
then
echo "adb not found. Please install adb."
exit 1
fi
while [[ $# -gt 0 ]]; do
option="$1"
case ${option} in
-t|--target)
target="$2"
shift # past argument
shift # past value
;;
-h|--help)
ShowHelp
exit 0
;;
*)
echo "ERROR: Unsupported option ${option}. See Usage"
echo
ShowHelp
exit 1
;;
esac
done
function VerifyTargetInConnectedDevices
{
adb_connected_device_list=`adb devices | grep ${target}`
}
target_connected=0
VerifyTargetInConnectedDevices
if [ -z "${adb_connected_device_list}" ]
then
adb_connect=`adb connect ${target}`
VerifyTargetInConnectedDevices
if [ -z "${adb_connected_device_list}" ]
then
echo "Failed to connect ${target}"
echo $adb_connect
exit 1
else
echo "Successfully connected to ${target}"
target_connected=1
fi
else
echo "$target already connected"
target_connected=1
fi
if [ $target_connected -eq 1 ]
then
# target is connected, change the permission of the file
change_permission=`adb -s $target shell chmod 766 /sys/class/drm/card0/device/power_dpm_force_performance_level`
if [ -z "$change_permission" ]
then
file_permission=`adb -s $target shell ls -l /sys/class/drm/card0/device/power_dpm_force_performance_level`
echo "File permission changed successfully"
echo "$file_permission"
fi
fi