Skip to content

Add support for MAX_SLAVE and REPLY_TO_BROADCAST quirks#99

Closed
JesseRiemens wants to merge 1 commit intoepsilonrt:masterfrom
JesseRiemens:add-quirks
Closed

Add support for MAX_SLAVE and REPLY_TO_BROADCAST quirks#99
JesseRiemens wants to merge 1 commit intoepsilonrt:masterfrom
JesseRiemens:add-quirks

Conversation

@JesseRiemens
Copy link
Copy Markdown

To write to addresses above 247 libmodbus exposes the modbus_enable_quirks function. This PR adds command line flags to enable these quirks.

zknpr added a commit to zknpr/mbpoll that referenced this pull request Feb 6, 2026
## Security Fixes
- Fix memory leak: piStartRef was not freed in cleanup paths
- Add NULL checks after all malloc/calloc calls to prevent crashes
- Add compiler security flags: -fstack-protector-strong, -D_FORTIFY_SOURCE=2, -Wformat-security

## Code Modernization
- Modernize CMakeLists.txt with proper Release/Debug build separation
- Use target-based CMake properties instead of global definitions
- Add -Wpedantic flag (with exception for 3rdparty getopt code)
- Update copyright years to 2015-2025
- Update libmodbus minimum version to 3.1.7
- Translate all French comments to English

## Community PR Integration
- Implement PR epsilonrt#87: Check modbus_set_slave() return value to prevent crashes with invalid slave addresses (credit: @r00t-)
- Implement PR epsilonrt#90: Add -x option to print register addresses in hexadecimal format (credit: @ciakval)
- Implement PR epsilonrt#99: Add -Q and -X options for libmodbus quirks (MAX_SLAVE and REPLY_TO_BROADCAST) (credit: @JesseRiemens)

## New Features
- `-x` Print address (reference) in hexadecimal format
- `-Q` Enable MAX_SLAVE quirk (accept slave id 0-255)
- `-X` Enable REPLY_TO_BROADCAST quirk (send reply to broadcast)

## CI/CD
- Add GitHub Actions workflow for automated builds on Linux, macOS, and Windows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@epsilonrt
Copy link
Copy Markdown
Owner

fix by #100

@epsilonrt epsilonrt closed this Feb 10, 2026
zknpr added a commit to zknpr/mbpoll that referenced this pull request Feb 16, 2026
…ibution

Remove the implementations of:
- modbus_set_slave() return value checking (originally PR epsilonrt#87 by @r00t-)
- -x hex address option (originally PR epsilonrt#90 by @ciakval)
- -Q/-X quirks options (originally PR epsilonrt#99 by @JesseRiemens)

These features will be re-added in subsequent commits with proper git
authorship attributed to their original contributors.
zknpr pushed a commit to zknpr/mbpoll that referenced this pull request Feb 16, 2026
Add support for MAX_SLAVE (-Q) and REPLY_TO_BROADCAST (-X) quirks:
- -Q: Accept slave addresses 0-255 (bypasses libmodbus default limit)
- -X: Force reply to broadcast address requests

Requires libmodbus >= 3.1.7 for modbus_enable_quirks() API.

Originally contributed in PR epsilonrt#99; adapted to the current codebase.
zknpr pushed a commit to zknpr/mbpoll that referenced this pull request Feb 16, 2026
Add support for MAX_SLAVE (-Q) and REPLY_TO_BROADCAST (-X) quirks:
- -Q: Accept slave addresses 0-255 (bypasses libmodbus default limit)
- -X: Force reply to broadcast address requests

Requires libmodbus >= 3.1.7 for modbus_enable_quirks() API.

Originally contributed in PR epsilonrt#99; adapted to the current codebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants