Skip to content

Commit

Permalink
Fix response timeout option handled incorrectly (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
sikmir authored Dec 1, 2022
1 parent 0488d86 commit a327424
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
modbus-utils (1.2.6) stable; urgency=medium

* Fix response timeout option handled incorrectly

-- Nikolay Korotkiy <[email protected]> Wed, 30 Nov 2022 19:51:00 +0400

modbus-utils (1.2.5) stable; urgency=medium

* rebuild of 1.2.4 for Debian bullseye (without source change)
Expand Down
4 changes: 2 additions & 2 deletions modbus_client/modbus_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ int main(int argc, char **argv)
modbus_set_slave(ctx, slaveAddr);

struct timeval response_timeout;
response_timeout.tv_sec = 0;
response_timeout.tv_usec = timeout_ms * 1000;
response_timeout.tv_sec = timeout_ms / 1000;
response_timeout.tv_usec = (timeout_ms % 1000) * 1000;
#if LIBMODBUS_VERSION_CHECK(3, 1, 2)
modbus_set_response_timeout(ctx, response_timeout.tv_sec, response_timeout.tv_usec);
#else
Expand Down

0 comments on commit a327424

Please sign in to comment.