Skip to content

Commit a327424

Browse files
authored
Fix response timeout option handled incorrectly (#4)
1 parent 0488d86 commit a327424

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
modbus-utils (1.2.6) stable; urgency=medium
2+
3+
* Fix response timeout option handled incorrectly
4+
5+
-- Nikolay Korotkiy <[email protected]> Wed, 30 Nov 2022 19:51:00 +0400
6+
17
modbus-utils (1.2.5) stable; urgency=medium
28

39
* rebuild of 1.2.4 for Debian bullseye (without source change)

modbus_client/modbus_client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ int main(int argc, char **argv)
314314
modbus_set_slave(ctx, slaveAddr);
315315

316316
struct timeval response_timeout;
317-
response_timeout.tv_sec = 0;
318-
response_timeout.tv_usec = timeout_ms * 1000;
317+
response_timeout.tv_sec = timeout_ms / 1000;
318+
response_timeout.tv_usec = (timeout_ms % 1000) * 1000;
319319
#if LIBMODBUS_VERSION_CHECK(3, 1, 2)
320320
modbus_set_response_timeout(ctx, response_timeout.tv_sec, response_timeout.tv_usec);
321321
#else

0 commit comments

Comments
 (0)