Skip to content

Conversation

@ProtocolSpecCheck
Copy link

We respectfully submit this pull request in order to improve the consistency between libmodbus and its specification.

Why is this PR needed?

In the previous implementation of libmodbus, when modbus clients send the valid but unimplemented command READ EXCEPTION STATUS, there is no response from the server. Therefore, clients will be confused. They are unable to distinguish between an unimplemented condition and a syntax error.

Why can this PR be safely merged?

We have only added the expected handling for unimplemented command types, without modifying any existing functionality. Therefore, our PR can be safely merged without affecting compatibility with actual clients.

We totally respect the priority: Real-world client compatibility > Theoretical RFC compliance, and are more than happy to assist in improving RFC compliance based on this foundation.

Thank you for your attention, and we look forward to your response : )

@cla-bot
Copy link

cla-bot bot commented Dec 11, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

src/modbus.c Outdated
// fprintf(stderr, "FIXME Not implemented\n");
// }
// errno = ENOPROTOOPT;
// return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented out code should be removed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhei Thank you for your reminder and prompt response. We have updated the commit 8853d32

src/modbus.c Outdated
MODBUS_EXCEPTION_ILLEGAL_FUNCTION,
rsp,
TRUE,
"FIXME Not implemented: 0x%0X\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we here know what function call is not implemented, I would use a human readable string eg. "READ EXCEPTION STATUS (0x07)" (or maybe re-use the libraries "MODBUS_FC_READ_EXCEPTION_STATUS") in the debug output, rather than only the numeric function id.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhei Thank you for your reminder and prompt response. We have updated the commit 8853d32

@cla-bot
Copy link

cla-bot bot commented Dec 28, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

src/modbus.c Outdated
rsp,
TRUE,
"FIXME Not implemented: READ EXCEPTION STATUS (0x07)\n",
function);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function argument is not needed anymore. We can drop it.
I also recommend to squash all the commits into a single one and then force push to this branch.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhei Thank you for your suggestion.

We have squashed all the commits into a single one and force-pushed to this branch.

remove comments and update info

remove the function argument
@cla-bot
Copy link

cla-bot bot commented Dec 28, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

Copy link
Contributor

@mhei mhei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested, but LGTM.

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.

A violation regarding the specifications for the Read Exception Status.

3 participants