Skip to content

Transport

A Transport moves bytes over a single channel — a serial port, a TCP socket, a USB endpoint. Every Protocol (Scpi, LineText, BinaryStream) rides on a Transport via the connector's connection: block. Most Drivers own their connection internally and don't need this block.

This page is the catalogue of every option the connection: block accepts.

Quickstart

js
// Pick one — sibling to `protocol:` and `config:` in the connector file.

// Serial (RS-232, USB-to-serial)
connection: { type: "serial", port: "/dev/ttyUSB0", baudRate: 9600 }

// TCP/IP (LXI lab instruments, network embedded devices)
connection: { type: "tcp", host: "192.168.1.50", port: 5025 }

// USBTMC (direct USB-B port on lab instruments — Rigol DS1000Z, Keysight DSO-X)
connection: { type: "usbtmc", vendorId: 0x1AB1, productId: 0x04CE }

The type field selects which Transport implementation to use; the remaining fields are transport-specific.

Serial

For RS-232 ports, USB-to-serial adapters, and embedded devices speaking serial.

js
connection: {
  type: "serial",
  port: "/dev/ttyUSB0",   // "COM5" on Windows, "/dev/tty.usbserial-XXXX" on macOS
  baudRate: 9600,
  // optional:
  dataBits: 8,
  stopBits: "one",
  parity: "none",
  flowControl: "none",
}
FieldTypeDefaultDescription
type"serial"requiredSelects the serial transport.
portstringrequiredOS-level port path. Windows: "COM4". Linux: "/dev/ttyUSB0", "/dev/ttyACM0". macOS: "/dev/tty.usbserial-XXXX" (find with ls /dev/tty.* after plugging in).
baudRateint9600Bits per second. Common values: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
dataBitsint8Bits per character: 5, 6, 7, or 8.
stopBitsenum"one""one", "onePointFive", or "two".
parityenum"none""none", "odd", "even", "mark", or "space".
flowControlenum"none""none", "xon-xoff" (software, XON/XOFF — Hameg HM81xx, older R&S / Tek), "rts-cts" (hardware), or "both".

Finding the port

Don't know which port the device is on? The AI's unplug-plug detection flow — three calls to list_serial_ports before / during / after re-plugging the device — identifies the port automatically. The AI's discover_serial_device then sweeps common baud rates + terminators to find the right settings.

TCP

For network-attached devices: LXI lab instruments (port 5025), Modbus-TCP slaves (502), telnet-style protocols (23), or any custom binary/text-over-TCP service.

js
connection: {
  type: "tcp",
  host: "192.168.1.50",
  port: 5025,
}
FieldTypeDefaultDescription
type"tcp"requiredSelects the TCP transport.
hoststringrequiredIPv4 / IPv6 address or hostname.
portint5025 for SCPITCP port. Common values: 5025 (SCPI / LXI raw socket), 502 (Modbus-TCP), 23 (telnet-style).

USBTMC

For lab instruments with a USB-B port that speak the USB Test & Measurement Class protocol — Rigol DS1000Z, Keysight DSO-X, Siglent SDS, Tektronix MSO/MDO, and many others. Higher throughput and lower latency than TCP or serial.

js
connection: {
  type: "usbtmc",
  vendorId: 0x1AB1,         // Rigol
  productId: 0x04CE,        // DS1054Z
  // optional:
  serial: "DS1ZA231901234", // pick a specific device by USB serial number
  interfaceNumber: 0,
  endpointNumber: 0,
}
FieldTypeDefaultDescription
type"usbtmc"requiredSelects the USBTMC transport.
vendorIdintrequiredUSB Vendor ID. Hex literals (0x1AB1) or decimal ints both work.
productIdintrequiredUSB Product ID.
serialstringOptional USB serial-number filter. Empty/omitted = first match. Use when multiple identical instruments are plugged in.
interfaceNumberintautoUSB interface index for the USBTMC class. Auto-detected; override only if libusb finds the wrong one.
endpointNumberintautoUSB endpoint index. Same auto-detection.

Finding VID/PID

Call the AI's list_usbtmc_devices tool, or use a system tool: lsusb on Linux, System Information → USB on macOS, Device Manager → USB devices on Windows.

Platform notes

  • Windows. WinUSB driver must be bound to the device. The Windows USBTMC driver and Keysight IO / NI-VISA drivers will claim the device by default — install Zadig → select the instrument → install WinUSB. Until you do, the transport will fail with "driver claimed by another process".
  • Linux. Needs a udev rule for non-root access. Example for Rigol VID 0x1AB1:
    # /etc/udev/rules.d/99-muxit-usbtmc.rules
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1ab1", MODE="0666"
    Then sudo udevadm control --reload-rules && sudo udevadm trigger. Without this you'll get permission errors from libusb.
  • macOS. Works out of the box — no setup needed.

Which protocols ride which transports?

ProtocolSerialTCPUSBTMC
Scpi
LineText
BinaryStream

USBTMC is request-response (no spontaneous data), so LineText's prefix-matched line capture and BinaryStream's inter-frame-gap framing don't apply.

See also

Muxit — Hardware Orchestration Platform