Communicating with serial USB device over Android

隐身守侯 提交于 2019-11-26 10:35:41

问题


I have one custom made device for measuring current. This device can be connected to PC and communication is done over USB. It is based on FTDI chip. I have application written in Java and that application is using rxtxSerial.dll library and gnu.io.rxtx_2.1.7.4.jar. Now I want to port this application on my android device and I\'m litte bit confused what to do that? All I have is android tablet (os version 4.1.1), OTG cable and this measuring device.

Should my device be rooted? Is there any kind of library that I can simply add to my Java Android application and read data over USB? Where to start?

I have tried to port existing application for PC using same library, but rxtxSerial.dll is missing and I can\'t transfer it to my android device.


回答1:


I can really recommend the USB-Serial-For-Android library, it supports multiple popular usb-to-serial chips (also FTDI) and there is no rooting required. Check out the GitHub project here.




回答2:


There is a project dedicated to serial communication on Android. android-serialport-api. I think, it is a good resource to start with.

FTDI also provides Android related resources.




回答3:


I think there's currently only one properly maintained library for serial USB communication and it's felHR85/UsbSerial. It supports several USB chips including FTDI (see Devices Supported).

Unfortunately mik3y/usb-serial-for-android seems to be dead.

And no, you don't need to root your device for connecting to and communicating with a USB device.

EDIT: We have a maintained fork of mik3y's library. See kai-morich/usb-serial-for-android

EDIT2: It seems that all of these libraries are maintained again, mik3y joined forces with kai-morich and they are working together.



来源:https://stackoverflow.com/questions/21800932/communicating-with-serial-usb-device-over-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!