Root权限配置UART1在Beaglebone [英] Root permission to configure UART1 in Beaglebone

查看:418
本文介绍了Root权限配置UART1在Beaglebone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的是黑色Beaglebone,它运行在Android上,在一个项目我工作。我需要使用UART1。据我了解,我必须配置UART1的模式。它必须是MODE0。我可以通过ADB做到wtih这些命令:

I use a Beaglebone black, which runs on Android, in a project I work. I need to use UART1. As i understand i have to configure the MODE of UART1. It must be MODE0. I can do it via adb wtih these command:

20回声> / SYS /内核/调试/ omap_mux / uart1_rxd

echo 20 > /sys/kernel/debug/omap_mux/uart1_rxd

呼应0> / SYS /内核/调试/ omap_mux / uart1_txd

echo 0 > /sys/kernel/debug/omap_mux/uart1_txd

一切工作正常这样。但真正的问题是,我必须做的应用程序中这个配置,我编码。但我没有权限来执行这些shell命令,怎么一回事,因为我不是扎根。所以:

Everything works fine like that. But real problem is, I have to do this configuration inside the application, i am coding. But I don't have permission to execute these shell command, beacuse I'm not rooted. So:

1)如何可以根我beaglebone黑色执行这些shell命令?

1) How can I root my beaglebone black to execute these shell commands?

2)还是有办法给写权限这些文件?我可以通过亚行执行搭配chmod 777 / SYS /内核/调试/ omap_mux / uart1_rxd,并有我的应用程序里面写权限。但是,当然,它不是一个解决方案,因为当beaglebone重新启动的权限都将丢失。

2) Or is there a way to give permission to write these files? I can execute chmod 777 /sys/kernel/debug/omap_mux/uart1_rxd via adb and have write permission inside my app. But of course it isn't a solution, because when beaglebone restarts the permissions are lost.

只需我想使用UART1(或任何其它UART)串行通信。但是,所有shell命令必须我的应用程序里面执行。我该怎么做?

Simply I want to use UART1 (or any other UART) for serial communication. But all shell commands must be executed inside my app. How can i do that?

索里,我的英语。

和提前感谢

推荐答案

我找到了解决办法。我张贴的人谁可能需要它。

I found the solution. I'm posting it for anyone who might need it.

1)安装SD卡,其中有Android的形象,你的PC

1) Mount SD card, which have Android image, to your PC

2)打开控制台,安装根文件系统的分区

2) Open console and mount rootfs partition

3)打开init.rc纳米命令

3) open init.rc with nano command

nano init.rc

4)有shell命令,它在引导部分运行。添加以下shell命令到您选择的地方:

4) There are shell commands, which run in boot section. Add following shell commands to somewhere of your choice:

chmod 0666 /sys/kernel/debug/omap_mux/uart1_rxd
write 20 /sys/kernel/debug/omap_mux/uart1_rxd 20
chmod 0666 /sys/kernel/debug/omap_mux/uart1_txd
write 0 /sys/kernel/debug/omap_mux/uart1_txd 0

5)保存文件,并使用SD卡引导Beaglebone。

5) Save file and boot your Beaglebone with the SD card.

现在你必须要permision读/写/ SYS /内核/调试/ omap_mux / uart1_txd和/ SYS /内核/调试/ omap_mux / uart1_rxd。而他们的模式设置为MODE0。

Now you have permision to read/write to /sys/kernel/debug/omap_mux/uart1_txd and /sys/kernel/debug/omap_mux/uart1_rxd. And their modes are set to MODE0.

这篇关于Root权限配置UART1在Beaglebone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆