gpt4 book ai didi

android - 错误 : You do not have read/write permission to the serial port

转载 作者:行者123 更新时间:2023-11-30 02:43:27 26 4
gpt4 key购买 nike

我有示例应用程序可以从 here 的串口读取.

我已将设备设置为 ttyUSB1(usbserial) 并将波特率设置为 9600

但是当我点击控制台时,我得到了错误:您没有串行端口的读/写权限

我的日志是

  08-22 15:01:25.210: W/System.err(14524): java.io.IOException: Error running exec(). Command:   
[/system/bin/su] Working Directory: null Environment: null
08-22 15:01:25.210: W/System.err(14524): at
java.lang.ProcessManager.exec(ProcessManager.java:211)

08-22 15:01:25.211: W/System.err(14524): at java.lang.Runtime.exec(Runtime.java:168)
08-22 15:01:25.211: W/System.err(14524): at java.lang.Runtime.exec(Runtime.java:241)
08-22 15:01:25.212: W/System.err(14524): at java.lang.Runtime.exec(Runtime.java:184)
08-22 15:01:25.212: W/System.err(14524): at android_serialport_api.SerialPort.<init>
(SerialPort.java:47)
08-22 15:01:25.212: W/System.err(14524): at
android_serialport_api.sample.Application.getSerialPort(Application.java:46)
08-22 15:01:25.213: W/System.err(14524): at
android_serialport_api.sample.SerialPortActivity.onCreate(SerialPortActivity.java:78)
08-22 15:01:25.213: W/System.err(14524): at
android_serialport_api.sample.Sending01010101Activity.onCreate(Sending01010101Activity.java:31)
08-22 15:01:25.214: W/System.err(14524): at
android.app.Activity.performCreate(Activity.java:5020)
08-22 15:01:25.214: W/System.err(14524): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-22 15:01:25.214: W/System.err(14524): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
08-22 15:01:25.214: W/System.err(14524): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
08-22 15:01:25.215: W/System.err(14524): at
android.app.ActivityThread.access$600(ActivityThread.java:149)
08-22 15:01:25.215: W/System.err(14524): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
08-22 15:01:25.215: W/System.err(14524): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-22 15:01:25.216: W/System.err(14524): at android.os.Looper.loop(Looper.java:153)
08-22 15:01:25.216: W/System.err(14524): at
android.app.ActivityThread.main(ActivityThread.java:4987)
08-22 15:01:25.216: W/System.err(14524): at java.lang.reflect.Method.invokeNative(Native
Method)
08-22 15:01:25.216: W/System.err(14524): at java.lang.reflect.Method.invoke(Method.java:511)
08-22 15:01:25.217: W/System.err(14524): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
08-22 15:01:25.217: W/System.err(14524): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
08-22 15:01:25.217: W/System.err(14524): at dalvik.system.NativeStart.main(Native Method)
08-22 15:01:25.217: W/System.err(14524): Caused by: java.io.IOException: No such file or
directory
08-22 15:01:25.218: W/System.err(14524): at java.lang.ProcessManager.exec(Native Method)
08-22 15:01:25.219: W/System.err(14524): at
java.lang.ProcessManager.exec(ProcessManager.java:209)
08-22 15:01:25.219: W/System.err(14524): ... 21 more

我该如何解决这个问题。

请帮忙解决这个问题。

最佳答案

如果您正在使用串行端口应用程序,请转到文件 SerialPort.java

改变行:

su = Runtime.getRuntime().exec("/system/bin/su");

su = Runtime.getRuntime().exec("/system/xbin/su");

关于android - 错误 : You do not have read/write permission to the serial port,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25443779/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com