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
dangole opened this Issue Apr 25, 2011 · 3 comments

Comments

Projects
None yet
3 participants
@dangole

dangole 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 stephane closed this in 541804b Nov 8, 2012

@stephane

This comment has been minimized.

Show comment
Hide comment
@stephane

stephane Nov 8, 2012

Owner

Years are months these days 🕙

Owner

stephane commented Nov 8, 2012

Years are months these days 🕙

mk8 added a commit to mk8/libmodbus that referenced this issue Nov 12, 2012

@chrisgj198

This comment has been minimized.

Show comment
Hide comment
@chrisgj198

chrisgj198 Apr 10, 2013

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.

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

This comment has been minimized.

Show comment
Hide comment
@stephane

stephane May 2, 2013

Owner

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

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