serial_open
Open a serial connection to a specified port, with auto-discovery of available ports and configurable baud rate, data bits, stop bits, parity, and timeouts. Close the port when finished to free the device.
Instructions
Open a serial connection to the specified port.
If port is omitted, automatically discovers available ports. When only one port is found it is used directly; when multiple are found, elicitation is used to let the user pick one.
IMPORTANT: Always call serial_close() when you are finished with the port. Leaving a port open prevents other processes from accessing the device. The session will be automatically closed after inactivity_timeout seconds of no activity.
Common configurations:
Most devices: 115200 baud, 8N1 (the defaults)
Older equipment: 9600 baud, 8N1
Use serial_detect_baud() first if unsure of the baud rate.
Args: port: Serial port device path (e.g. /dev/ttyUSB0, COM3). Optional — omit to auto-discover. baud_rate: Baud rate for the connection data_bits: Number of data bits (5, 6, 7, or 8) stop_bits: Number of stop bits (1, 1.5, or 2) parity: Parity checking ("none", "even", "odd", "mark", "space") timeout: Read timeout in seconds inactivity_timeout: Seconds of inactivity before the session is auto-closed (default 900 = 15 min)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | ||
| parity | No | none | |
| timeout | No | ||
| baud_rate | No | ||
| data_bits | No | ||
| stop_bits | No | ||
| inactivity_timeout | No |