简体   繁体   English

如何在基于Android的自定义开发板上进行root或GPIO访问

[英]How to root or GPIO access on custom android-based development board

I have this development board Open-Q 820 我有这个开发板Open-Q 820

It is running an Android 7.0 based on some sources from CodeAurora (that seem based on AOSP sources). 它基于CodeAurora的某些来源(似乎基于AOSP来源)运行Android 7.0。 Seems it uses proprietary bootloader that can not be changed. 似乎它使用无法更改的专有引导加载程序。 I need to access GPIO (/system/class/gpio) from my android app to control an external device. 我需要从android应用访问GPIO(/ system / class / gpio)来控制外部设备。 Problem is I can not do this from android app - seems only root can access this files. 问题是我无法从android应用程序执行此操作-似乎只有root才能访问此文件。 I can call "adb root" command from PC and then call from "adb shell" something like 我可以从PC调用“ adb root”命令,然后从“ adb shell”调用类似

echo 0 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio0/direction
echo 1 > /sys/class/gpio/gpio0/value

and it is working. 它正在工作。 But I need to do the same from my android app. 但是我需要从我的Android应用程序中执行相同的操作。 I know how to access terminal and su from android app. 我知道如何从android应用访问终端和su。 I just dont know how to root custom device. 我只是不知道如何植根自定义设备。 I tried to install SuperSU.apk app and its corresponding su native app manually. 我尝试手动安装SuperSU.apk应用程序及其对应的su本机应用程序。 It starts and says it need to update su binaries. 它启动并说需要更新su二进制文件。 After installing binaries and reboot the system then it becomes broken - infinite android logo. 安装二进制文件并重新启动系统后,它将损坏-无限的android徽标。 If I not install binaries update then SuperSU can grant permissions to my app but actully app still can not use su (I dont know why - I use this library inside my app: https://github.com/Chrisplus/RootManager ). 如果我未安装二进制文件更新,则SuperSU可以向我的应用授予权限,但是actully应用仍然无法使用su(我不知道为什么-我在我的应用中使用此库: https : //github.com/Chrisplus/RootManager )。 And after reboot SuperSU not working longer. 重启后,SuperSU无法正常工作。 So may be you know some SuperSU alternatives (Knigroot not working too) or steps how to correctly install some superuser management app. 因此,您可能知道某些SuperSU替代品(Knigroot也无法使用)或采取步骤正确安装某些超级用户管理应用程序。 Or may be I can use su directly (I tried but my app has not rights to access /system/xbin/su). 或者也许我可以直接使用su(我尝试过但我的应用无权访问/ system / xbin / su)。 Or may be I can make /sys/class/gpio accessible by android apps somehow (I tried chmod 777 on it - not works). 或者也许我可以通过某种方式使android应用程序可以访问/ sys / class / gpio(我在上面尝试了chmod 777-不起作用)。 May be some SElinux rights, but I have no experience with this. 可能是SElinux的一些权利,但是我对此没有经验。

Thank you 谢谢

Magisk helped me. 马吉斯克帮助了我。 Since it is have option to patch custom boot image. 由于它具有修补自定义启动映像的选项。 I used this option and now root access works. 我使用了此选项,现在可以进行root访问了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从基于Android的sqlite数据库中选择数据 - how to select data from android-based sqlite database 通过无线在基于Android的设备上开发 - Developing on android-based device via wireless 如何以编程方式为TextView甚至TableRow为基于Android的应用程序添加边距? - how do i add margin programmatically for TextView or even TableRow for android-based app? 如何设置数据库中的数据列表以在基于Android的应用程序中随机显示? - how to set list of data from database to display randomly at a android-based app? 如何使用GPIO唤醒Android嵌入式主板暂停 - How to wake up an Android Embedded Board from Suspend by using a GPIO 在嵌入式Android设备上使用Google OAuth 2 - Using Google OAuth 2 on embedded Android-based device 使用基于Android的信息亭作为脱机浏览器(以避免带宽问题) - Using an Android-based kiosk as an offline browser (to avoid bandwidth issues) 文本在基于Android的应用程序的ListView中被删减 - Text got cut of within the ListView for android-based app 在基于Android的手机中更新电池信息的时间间隔 - Time interval to update battery infomation in Android-based phone 可以在Samsung Gear S上运行基于Android的应用程序吗? - Can An Android-based app be run on Samsung Gear S?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM