licheedev / android-serialport-tool Goto Github PK
View Code? Open in Web Editor NEWAndroid串口调试助手
Android串口调试助手
Hello, hope you are fine. I have used this library and it has helped me a lot to achieve my goals and I was able to connect and run commands on device. However my problem is that I also need to read data from the device. I have tried to read data by "inputStream.read(datas)" but my app stucks and dont return any data. Please help me. I ll be very grateful to you. thanks and regards.
private Observable<Object> rxReadData(final byte[] datas) {
return Observable.create(new ObservableOnSubscribe<Object>() {
@Override
public void subscribe(ObservableEmitter<Object> emitter) throws Exception {
try {
int data = readData(datas);
emitter.onNext(new Object());
} catch (Exception e) {
LogPlus.e("发送:" + ByteUtil.bytes2HexStr(datas) + " 失败", e);
if (!emitter.isDisposed()) {
emitter.onError(e);
return;
}
}
emitter.onComplete();
}
});
}
private int readData(byte[] datas) throws Exception {
return inputStream.read(datas);
}
请问一下,同时读取多个串口,该如何操作
If you upgrade your support library versions from 27.0.2 to 28.0..0. this library does not work. It gives error "java.io.FileNotFoundException: /proc/tty/drivers (Permission denied)"
I have given read permission and still this error. Can you look into this issue and update it. thanks and regards.
ext {
compileSdkVersion = 28
minSdkVersion = 18
targetSdkVersion = 28
supportVersion = "28.0.0"
}
Hello
i have some problem about getting received command.
i can send command on the Mainactivity.java by using " SerialPortManager.instance().sendCommand("command" );
but how to get received command on MainActivity.java (i can get on LogFragment but i need to get received command on mainactivity.java too )
Thank you very
请教一下,如果有个个需求,Android的多个串口读设备消息怎么实现呢?
我试过创建多个串口对象,打开不同的path,但是只能收到一个消息。
Hello
I have some question about set multiple device path. i saw the dropdownlist device path on UI but it select only one device path. So if I adjust your code (don't you dropdownlist selection) below
use both two device path name same time
mDevice.setPath("/dev/ttySC0"); // fix device path name in code , don't use dropdownlist selection
mDevice.setPath("/dev/ttySC1");
How can I set multiple device path ? (I have two devices run on same time)
Thank you very much for your kindness
Hey i have a device which only supports baud rate 5787 which is non standard according to linux.
When I pass this baud rate to your driver, it throw log "Unsupported Baud Rate".
Is there any workaround for this?
Hello,i have tried your project (Android-SerialPort-Tool) , Everything is ok but i don't know how to set the Parity (EVEN) Field in your code
Thank you
不支持CP210X系列,希望能整合一下。
Hi there,
Thanks for your great effort.
I managed to get the app running on the Lenovo Tab3 7 tablet with Android version 5.0.1.
I could see the following device list in the dropdown box the first time the app was running,
/dev/ttyGS7
...
/dev/ttyGS0
/dev/ttyMT3
...
/dev/ttyMT0
However it always gave me the error "Failed to open serial port", regardless of which device was selected.
After I restarted the tablet, it always displayed the error message "Unable to find serial port" in the dropdown box.
Attach please find the screen shot for error details.
Would it be possible to use the serial port on Lenovo Tab3 7 at all?
Thanks in advance
Ray
直接编译运行样例程序在真机,无论选哪个端口, 打开串口都提示 打开串口失败,
另外在 manifest 中不需要设置串口权限吗? 没看到设置
在 mDevices = serialPortFinder.getAllDevicesPath(); 取到有好多条
请指教
谢谢
Connect the computer to send the message twice or more before receiving it,And there are duplicates and missing data received,
for example:
FAFB0C10000055AB 1
FAFB0C10000055AB 2
FAFB0C10000055AB 3
receiving : FAFC0C1000012774ADFAFC0C100001DA89ADFAFC0C100001B9EAADFAFC0C1000
Make Project的时候,报错:CreateProcess error=2, 系统找不到指定的文件。
我看了下报错的路径,下面没有bin文件夹。这个如何解决?查资料说,注释:ndk.dir,但还是一样的报错,谢谢。
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:745) Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'D:\android\androidSDK\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip'' at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:220) at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:204) at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:340) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86) at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39) ... 6 more Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'D:\android\androidSDK\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip' at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27) at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22) at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68) ... 7 more Caused by: java.io.IOException: Cannot run program "D:\android\androidSDK\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip" (in directory "D:\android\SerialProtDemo\Android-SerialPort-Tool-master\app"): CreateProcess error=2, 系统找不到指定的文件。 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25) ... 10 more Caused by: java.io.IOException: CreateProcess error=2, 系统找不到指定的文件。 at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 11 more
想请教下关于粘包、拼包的问题,我好多次收到下位机发来的指令信息过长,导致信息截断,无法完整读取,这样的情况下该如何进行处理?
RT
真的很感谢写了这么个提高效率的工具,留个赞赏码吧,大家都能赞赏一下。真心好用
请问这个项目是需要到有root权限的手机上运行吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.