adb shell su -c command 报错“Permission Denied”(我的手机已经root了)

3

首先,我正在使用我的已root的手机Galaxy A12进行动态电压频率调节(DVFS)实验。然而,如果我在adb shell中使用命令,则不会出现Permission Denied错误。

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

然而,当我在 Android 内核以外使用这个命令并带上 adb shell su -c 时,它会抛出一个 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

我尝试了一些像下面这样的命令,但是命令会抛出相同的东西。

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"

我该如何处理这种情况?

2个回答

1

一个 shell 终端不会抛出任何异常,你的命令行是错误的 - 路径也是如此:

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

当你没有任何头绪时,可能会得到一个有缺陷的GPU。最好先研究最大值 - 如果它冒烟了,这是你自己的问题,而不是我的问题。 任何理智的人都可能首先阅读原始时钟速度:
cat /sys/kernel/gpu/gpu_max_clock

只有这样,才能看到原始时钟速度 680000 的百分之多少会被实现。如果过度提高时钟速度,这将导致过热和随机崩溃...除非同时降低电压。这绝不像你想象的那么容易...而且也没有主动冷却可用。


我看了你的回答,所以我想起了一个可行的答案。在此之前,你的答案并不完全有效。顺便说一下,可行的解决方案是 adb shell "su -c 'echo 680000 > /sys/kernel/gpu/gpu_max_clock'"。感谢您的智慧! - JIN

0

你的命令行错误。请尝试这个。

adb shell "su -c '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'"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接