Repository navigation
Releases
mbusgw-t2r 1.1.0
The .deb for amd64 and arm64 is tested on Debian 12, Debian 13 and Ubuntu 24.04 (any system with glibc >= 2.34 should do); for mipsel and mips64el it is built for Debian 12. The service is installed disabled: sudo systemctl enable --now mbusgw-t2r. Install: sudo apt install ./mbusgw-t2r_1.1.0-1_<arch>.deb.
OpenWrt: the .ipk is for 24.10 (opkg install ./mbusgw-t2r_1.1.0-*_<arch>.ipk), the .apk is for 25.12 (apk add --allow-untrusted ./mbusgw-t2r_1.1.0-*_<arch>.apk); libconfig and StarLet are linked statically, no network is needed for the install. The service is installed disabled: uci set mbusgw-t2r.main.enabled=1 && uci commit mbusgw-t2r && /etc/init.d/mbusgw-t2r start.
mbusgw-t2r 1.0.0
The .deb for amd64 and arm64 is tested on Debian 12, Debian 13 and Ubuntu 24.04 (any system with glibc >= 2.34 should do); for mipsel and mips64el it is built for Debian 12. The service is installed disabled: sudo systemctl enable --now mbusgw-t2r. Install: sudo apt install ./mbusgw-t2r_1.0.0-1_<arch>.deb.
OpenWrt: the .ipk is for 24.10 (opkg install ./mbusgw-t2r_1.0.0-*_<arch>.ipk), the .apk is for 25.12 (apk add --allow-untrusted ./mbusgw-t2r_1.0.0-*_<arch>.apk); libconfig and StarLet are linked statically, no network is needed for the install. The service is installed disabled: uci set mbusgw-t2r.main.enabled=1 && uci commit mbusgw-t2r && /etc/init.d/mbusgw-t2r start.
mbusgw-t2r 0.13.9
The .deb for amd64 and arm64 is tested on Debian 12, Debian 13 and Ubuntu 24.04 (any system with glibc >= 2.34 should do); for mipsel and mips64el it is built for Debian 12. The service is installed disabled: sudo systemctl enable --now mbusgw-t2r. Install: sudo apt install ./mbusgw-t2r_0.13.9-1_<arch>.deb.
OpenWrt: the .ipk is for 24.10 (opkg install ./mbusgw-t2r_0.13.9-*_<arch>.ipk), the .apk is for 25.12 (apk add --allow-untrusted ./mbusgw-t2r_0.13.9-*_<arch>.apk); libconfig and StarLet are linked statically, no network is needed for the install. The service is installed disabled: uci set mbusgw-t2r.main.enabled=1 && uci commit mbusgw-t2r && /etc/init.d/mbusgw-t2r start.
mbusgw-t2r 0.13.6
The .deb for amd64 and arm64 is tested on Debian 12, Debian 13 and Ubuntu 24.04 (any system with glibc >= 2.34 should do); for mipsel and mips64el it is built for Debian 12. The service is installed disabled: sudo systemctl enable --now mbusgw-t2r. Install: sudo apt install ./mbusgw-t2r_0.13.6-1_<arch>.deb.
OpenWrt: the .ipk is for 24.10 (opkg install ./mbusgw-t2r_0.13.6-*_<arch>.ipk), the .apk is for 25.12 (apk add --allow-untrusted ./mbusgw-t2r_0.13.6-*_<arch>.apk); libconfig and StarLet are linked statically, no network is needed for the install. The service is installed disabled: uci set mbusgw-t2r.main.enabled=1 && uci commit mbusgw-t2r && /etc/init.d/mbusgw-t2r start.
mbusgw-t2r 0.13.5
Packages for amd64 and arm64, tested on Debian 12, Debian 13 and Ubuntu 24.04 (any system with glibc >= 2.34 should do); the service is installed disabled: sudo systemctl enable --now mbusgw-t2r. Install: sudo apt install ./mbusgw-t2r_0.13.5-1_<arch>.deb.
mbusgw-t2r 0.13.2
mbusgw-t2r 0.13.2 — IDENT X.00-13ECO02, REV 00.13.02. A small maintenance release on top of 0.13.1. The serial line fix of 0.13.1 is included.
Changes
NETPOLLEVis a warning now:%T2R-W-NETPOLLEVinstead of%T2R-E-NETPOLLEV. It means that the TCP client reset its connection, for example because the polling program was restarted. This is not a failure of the gateway. The connection is closed as before.- User Guides (EN/RU, Markdown): in 0.13.1, the message codes reference listed 63 codes twice, some of them with old texts (for example, "IDLETMO ... 20 minutes"). The duplicates are removed. The PDF guides of 0.13.1 were not affected.
Upgrade notes
- No settings changes. Rebuild,
make install, restart the service. - Scripts that grep the log for
%T2R-E-NETPOLLEVshould look for%T2R-W-NETPOLLEV.
Verified
- FT4232 board (Armbian aarch64), 4 RS-485 lines at 9600 8N1: 4 ports × 4 clients, 480/480 OK. No errors in the log after the start.
mbusgw-t2r 0.13.1
mbusgw-t2r 0.13.1 — IDENT X.00-13ECO01, REV 00.13.01. A bug-fix release on top of 0.13.0. Update recommended if you use USB-to-serial adapters.
Fix: a serial line could stay blocked until the restart
The gateway lets only one request at a time use a serial line. After a request is written, the gateway waits until the adapter has sent it out. This wait had no time limit (tcdrain()). If a USB adapter stopped sending, the request waited forever and kept the line. Then:
- every other client of that port got
DEVLOCKERR/DEVBUSYand exception 4, until the gateway was restarted; - the shutdown printed
DEVCLSERRand waited 39 s for that port.
This was seen on the FT4232 test board: one of the four lines was dead for 9 minutes.
Now the wait is limited to the frame's send time plus the answer timeout (iotmo, about 1 s). If the adapter does not send the request in time:
- the request is dropped and the new message
TXDRAINTMOis logged; - the client gets exception 4;
- the line is released at once, so the next request tries again.
Other changes
- The serial port is opened with the hardware flow control (CRTSCTS) switched off. Before, it was inherited from the port settings: with CTS low nothing was sent.
DEVCLSERRis not logged twice on the shutdown.- User Guide (EN/RU): the new
TXDRAINTMOcode, and a troubleshooting row for "DEVLOCKERR/DEVBUSYon every request of one port". The row includes how to see where the threads wait before restarting. - Since 0.13.0: no git submodules; the GitLab CI builds StarLet before the gateway; the README describes the CI build.
Upgrade notes
- No settings changes. Rebuild,
make install, restart the service. - Scripts that grep the log may see the new code
%T2R-E-TXDRAINTMO.
Verified
- Normal exchange: speed and latency are the same as in 0.13.0 (pty 41.5 req/s; FT4232 board 4 ports × 4 clients, 480/480 OK).
- A forced send timeout: each request is dropped after about 1 s with exception 4, and the next client gets the line. There is no
DEVLOCKERR, and the gateway stops in 2 s.
mbusgw-t2r 0.13.0
mbusgw-t2r 0.13.0 — IDENT X.00-13, REV 00.13.00. Changes since X.00-08ECO01.
Highlights
- FTDI USB adapters no longer cut the answers. The end of an RTU answer is detected by its expected length (FC 01–06, 15, 16, 23 and the exception answer), not only by the t3.5 silence. FTDI adapters deliver data in chunks up to 16 ms apart (
latency_timer), which used to produce randomCRC16ERR/BADFRAME. A udev rule that setslatency_timerto 1 ms ships incontrib/99-ftdi-latency.rulesand is installed with the docs. - Every log line has a message code. All diagnostics are
$PUTMSG_FAOcatalogue messages:%T2R-<sev>-<CODE>, ..., 63 new codes. Each code is described in the User Guide (EN/RU), and the important ones also have a Troubleshooting row. - New connection limits for the listeners:
connlmnow really limits the simultaneous clients of a port. Default 32, range 1..512. One more client is rejected at once withCONNLIMIT. Before, it only set thelisten()queue.- New key
idletmocloses a client that has been silent for that many seconds. Default 60, range 1..86400. It used to be a hardcoded 20 minutes.
- The default install prefix is
/opt/mbusgw-t2r, a self-contained tree:sbin/,etc/,share/doc/mbusgw-t2r/.-DCMAKE_INSTALL_PREFIX=...works as before.
Fixes
- RS-485 mode was never switched on: the second
ioctl()wasTIOCGRS485instead ofTIOCSRS485. - A second gateway instance on the same ports silently shared the clients with the first one (
SO_REUSEPORT). Now itsbind()fails:LSNRERR, errno 98. make install DESTDIR=...put the configuration files under a doubledDESTDIR.main()returned a condition code instead ofEXIT_FAILUREon a command line or settings error.LSNRABRTalways printed the socket as#-1.t2r$rtu_pdu2ascii()did not check the output buffer size.- A literal
!in the FAO texts was printed wrongly; several message texts had English errors.
Other changes
- The package has a version: CMake takes it from
__REV__of the head module (REV00.13.00→0.13.0). - Routine headers were checked against the code and corrected.
- "Peer close connection" and "Time Stamp responder ... disabled" are logged as
-I-, not-W-. - The build is warning-free.
- README (EN/RU) describes the
listenerskeys.
Upgrade notes
connlmnow limits connections. A settings file withconnlm = 8admits only 8 clients per port. Check it if you have more clients.- Idle clients are disconnected after 60 s by default (
idletmo). Clients that poll less often simply reconnect; raiseidletmoto keep their connections open. - The default install path moved from
/usr/localto/opt/mbusgw-t2r. Update theExecStart=line of your systemd unit, or build with-DCMAKE_INSTALL_PREFIX=/usr/local. - Scripts that grep the log should use the codes: lines that had no code before now carry one (
%T2R-W: ...→%T2R-W-<CODE>, ...).
Verified
- Hardware: FT4232 board (Armbian aarch64), 4 RS-485 lines, 9600 8N1.
- With
latency_timer=16, X.00-09 failed 11 of 400 polls; the new framing failed 0 of 1600. - 64 clients (16 per line) and 256 clients (64 per line): no errors. A storm of 1920 short connections: no errors.
- Every line reaches the 9600-baud limit of about 40 requests/s; the gateway itself uses 1–3 % CPU and about 2 MB of memory.
X.00-07ECO01 - Project reorganazing and bugfixes
X.00-07ECO01 - Project reorganazing and bugfixes