libmodbus version 3.1.0 introduced backwards incompatible API changes in
modbussetresponsetimeout and modbussetbytetimeout functions. This
patch adds conditional compilation to use the API appropriately based
upon the result of the LIBMODBUSVERSIONCHECK macro.
评论 (11)
#2 – hazelnusse 于 2016-07-04
@SebKuzminsky Thanks for pushing. I was looking at http://buildbot.linuxcnc.org/buildbot/waterfall but I couldn’t see exactly where this PR was being built; is there an easy way to identify which builds are associated with this PR?
LIBMODBUSVERSIONCHECK() returns true if the major number is greater, or the major is the same and the minor is greater, or if the major and the minor are the same and the micro is greater than or equal.
https://github.com/stephane/libmodbus/blob/master/src/modbus-version.h.in#L45
#3 – hazelnusse 于 2016-07-04
@SebKuzminsky It might be worth setting up a buildbot slave that has libmodbus 3.1.x installed so that this patchset can tested against that version of libmodbus.
#4 – hazelnusse 于 2016-07-04
I just discovered that this API change occurred between versions 3.1.1 and 3.1.2:
https://github.com/stephane/libmodbus/blob/v3.1.1/src/modbus.h#L164
https://github.com/stephane/libmodbus/blob/v3.1.2/src/modbus.h#L188
I’ll update the patch accordingly.
#5 – hazelnusse 于 2016-07-04
@SebKuzminsky I’ve updated the patchset (force pushed), I think you’ll need to retrigger the buildbots.
#6 – SebKuzminsky 于 2016-07-04
I’m running the latest version of this branch (5bdebef86d) through the buildbot now.
#7 – SebKuzminsky 于 2016-07-05
Tracing a push through the buildbot is a bit awkward unfortunately.
On the waterfall page (http://buildbot.linuxcnc.org/buildbot/waterfall), newer stuff is higher in the table and older stuff is lower, and there’s a column for each builder (ie, each thing that gets done with the source).
The leftmost builder is named “0000.checkin”, and it’s the first thing that runs on each push. It orchestrates the other builders. By clicking on the “0000.checkin” name at the top left of the table you can see some info about that builder, including what it’s currently busy with (“Current Builds”), and the result of the last few builds it did (“Recent Builds”).
By clicking on a build number you can see info about that build, including the branch it’s from and how it’s going (if it’s currently building) or how it went (if it’s in finished).
The “0000.checkin” builder doesn’t do much: it updates a local git repo with the branch that was pushed, then triggers all the ‘rip-and-test’ builders. These are the next several columns on the waterfall page.
The rip-and-test builders check out the pushed commit, build it for run-in-place, and run the test suite.
If all of them pass the build & test, the 0000.checkin builder next triggers the packaging builders, which build debian source packages, build those into debian binary packages, and upload it to the buildbot’s debian package archive.
So to answer your question, you need to look through the 0000.checkin builder’s recent builds, find the one whose ‘branch’ property is the one you’re interested in (http://buildbot.linuxcnc.org/buildbot/builders/0000.checkin/builds/4325), and from there you can follow the rip and package builders that it triggered to do all the real work.
Hope this helps.
#8 – hazelnusse 于 2016-07-07
@SebKuzminsky is there anything more needed for this to go in? The only thing I can think of is setting up a build slave that has libmodbus 3.1.x so that tests can be run that would actually exercise the code in this patchset. I realize this is probably pretty low priority so no worries if you guys want to wait before merging this.
#9 – SebKuzminsky 于 2016-07-08
Merged. Thanks for this patch!
I unfortunately can’t easily exercise any of the libmodbus code in the buildbot, as I don’t have any modbus hardware to plug into the build/test machines. Compile-testing is the best I can do at the moment. Once one of our supported platforms upgrades to libmodbus >= 3.1.2 we’ll build against that version.
What platform are you building on?
#10 – hazelnusse 于 2016-07-08
I’m on Gentoo ~amd64 so bleeding edge stuff all over the place
Right now just a laptop but eventually for a real machine that will run a 3-axis mill.
#11 – antohami 于 2016-11-27
Compiling with libmodbus version 3.1.4 fails.
Compiling hal/user_comps/mb2hal/mb2hal.c
hal/usercomps/mb2hal/mb2hal.c: In function ‘gettx_connection’:
hal/usercomps/mb2hal/mb2hal.c:362:55: warning: passing argument 2 of ‘modbussetresponsetimeout’ makes integer from pointer without a cast [-Wint-conversion]
modbussetresponsetimeout(thismb_link->modbus, &timeout);
^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:185:16: note: expected ‘uint32_t {aka unsigned int}’ but argument is of type ‘struct timeval *’
MODBUSAPI int modbussetresponsetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
^
hal/usercomps/mb2hal/mb2hal.c:362:5: error: too few arguments to function ‘modbussetresponsetimeout’
modbussetresponsetimeout(thismb_link->modbus, &timeout);
^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:185:16: note: declared here
MODBUSAPI int modbussetresponsetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
^
hal/usercomps/mb2hal/mb2hal.c:369:51: warning: passing argument 2 of ‘modbussetbytetimeout’ makes integer from pointer without a cast [-Wint-conversion]
modbussetbytetimeout(thismb_link->modbus, &timeout);
^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:188:16: note: expected ‘uint32_t {aka unsigned int}’ but argument is of type ‘struct timeval *’
MODBUSAPI int modbussetbytetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
^
hal/usercomps/mb2hal/mb2hal.c:369:5: error: too few arguments to function ‘modbussetbytetimeout’
modbussetbytetimeout(thismb_link->modbus, &timeout);
^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:188:16: note: declared here
MODBUSAPI int modbussetbytetimeout(modbust *ctx, uint32t tosec, uint32t to_usec);
^
make: * [objects/hal/user_comps/mb2hal/mb2hal.o] Error 1
#1 – SebKuzminsky 于 2016-07-04
I just pushed this branch (still unmerged) to git.linuxcnc.org, so that the buildbot will test it on all our platforms.
Does the LIBMODBUSVERSIONCHECK() macro check for “>=”, or for equality?