Serial ports for Tauri 2 apps

Desktop COM/tty ports, USB-serial adapters on Android, and serial over TCP or Bluetooth LE — including on iOS.

What you get

  • One API everywhere
    Open, stream with watch(), read/write, line settings, modem lines, hotplug, auto-reconnect.
  • Modems built in
    A native AT command queue with structured results, URCs, SMS (PDU) and GSM 07.10 / 27.010 CMUX.
  • Android without Java libraries
    USB-serial drivers in Rust (FTDI, CP210x, PL2303, CH34x, CDC-ACM, …).
  • Network and radio transports
    tcp://host:port to a serial bridge, ble://<id> to Nordic UART devices.
  • Rust backend
    The same operations from your Tauri backend through the managed SerialPort state.
  • Generated reference
    Every method, type, Tauri command and permission, built from the sources on each release.

Open a port, watch it, write to it

List the ports, open one and stream incoming data with watch(). Binary data, AT commands and auto-reconnect use the same port object.
main.ts
import { SerialPort } from "tauri-plugin-serialplugin-api";

const ports = await SerialPort.available_ports();   // { "/dev/ttyUSB0": { type: "USB", vid, pid, … }, … }

const port = new SerialPort({ path: Object.keys(ports)[0], baudRate: 115200 });
await port.open();

const handle = await port.watch({
  onData: (text) => console.log("rx", text),
  onDisconnect: (reason) => console.log("gone:", reason),
});

await port.write("hello\n");

await handle.unwatch();
await port.close();