adb 控制 G1 键盘 LED,终端仿真器不能控制?
目前,照亮 G1 (HTC Dream) 键盘的 LED 很快就会关闭,我将其计时为六秒。在黑暗中使用手机时这是一件痛苦的事情,因为即使您目光移开很短的时间,您也必须按下按钮才能重新打开灯。
由于我的 G1 已获得 root 权限,因此我可以访问系统文件,并且当使用 adb 打开 USB 连接手机的 shell (adb shell
) 时,我可以使用
echo 1 > /sys/class/leds/keyboard-backlight/brightness
以下命令 将亮度文件设置为正值:打开键盘,直到屏幕设置为关闭(在我的手机上为两分钟)。
当我使用终端模拟器尝试相同的操作或编写一个应该执行相同操作的简单应用程序时,尽管两者都具有 root 访问权限,但它什么也没做。这是为什么呢?
At the moment the LEDs that light up the keyboard of the G1 (HTC Dream) are very quick to turn off, I time it at six seconds. This is a pain when using the phone in the dark as you must press a button in order to turn the lights back on if you look away even for a very short time.
Since my G1 is rooted I have access to the system files and when using adb to open a shell (adb shell
) to the USB connected phone I can set the brightness file to a positive value using
echo 1 > /sys/class/leds/keyboard-backlight/brightness
This keeps the keyboard on, until the screen is set to turn off (two minutes on my phone).
When I attempt the same using a Terminal Emulator or writing a simple app which should execute the same it does nothing despite both having root access. Why is this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
即使您的手机已获得 root 权限,应用程序仍会默认在其自己的非 root 用户 ID 下运行。
您需要为您的应用请求根访问权限。在终端中,这是通过输入
su
命令和 这个问题的答案向您展示了如何在您的应用中执行此操作。Even though your phone is rooted applications will still run by default under their own non-root user IDs.
You'll need to request root access for your app. In the Terminal this is done by entering the
su
command and an answer to this question shows you how to do it in your app.