This file provides technical guidance for AI coding agents working in this repository.
| Task | Command |
|---|---|
| Development build | mkdir -p build && cd build && cmake .. && make |
| Clean build | make clean (removes build/) then rebuild |
| Install (DEB) | sudo make install |
| Install without WebUI | sudo make install-no-webui |
| Check build output | build/modernjvs (binary) |
Install build dependencies before building:
sudo apt install -y build-essential cmake git file libgpiod-dev pkg-configPython 3 is required for the WebUI but is included in Raspberry Pi OS Lite and DietPi by default.
There is no automated test suite. Validate changes by:
- Running
mkdir -p build && cd build && cmake .. && make— it must compile with zero warnings (-Wall -Wextra -Wpedantic). - Confirming the resulting
build/modernjvsbinary exists. - For WebUI changes, confirming Python syntax with
python3 -m py_compile src/webui/modernjvs-webui.py.
- Standard: C99.
- Logging: always use
debug(level, fmt, ...), never bareprintf. - New public functions: add a Doxygen
/** */comment. - After editing, rebuild and fix all warnings before committing.
- Python 3, PEP 8 style.
- No new pip dependencies.
- All request handlers must enforce the private-IP allowlist.
- Game profiles:
docs/modernjvs/games/<game-name>– button mapping format. - Device profiles:
docs/modernjvs/devices/<device-name>– axis/button-to-action mapping. - IO board definitions:
docs/modernjvs/ios/<io-name>– capability declarations. - These files are installed to
/etc/modernjvs/bycmake --install/sudo make install.
- Version is set in
CMakeLists.txt:project(modernjvs VERSION "X.Y.Z"). - Pushing a version change on
masterautomatically triggers the GitHub release workflow.
| Topic | Detail |
|---|---|
| JVS sense line pulse | LOW 200 ms → FLOAT 100 ms stabilization |
| Serial buffer flush | tcflush() then usleep(100000) (100 ms) before read after reset |
| Wiimote pairing | Bluetooth only — no USB Wiimotes exist; always use proximity-based merge |
| Hot-plug checksum errors | Expected during reinitialization; log shows this. |
| Namco 246/256 re-enum | Reactive sense line pulse on wrong-address packet detection |
| libgpiod version | CMake auto-detects; GPIOD_API_V2 defined for v2+ |
| GPIO interface | Use libgpiod exclusively — sysfs GPIO is not supported |
src/modernjvs.c – entry point & main loop
src/console/ – CLI args, config parser, debug, watchdog
src/controller/ – input device enumeration, per-controller threads
src/hardware/ – RS485 serial device abstraction
src/jvs/ – JVS packet protocol, sense line, IO board emulation
src/ffb/ – force-feedback output
src/webui/ – Python WebUI server
docs/modernjvs/ – runtime config templates (installed to /etc/modernjvs/)
.github/workflows/ – CI release workflow
CMakeLists.txt – build system (version, sources, install, CPack DEB)
Makefile – developer convenience wrapper
- Don't use
printfdirectly – always usedebug(). - Don't use sysfs GPIO – use libgpiod.
- Don't assume USB Wiimotes – Wiimote/Nunchuk merge is always Bluetooth proximity-based.
- Don't skip
tcflush+ sleep after serial reset – this causes data corruption. - Don't change install paths in
CMakeLists.txtwithout updating the dpkgpostrmscript indebian/postrm. - The
build/version.hfile is generated by CMake fromsrc/version.h.in– do not edit it directly.