From ddb2200377565bd8da694e125c4e89e415b15749 Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Tue, 4 Jan 2011 23:00:50 +0100 Subject: [PATCH] Fix unit identifier not copied by the TCP server --- NEWS | 4 +++- src/modbus-tcp.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 5d22df6..495f2a0 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ -libmodbus 2.9.3 (2010-12-XX) +libmodbus 2.9.3 (2011-01-XX) ============================ +- Fix unit identifier not copied by the TCP server. + Reported by Antti Manninen. - New function to reply to an indication with an exception message modbus_reply_exception() - Fix missing modbus_flush() in unit tests diff --git a/src/modbus-tcp.c b/src/modbus-tcp.c index d63f7b6..1ce7b35 100644 --- a/src/modbus-tcp.c +++ b/src/modbus-tcp.c @@ -141,7 +141,8 @@ int _modbus_tcp_build_response_basis(sft_t *sft, uint8_t *rsp) /* Length will be set later by send_msg (4 and 5) */ - rsp[6] = 0xFF; + /* The slave ID is copied from the indication */ + rsp[6] = sft->slave; rsp[7] = sft->function; return _MODBUS_TCP_PRESET_RSP_LENGTH; -- libgit2 0.21.4