From 16b9a1b3bf40a4a2a21fbd715d1d014b9b9db771 Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Thu, 21 May 2009 11:55:36 +0200 Subject: [PATCH] Fix #378981 - CRC error on RTU response doesn't return negative value Reported by Henrik Munktell. --- NEWS | 8 +++++--- src/modbus.c | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index d25a97c..ed3a790 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -libmodbus 2.2.0 (2009-05-01) +libmodbus 2.2.0 (2009-06-01) ============================ - New API for slave server (see MIGRATION) - New slave server able to handle multiple connections @@ -7,10 +7,12 @@ libmodbus 2.2.0 (2009-05-01) - modbus_param_t is smaller (2 int removed) - Better error management - Faster -- Fix #333455 reported by Jeff Laughlin and Yishin Li. - Cygwin IPTOS_LOWDELAY not supported on cygwin +- Fix #333455 - Cygwin IPTOS_LOWDELAY not supported on cygwin + Reported by Jeff Laughlin and Yishin Li. - Fix #375926 - modbus.c:164: error: `MSG_DONTWAIT' undeclared Reported and tested by Yishin Li. +- Fix #378981 - CRC error on RTU response doesn't return negative value + Reported by Henrik Munktell. libmodbus 2.0.3 (2009-03-22) ============================ diff --git a/src/modbus.c b/src/modbus.c index 995aecc..3bacfac 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -639,11 +639,11 @@ static int receive_msg(modbus_param_t *mb_param, printf("\n"); if (mb_param->type_com == RTU) { - check_crc16(mb_param, msg, (*p_msg_length)); + return check_crc16(mb_param, msg, (*p_msg_length)); + } else { + /* OK */ + return 0; } - - /* OK */ - return 0; } /* Listens for any query from a modbus master in TCP, requires the socket file -- libgit2 0.21.4