mik3y/usb-serial-for-android — dự án mã nguồn mở — đang có 5.7k sao GitHub. Android USB host serial driver library for CDC, FTDI, Arduino and other devices.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
This is a driver library for communication with Arduinos and other USB serial hardware on
Android, using the
Android USB Host Mode (OTG)
available since Android 3.1 and working reliably since Android 4.2.
No root access, ADK, or special kernel drivers are required; all drivers are implemented in
Java. You get a raw serial port with read(), write(), and other functions for use with your own protocols.
Quick Start
1. Add library to your project:
Add jitpack.io repository to your root build.gradle:
2. If the app should be notified when a device is attached, add
device_filter.xml
to your project's res/xml/ directory and configure in your AndroidManifest.xml.
// Find all available drivers from attached devices.
UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
List<UsbSerialDriver> availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager);
if (availableDrivers.isEmpty()) {
return;
}
// Open a connection to the first available driver.
UsbSerialDriver driver = availableDrivers.get(0);
UsbDeviceConnection connection = manager.openDevice(driver.getDevice());
if (connection == null) {
// add UsbManager.requestPermission(driver.getDevice(), ..) handling here
return;
}
UsbSerialPort port = driver.getPorts().get(0); // Most devices have just one port (port 0)
port.open(connection);
port.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE);
then use direct read/write
port.write(request, WRITE_WAIT_MILLIS);
len = port.read(response, READ_WAIT_MILLIS);
For a simple example, see
UsbSerialExamples
folder in this project.
See separate github project SimpleUsbTerminal
for a more complete example with:
Background service to stay connected while the app is not visible or rotating
Flow control
Probing for Unrecognized Devices
Sometimes you may need to do a little extra work to support devices which
usb-serial-for-android doesn't (yet) know about -- but which you know to be
compatible with one of the built-in drivers. This may be the case for a brand
new device or for one using a custom VID/PID pair.
UsbSerialProber is a class to help you find and instantiate compatible
UsbSerialDrivers from the tree of connected UsbDevices. Normally, you will use
the default prober returned by UsbSerialProber.getDefaultProber(), which
uses USB interface types and the built-in list of well-known VIDs and PIDs that
are supported by our drivers.
To use your own set of rules, create and use a custom prober:
// Probe for our custom FTDI device, which use VID 0x1234 and PID 0x0001 and 0x0002.
ProbeTable customTable = new ProbeTable();
customTable.addProduct(0x1234, 0x0001, FtdiSerialDriver.class);
customTable.addProduct(0x1234, 0x0002, FtdiSerialDriver.class);
UsbSerialProber prober = new UsbSerialProber(customTable);
List<UsbSerialDriver> drivers = prober.findAllDrivers(usbManager);
// ...
Note: as of v3.5.0 this library detects CDC/ACM devices by USB interface types instead of fixed VID+PID,
so custom probers are typically not required any more for CDC/ACM devices.
Of course, nothing requires you to use UsbSerialProber at all: you can
instantiate driver classes directly if you know what you're doing; just supply
a compatible UsbDevice.
Compatible Devices
This library supports USB to serial converter chips with specific drivers
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/mik3y/usb-serial-for-android là nguồn chính thức.
mik3y/usb-serial-for-android có phải mã nguồn mở không?
Có — mik3y/usb-serial-for-android phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/mik3y/usb-serial-for-android.
mik3y/usb-serial-for-android có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho mik3y/usb-serial-for-android. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
mik3y/usb-serial-for-android có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho mik3y/usb-serial-for-android. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
mik3y/usb-serial-for-android còn đang phát triển không?
Commit gần nhất trên mik3y/usb-serial-for-android là 10 ngày trước (theo timestamp GitHub). Repo có 1.7k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
mik3y/usb-serial-for-android dùng license gì?
mik3y/usb-serial-for-android phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc usb-serial-for-android có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về usb-serial-for-android.