android-serialport-api and libusb for android

时间:2023-12-12 16:48:02

libusb for android:

Even if you get it compiled, Android is probably not going to let you access the USB device through libusb unless your device is rooted. If it is feasible to port your app to Android's native USB stack, that would almost certainly be a more stable solution.

http://*.com/questions/15957509/compile-and-link-against-libusb-for-android

http://*.com/questions/6163856/usb-device-attached-intent-not-firing/8328814#8328814

        Example:    <usb-device vendor-id="0BDA" product-id="8187"/>   IS  WRONG;           <usb-device vendor-id="3034" product-id="33159"/>   IS RIGHT!

http://*.com/questions/11638216/how-to-make-an-basic-android-usb-host-application

libusb for android:   https://github.com/libusb/libusb/blob/master/android/README,       https://github.com/OpenNI/OpenNI2/tree/master/ThirdParty/PSCommon/XnLib/ThirdParty/libusb-1.0.9-Android

另外,有一个叫usb4java的开源项目,它包含有怎么使用的example,可以作为学习怎么使用libusb,地址如下:

http://usb4java.org/index.html

https://github.com/usb4java/

https://github.com/usb4java/libusb4java

https://github.com/usb4java/usb4java

https://github.com/usb4java/usb4java-javax-examples

https://github.com/usb4java/usb4java-examples

android-serialport-api:

https://code.google.com/p/android-serialport-api/

https://github.com/cepr/android-serialport-api

源码也可见我自己的云盘。

The current Android SDK does not provide any API for reading and writing to the Linux TTY serial ports. You may find such serial ports on the connector of HTC Android phones.

This project wants to provide a simple API to connect, read and write data through theses serial ports.

The supported features are:

  • listing the available serial ports on the device, including USB to serial adapters
  • configuring a serial ports (baudrate, stop bits, permission, ...)
  • providing standard InputStream and OutputStream Java interfaces

What is NOT possible with this project:

  • receiving/sending data through an USB slave interface

Please have a look on the Wiki for more information. You may also find relevant information in users comments.

An application sample is available for download in Downloads section, and also on Android Market.