Metadata-Version: 2.4
Name: tcp-serial
Version: 0.1.0
Summary: CLI tools for interacting with ser2net serial consoles over TCP
Author-email: XieChangqing <dian@duck.com>
License: MIT License
        
        Copyright (c) 2026 changqing_xie
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# tcp-serial

CLI tools for interacting with ser2net serial consoles over TCP.

## Installation

```bash
uvx tcp-serial
```

Or install permanently:

```bash
uv tool install tcp-serial
```

## Usage

```
tcp-serial COMMAND [options]
```

### Commands

#### `monitor` — continuously monitor serial console output

```bash
tcp-serial monitor --port 3000
tcp-serial monitor --ssh user@host --remote-port 3000 --reconnect --timestamp
```

#### `exec` — execute a command over the serial console

```bash
tcp-serial exec --port 3000 -- ls /tmp
tcp-serial exec --port 3000 --json -- uname -a
tcp-serial exec --ssh user@host --remote-port 3000 -- cat /proc/version
```

#### `uboot` — interrupt autoboot and enter the U-Boot prompt

```bash
tcp-serial uboot --port 3000 --from-shell
tcp-serial uboot --port 3000 --manual-reboot
```

## Connection Options

All commands share these connection options:

| Option | Description |
|--------|-------------|
| `--host` | ser2net host (default: `127.0.0.1`) |
| `--port` | ser2net TCP port |
| `--ssh` | SSH target for remote forwarding, e.g. `user@host` |
| `--remote-port` | ser2net TCP port on the SSH server |
| `--remote-host` | ser2net host as seen from the SSH server |
| `--ssh-arg` | extra argument passed to ssh (repeatable) |
| `--encoding` | text encoding (default: `utf-8`) |
| `--mode` | console mode: `shell` or `uboot` |
| `--connect-timeout` | max seconds to wait for connection (default: `5.0`) |

Use exactly one of `--port` (direct) or `--ssh` + `--remote-port` (SSH forwarding).

## Environment Variables

| Variable | Description |
|----------|-------------|
| `TCP_SERIAL_SSH` | SSH target; overridden by `--ssh` |
| `TCP_SERIAL_REMOTE_PORT` | Remote port; overridden by `--remote-port` |

## License

MIT
