x86_64, but the issue should affect all other archs too
Description
_modbus_rtu_connect() used to have a big switch-case to convert numeric baud rates to the symbolic constants from termios.h used for speed_t in cfgetispeed/cfgetospeed (B1200, B2400, etc.).
Commit fa2079859d82965c5be417cc3985df141d720e0a removed this code with a message Remove constraints on baud rate values, but it was not a "constraint", it was a necessary conversion. cfgetispeed/cfgetospeed can only accept the BXXXX symbolic constants, and the code as shown in the documentation is now invalid.
Actual behavior if applicable
Opening a RTU context fails with "22 Invalid Argument".
Expected behavior or suggestion
The code should work as before, converting the numbers into constant.
With the current code, passing the BXXXX constants to modbus_new_rtu would probably work, but that would be changing the API and also it is non-portable.
libmodbus version
3.1.9
OS and/or distribution
Linux
Environment
x86_64, but the issue should affect all other archs too
Description
_modbus_rtu_connect()
used to have a big switch-case to convert numeric baud rates to the symbolic constants fromtermios.h
used forspeed_t
in cfgetispeed/cfgetospeed (B1200, B2400, etc.).Commit fa2079859d82965c5be417cc3985df141d720e0a removed this code with a message
Remove constraints on baud rate values
, but it was not a "constraint", it was a necessary conversion. cfgetispeed/cfgetospeed can only accept the BXXXX symbolic constants, and the code as shown in the documentation is now invalid.Actual behavior if applicable
Opening a RTU context fails with "22 Invalid Argument".
Expected behavior or suggestion
The code should work as before, converting the numbers into constant.
With the current code, passing the BXXXX constants to
modbus_new_rtu
would probably work, but that would be changing the API and also it is non-portable.