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

device field in modbus_param_t is too small #11

Closed
ghost opened this issue Apr 25, 2011 · 3 comments
Closed

device field in modbus_param_t is too small #11

ghost opened this issue Apr 25, 2011 · 3 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Apr 25, 2011

as already predicted in the comment modbus.h, the restriction of having only 16 bytes for the device name becomes a problem when using udev-created symlinks on Linux, as they tend to be way longer than 16 bytes.
a) Maybe it could always be 64 bytes, independently of the OS used?
b) Maybe it could even be a pointer to a string, thus allowing an arbitrary length of the device-name?
I'd vote for a), as it actually reduces complexity and most probably solves the problem for now.

@ghost ghost assigned stephane May 10, 2011
@stephane
Copy link
Owner

stephane commented Nov 8, 2012

Years are months these days 🕙

mk8 pushed a commit to mk8/libmodbus that referenced this issue Nov 12, 2012
@chrisgj198
Copy link

I am using version 3.0.1 on Ubuntu (installed using apt-get), and long device names still seem to cause failure.

When I called my device "/dev/tty-dat3018", then when modbus_new_rtu() was called, I got the error message:
"The device string has been truncated" and an error was returned, whereas when I shortened the name to "/dev/ttyMODBUS0", the program started working fine. Therefore it seems that 15 characters + NUL is ok, but 16 chars + NUL = Failure.

I hope that this problem is just due to the changes taking time to propagate to the Ubuntu distribution rather than another problem. For the moment I can just rename my devices to short names.

@stephane
Copy link
Owner

stephane commented May 2, 2013

The fix will be present in next v3.2.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants