Skip to main content

Serial terminal with Y-Modem transfer support

Project description

YModTerm

A modern serial terminal application with YMODEM, YMODEM-G, XMODEM, and ZMODEM protocol support.

Based on o-murphy/ymodem fork of alexwoo1900/ymodem library GUI inpired by CuteCom - graphical serial terminal

Python License

Features

  • Multiple Protocol Support: YMODEM, YMODEM-G, XMODEM, and ZMODEM file transfer protocols
  • Cross-Platform: Works on Windows, Linux, and macOS
  • Modern GUI: Built with Qt (via qtpy) for a responsive interface
  • Flexible Configuration: Customizable serial port settings (baudrate, parity, stop bits, etc.)
  • Input History: Keep track of previously sent commands
  • Multiple Output Modes: ASCII, Hex, and control character display
  • File Logging: Optional logging to file with append mode
  • Auto-Reconnect: Automatic port reconnection option
  • Settings Persistence: All settings are saved between sessions

Installation

Prerequisites

  • Python 3.10 or higher
  • pip package manager

Install from source

git clone https://github.com/yourusername/ymodterm.git
cd ymodterm
pip install -r requirements.txt

Dependencies

  • qtpy - Qt abstraction layer
  • PyQt5 or PySide2 or PyQt6 or PySide6 - Qt bindings
  • pyserial - Serial port communication
  • ymodem - YMODEM protocol implementation (based on alexwoo1900/ymodem)

Usage

Basic Usage

python ymodterm_gui.py

Command Line Arguments

python ymodterm_gui.py [options]

Options:
  -h, --help            Show help message and exit
  -p PORT, --port PORT  COM port
  -b BAUDRATE, --baudrate BAUDRATE
                        Baudrate (default: 9600)
  -pr {N,E,O,S,M}, --parity {N,E,O,S,M}
                        Parity: N(one), E(ven), O(dd), S(pace), M(ark)
  -db {5,6,7,8}, --databits {5,6,7,8}
                        Data bits (default: 8)
  -sb {1,2,1.5}, --stopbits {1,2,1.5}
                        Stop bits (default: 1)
  -m {X,Y,YG,Z}, --modem {X,Y,YG,Z}
                        Modem protocol: X(Modem), Y(Modem), YG(Modem-G), Z(Modem)
  -d, --debug           Enable debug logging
  -V, --version         Show version and exit

Example

# Connect to COM3 at 115200 baud with YMODEM protocol
python ymodterm_gui.py -p COM3 -b 115200 -m Y

# Linux example with debug output
python ymodterm_gui.py -p /dev/ttyUSB0 -b 9600 -d

GUI Features

Connection Panel

  • Device Selection: Dropdown list of available serial ports with auto-refresh
  • Connect/Disconnect: Toggle connection button
  • RTS/DTR Control: Hardware flow control signals
  • Auto Reconnect: Automatic reconnection on port disconnect
  • Settings Panel: Expandable panel for advanced serial configuration

Settings Panel

  • Baudrate: Configurable from 1200 to 10000000 (editable combo box)
  • Data Bits: 5, 6, 7, or 8 bits
  • Flow Control: None, Hardware, or Software
  • Parity: None, Even, Odd, Space, Mark
  • Stop Bits: 1, 1.5, or 2
  • Open Mode: Read Only, Write Only, or Read/Write
  • Display Options: Control character display, timestamps
  • Logfile: Configure output logging with append mode

Terminal Output

  • Hex Output Mode: Display data in hexadecimal format
  • Control Character Display: Show control characters as <0x00> format
  • UTF-8 Support: Proper handling of multi-byte UTF-8 sequences
  • Auto-scroll: Automatic scrolling to latest output
  • Clear Function: Clear terminal output
  • File Logging: Optional logging to file

Input Panel

  • Command Input: Text field with Enter-to-send
  • Line Ending Options: LF, CR, CR/LF, None, or Hex input
  • Auto Return: Automatically send on text change
  • File Transfer: Send files using selected modem protocol
  • Protocol Selection: YMODEM, YMODEM-G, XMODEM, or ZMODEM

Input History

  • Command History: List of previously sent commands
  • Click to Resend: Click any history item to populate input field
  • Context Menu: Remove individual items or clear all history

File Transfer

YModTerm supports multiple file transfer protocols:

  1. YMODEM: Reliable batch file transfer with CRC checking
  2. YMODEM-G: Streaming variant of YMODEM (faster, no error recovery)
  3. XMODEM: Classic single-file transfer protocol
  4. ZMODEM: Advanced protocol with crash recovery

Sending Files

  1. Ensure serial port is connected
  2. Select desired protocol from dropdown
  3. Click "Send File..." button
  4. Select file to transfer
  5. Monitor progress in dialog
  6. Cancel anytime if needed

Receiving Files

File reception feature is implemented in the modem manager but requires additional UI work for directory selection.

Technical Details

Architecture

  • SerialManagerWidget: Handles serial port connection and configuration
  • ModemTransferManager: Manages file transfers with queue-based data handling
  • QSerialPortModemAdapter: Adapter between Qt serial port and ymodem library
  • AppState: Centralized state management with persistent settings
  • StatefullProp: Reactive property system for UI binding

Data Flow

Serial Port → QSerialPort → readyRead signal
                                ↓
                    data_received signal
                                ↓
        ┌───────────────────────┴────────────────────┐
        ↓                                            ↓
OutputViewWidget                        ModemTransferManager
(display to user)                       (transfer queue)

Control Character Handling

The application properly handles control characters in multiple ways:

  • Visual display: <0x00>, <0x0D>, etc.
  • Named representation: ^@, ^A, \n, \t
  • Hex mode: All bytes as hex pairs

UTF-8 Support

Smart UTF-8 decoding with fallback:

  1. Attempts to decode valid UTF-8 sequences
  2. Falls back to hex representation for invalid bytes
  3. Preserves multi-byte character integrity

Configuration

Settings are automatically saved to:

  • Windows: %APPDATA%/o-murphy/ymodterm.ini
  • Linux/macOS: ~/.config/o-murphy/ymodterm.conf

Development

Project Structure

ymodterm/
├── ymodterm_gui.py          # Main application file
├── requirements.txt         # Python dependencies
├── README.md               # This file
└── ymodem/                 # YMODEM library
    ├── Protocol.py
    └── Socket.py

Adding Features

The codebase uses Qt's signal/slot mechanism extensively. To add new features:

  1. Create a StatefullProp for state management
  2. Bind UI widgets to properties using .bind() method
  3. Connect signals for reactive updates
  4. Add persistence in AppState.save_settings()

Troubleshooting

Port Access Issues (Linux)

Add your user to the dialout group:

sudo usermod -a -G dialout $USER
# Log out and back in for changes to take effect

Permission Denied (macOS)

Grant Terminal.app full disk access in System Preferences → Security & Privacy.

Transfer Failures

  • Ensure both devices use the same protocol
  • Check baud rate matches on both ends
  • Verify flow control settings
  • Enable debug mode: python ymodterm_gui.py -d

Qt Backend Issues

YModTerm uses qtpy for Qt abstraction. If you encounter import errors:

# Try different Qt backends
pip install PyQt5  # or
pip install PySide2  # or
pip install PyQt6  # or
pip install PySide6

Credits

  • Based on alexwoo1900/ymodem library
  • Built with Qt and Python
  • Serial communication via pyserial

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ymodterm-0.1.0b3.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ymodterm-0.1.0b3-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file ymodterm-0.1.0b3.tar.gz.

File metadata

  • Download URL: ymodterm-0.1.0b3.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ymodterm-0.1.0b3.tar.gz
Algorithm Hash digest
SHA256 356f80335031b6713a38777bd9bcecafbc64dc100f1b4c11ad18d602ad5b6d71
MD5 0f5c1087caf5719e2d7cae40e1014ea3
BLAKE2b-256 f3133cddfe3734a6bc956eac8f20d084eda298a919a944b420711d0626dff818

See more details on using hashes here.

File details

Details for the file ymodterm-0.1.0b3-py3-none-any.whl.

File metadata

  • Download URL: ymodterm-0.1.0b3-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ymodterm-0.1.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 824ce7a1de830bf80f81f516094005fdb1151bda1480bcf54dcd352fe1be31d5
MD5 5634d68dad629016ebfaf6edac0312b9
BLAKE2b-256 98139634afa8aa03b66ce4440ed56f4d311faab71010645c7737636c9b7d97f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page