Skip to content

Fix mingw build only (rtu_usb specific) #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jimklimov
Copy link
Member

Separated from PR #3 that also tries to fix tests and code, and may take more time to complete through all the questionable changes into production code (e.g. flushing or not upon reconnection attempts).

Another change set was extracted as #4

This subset of those changes focuses more strictly on passing builds without warnings, due to regressions allegedly due to NUT rtu_usb branch itself:

  • changes in rtu_usb branch not as portable as they should be (printing of int types)
  • some code style not conforming to defined clang-format
  • test-building on systems without libusb
  • revert part of an earlier exploratory fix on the branch, done for invalid socket (the ctx->s < 0 case): after all, do return if we fail select() -- it is not the LIBC one, but the backend-defined one. So in this use-case, the rtu_usb backend does not even care about the fdset and has its own ways to decide on success or failure of the communications attempt.

jimklimov and others added 4 commits January 26, 2025 13:27
Just cast from `ssize_t` to a more portable `long long int` type;
here even a `short int` should be big enough for expected values.
If a more diligent solution is needed in the future, see e.g.
https://github.com/networkupstools/nut/blob/master/include/nut_stdint.h

Signed-off-by: Jim Klimov <[email protected]>
… the standard one; do return from method if that implementation fails

Note that the primary "weird" use-case is about libusb backend;
its _modbus_rtu_usb_select() ignores "rset" anyway, and talks
to the libusb context.

Signed-off-by: Jim Klimov <[email protected]>
@jimklimov jimklimov added bug Something isn't working enhancement New feature or request labels Jan 26, 2025
@jimklimov jimklimov changed the base branch from master to rtu_usb January 26, 2025 12:33
@jimklimov jimklimov merged commit 5bc006b into networkupstools:rtu_usb Jan 26, 2025
1 check passed
@jimklimov jimklimov deleted the fix-mingw-build-only-rtu-usb branch January 26, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant