JIN
JIN

Reputation: 163

adb shell su -c command throws Permission Denied (My phone is rooted)

First of all, I'm experimenting a DVFS with my rooted phone, Galaxy A12. Nevertheless, if I use a command inside of adb shell then it does not throw a Permission Denied.

~$ adb shell
a12:/ $ su
a12:/ # echo 500000 > sys/kernel/gpu/gpu_max_clock
a12:/ #

However, when I use this command outside of android kernel with adb shell su -c, it throws a Permission denied

~$ adb shell su -c "echo 680000 > sys/kernel/gpu/gpu_max_clock"
/system/bin/sh: can't create sys/kernel/gpu/gpu_max_clock: Permission denied

I've tried some commands like the below, however the commands threw the same thing.

adb shell su -c "chmod 755 sys/kernel/gpu/gpu_max_clock && echo 680000 > sys/kernel/gpu/gpu_max_clock"
adb shell su -c "chmod 777 sys/kernel/gpu/gpu_max_clock && echo 680000 > sys/kernel/gpu/gpu_max_clock"

How can I handle this situation?

Upvotes: 3

Views: 2094

Answers (2)

H. KIM
H. KIM

Reputation: 19

Your command line is wrong. Try this.

adb shell "su -c 'echo 680000 > /sys/kernel/gpu/gpu_max_clock'"

or

adb shell "su -c 'chmod 777 /sys/kernel/gpu/gpu_max_clock && echo 680000 > /sys/kernel/gpu/gpu_max_clock'"

Upvotes: 0

Martin Zeitler
Martin Zeitler

Reputation: 76639

A shell terminal does not throw any exceptions and your command line is wrong - the path, too:

adb shell "su -c 'echo 680000 > /sys/kernel/gpu/gpu_max_clock'"

You might end up with a defect GPU, when not having the slightest clue of what you're doing. Better research the max values first - when it goes up in smoke, this is your own fault, not mine.

Any sane person would probably read the original clock speed first:

cat /sys/kernel/gpu/gpu_max_clock

Only then one can see, how many percent of the original clock speed 680000 would even be. When giving to much, this will lead to overheating and random crashes... unless also reducing the voltage. This is by far not as easy as you may think it is ...and there is no active cooling available, either.

Upvotes: 1

Related Questions