A DMOD (Dynamic Modular System) module that adds terminal behavior - echo and canonical (line-buffered) input - on top of any other stream device dmdevfs can open, without that device's own driver having to implement it.
Every DMOD driver shows up as a stream file under /dev, which is handy: in
dmell you can redirect stdin/stdout to a UART device node and use it as
a new terminal. The catch is that IO-flag handling (echo, line editing) only
exists inside dmlog's own console today - a plain dmuart node just
forwards raw bytes, so redirecting to it gives you a terminal with no echo.
dmtty implements that line discipline once and lets it be layered on top of
any backing file instead of duplicating it in every driver.
- Standard DMDRVI Interface: Read/write/ioctl device access pattern, like any other DMOD driver
- Echo & Canonical Mode: Per-node IO flags, configurable via ioctl at runtime
- One Main Node, Many Extra Nodes: Creates
/dev/ttyfrom configuration, then exposes an API to attach any number of additional nodes to other backing files - Two Attach Paths: A direct API (
dmtty_attach()) and admhamanhot-plug event (DMTTY_HANDLER_NAME_DEVICE_AVAILABLE) for drivers that don't want a compile-time dependency on dmtty - Architecture-Independent: No MCU/board-specific code - it only forwards to an already-open backing file, so it builds identically everywhere
Using dmf-get from the DMOD release package:
dmf-get install dmtty- Create the main
/dev/ttynode (config.ini, loaded bydmdevfs):
[dmtty]
backing=/dev/dmuart1
echo=on
canonical=on- Or attach additional nodes at runtime:
#include "dmtty.h"
/* Turn /dev/dmuart1 into a new terminal node -> creates /dev/tty1 */
dmtty_attach("/dev/dmuart1", NULL, DMTTY_FLAGS_DEFAULT);- Use it like any other device file, e.g. from
dmell:
dmell < /dev/tty1 > /dev/tty1
- CMake 3.18 or higher
- A DMOD-compatible toolchain (automatically fetched via
dmod)
cmake -B build
cmake --build buildComprehensive documentation is available in the docs/ directory:
- dmtty.md - Module overview and architecture
- api-reference.md - Complete API documentation
- configuration.md - Configuration guide with examples
View documentation using dmf-man:
dmf-man dmtty # Main documentation
dmf-man dmtty api # API reference
dmf-man dmtty config # Configuration guidedmtty/
├── configs/ # Default dmdevfs configuration
├── docs/ # Documentation (markdown format)
├── examples/ # Example configurations
├── include/
│ ├── dmtty.h # Main API (direct attach/detach + DMDRVI interface)
│ └── dmtty_types.h # IO flags, ioctl commands, dmhaman event
├── src/
│ └── dmtty.c # Implementation
├── tools/
│ └── tty/ # CLI tool to manually attach a path via dmtty_attach()
├── CMakeLists.txt # Build configuration
└── manifest.dmm # DMOD manifest
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Patryk Kubiak - Initial work
- DMOD - Dynamic Modular System framework
- DMDRVI - DMOD Driver Interface
- DMDEVFS - DMOD Driver File System (manages driver device nodes)
- DMHAMAN - Handler registry used for hot-plug announcements
- DMUART - UART driver module (a common dmtty backing device)
- DMLOG - Logging/monitor console (the original source of IO-flag handling)
For issues, questions, or contributions:
- Open an issue on GitHub
- Check the documentation in
docs/ - Use
dmf-man dmttyfor command-line help