Skip to content
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

Missing documentation of errno values corresponding to Modbus exception codes #733

Closed
kyllingstad opened this issue Jan 5, 2024 · 2 comments · Fixed by #758
Closed

Missing documentation of errno values corresponding to Modbus exception codes #733

kyllingstad opened this issue Jan 5, 2024 · 2 comments · Fixed by #758

Comments

@kyllingstad
Copy link
Contributor

libmodbus version

e6b71a8 (which is the tip of master at the time of writing)

Description

The libmodbus documentation does not specify how one can obtain information about Modbus exception codes returned by a server upon a failed read or write operation.

Actual behavior if applicable

By reading the source code, I've discovered that libmodbus does in fact set errno to codes corresponding to the Modbus exception codes, such as EMBXILFUN etc. However, as far as I can tell, this is not mentioned anywhere in the reference documentation. For example, the reference page for modbus_read_registers() lists EMBMDATA as the only error code (which is an internal libmodbus error and not a Modbus exception).

Expected behavior or suggestion

Ideally, each function reference page should list all possible errno values, or at least the non-standard ones.

At minimum, the Error handling section of the front page should describe in general terms how Modbus exception codes are handled, what the corresponding constants are called, and which functions may return them.

@kyllingstad kyllingstad changed the title Missing documentation of errno value corresponding to Modbus exception codes Missing documentation of errno values corresponding to Modbus exception codes Jan 5, 2024
@kyllingstad
Copy link
Contributor Author

I'd be happy to draft the minimal description I suggested at the end and submit a PR if this is desirable.

@stephane
Copy link
Owner

Yes please!

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 a pull request may close this issue.

2 participants