Metadata-Version: 2.4
Name: ubtools
Version: 0.2.1
Summary: Tiny little tools to interact with U-Boot via the serial console
Author-email: Lanchon <lanchon@gmail.com>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/Lanchon/ubtools
Project-URL: Bug Tracker, https://github.com/Lanchon/ubtools/issues
Keywords: u-boot,uboot,serial,bootloader,embedded
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Embedded Systems
Classifier: Topic :: System :: Hardware
Classifier: Intended Audience :: Developers
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: pyserial>=3.5
Requires-Dist: platformdirs>=3
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# ubtools

### Tiny little tools to interact with U-Boot via the serial console

Also included is a simple yet robust Python 3.11 library to talk to U-Boot.

### Usage

To install the tools:
```
pipx install ubtools
```

To run without installing:
```
cd src
python -m ubtools.cli.COMMAND ...
```

To build and test:
```
./build
./run-tests
pipx install -e .
```

### Configuration

Defaults are loaded from the `serial` section of `~/.config/ubtools/config.toml`, if present:
```toml
[serial]
port = "/dev/ttyUSB0"
baud = 115200
timeout = 0.1
mode = "exclusive"
```

Environment variables of the form `UBTOOLS_*` (`UBTOOLS_PORT`, etc.) can override those values.

### Commands

| Command | Description |
|---|---|
| **[ubint](#ubint)** | Interrupt U-Boot autoboot via the serial console |
| **[ubcmd](#ubcmd)** | Send a command to U-Boot via the serial console and print the output |
| **[ubread](#ubread)** | Read from U-Boot memory via the serial console |
| **[ubwrite](#ubwrite)** | Write to U-Boot memory via the serial console |

### ubint

Interrupt U-Boot autoboot via the serial console

```
usage: ubint [-r] [-s STR] [-p PORT] [-b BAUD] [--timeout SECONDS]
             [--mode {shared,exclusive,none}] [-h] [--version]

Interrupt U-Boot autoboot via the serial console

options:
  -r, --reset           send reset command first
  -s STR, --string STR  interrupt using custom string
  -p PORT, --port PORT  serial port device
  -b BAUD, --baud BAUD  serial port baud rate
  --timeout SECONDS     serial port receive timeout
  --mode {shared,exclusive,none}
                        serial port locking mode
  -h, --help            show help message and exit
  --version             show version number and exit
```

### ubcmd

Send a command to U-Boot via the serial console and print the output

```
usage: ubcmd [-n | -q] [-p PORT] [-b BAUD] [--timeout SECONDS]
             [--mode {shared,exclusive,none}] [-h] [--version]
             COMMAND ...

Send a command to U-Boot via the serial console and print the output

positional arguments:
  COMMAND               command to send
  ARGS                  arguments

options:
  -n, --no-reply        do not retrieve output nor exit code
  -q, --quiet           do not show non-zero exit code
  -p PORT, --port PORT  serial port device
  -b BAUD, --baud BAUD  serial port baud rate
  --timeout SECONDS     serial port receive timeout
  --mode {shared,exclusive,none}
                        serial port locking mode
  -h, --help            show help message and exit
  --version             show version number and exit
```

### ubread

Read from U-Boot memory via the serial console

```
usage: ubread [-q] [-w BITS] [-p PORT] [-b BAUD] [--timeout SECONDS]
              [--mode {shared,exclusive,none}] [-h] [--version]
              FILE ADDRESS LENGTH

Read from U-Boot memory via the serial console

positional arguments:
  FILE                  Output file (use '-' for stdout)
  ADDRESS               memory address (decimal or hex)
  LENGTH                number of bytes (decimal or hex)

options:
  -q, --quiet           do not show progress
  -w BITS, --word BITS  use reads of specified bit width
  -p PORT, --port PORT  serial port device
  -b BAUD, --baud BAUD  serial port baud rate
  --timeout SECONDS     serial port receive timeout
  --mode {shared,exclusive,none}
                        serial port locking mode
  -h, --help            show help message and exit
  --version             show version number and exit
```

### ubwrite

Write to U-Boot memory via the serial console

```
usage: ubwrite [-q] [-w BITS] [-p PORT] [-b BAUD] [--timeout SECONDS]
               [--mode {shared,exclusive,none}] [-h] [--version]
               FILE ADDRESS

Write to U-Boot memory via the serial console

positional arguments:
  FILE                  input file (use '-' for stdin)
  ADDRESS               memory address (decimal or hex)

options:
  -q, --quiet           do not show progress
  -w BITS, --word BITS  use writes of specified bit width
  -p PORT, --port PORT  serial port device
  -b BAUD, --baud BAUD  serial port baud rate
  --timeout SECONDS     serial port receive timeout
  --mode {shared,exclusive,none}
                        serial port locking mode
  -h, --help            show help message and exit
  --version             show version number and exit
```

