Commit 16b9a1b3bf40a4a2a21fbd715d1d014b9b9db771

Authored by Stéphane Raimbault
1 parent f46bde45

Fix #378981 - CRC error on RTU response doesn't return negative value

Reported by Henrik Munktell.
Showing 2 changed files with 9 additions and 7 deletions
1 -libmodbus 2.2.0 (2009-05-01) 1 +libmodbus 2.2.0 (2009-06-01)
2 ============================ 2 ============================
3 - New API for slave server (see MIGRATION) 3 - New API for slave server (see MIGRATION)
4 - New slave server able to handle multiple connections 4 - New slave server able to handle multiple connections
@@ -7,10 +7,12 @@ libmodbus 2.2.0 (2009-05-01) @@ -7,10 +7,12 @@ libmodbus 2.2.0 (2009-05-01)
7 - modbus_param_t is smaller (2 int removed) 7 - modbus_param_t is smaller (2 int removed)
8 - Better error management 8 - Better error management
9 - Faster 9 - Faster
10 -- Fix #333455 reported by Jeff Laughlin and Yishin Li.  
11 - Cygwin IPTOS_LOWDELAY not supported on cygwin 10 +- Fix #333455 - Cygwin IPTOS_LOWDELAY not supported on cygwin
  11 + Reported by Jeff Laughlin and Yishin Li.
12 - Fix #375926 - modbus.c:164: error: `MSG_DONTWAIT' undeclared 12 - Fix #375926 - modbus.c:164: error: `MSG_DONTWAIT' undeclared
13 Reported and tested by Yishin Li. 13 Reported and tested by Yishin Li.
  14 +- Fix #378981 - CRC error on RTU response doesn't return negative value
  15 + Reported by Henrik Munktell.
14 16
15 libmodbus 2.0.3 (2009-03-22) 17 libmodbus 2.0.3 (2009-03-22)
16 ============================ 18 ============================
src/modbus.c
@@ -639,11 +639,11 @@ static int receive_msg(modbus_param_t *mb_param, @@ -639,11 +639,11 @@ static int receive_msg(modbus_param_t *mb_param,
639 printf("\n"); 639 printf("\n");
640 640
641 if (mb_param->type_com == RTU) { 641 if (mb_param->type_com == RTU) {
642 - check_crc16(mb_param, msg, (*p_msg_length)); 642 + return check_crc16(mb_param, msg, (*p_msg_length));
  643 + } else {
  644 + /* OK */
  645 + return 0;
643 } 646 }
644 -  
645 - /* OK */  
646 - return 0;  
647 } 647 }
648 648
649 /* Listens for any query from a modbus master in TCP, requires the socket file 649 /* Listens for any query from a modbus master in TCP, requires the socket file