| 1 | # modbus_enable_quirks |
| 2 | |
| 3 | ## Name |
| 4 | |
| 5 | modbus_enable_quirks - enable a list of quirks according to a mask |
| 6 | |
| 7 | ## Synopsis |
| 8 | |
| 9 | ```c |
| 10 | int modbus_enable_quirks(modbus_t *ctx, unsigned int quirks_mask); |
| 11 | ``` |
| 12 | |
| 13 | ## Description |
| 14 | |
| 15 | The function is only useful when you are confronted with equipment which does |
| 16 | not respect the protocol, which behaves strangely or when you wish to move away |
| 17 | from the standard. |
| 18 | |
| 19 | In that case, you can enable a specific quirk to workaround the issue, libmodbus |
| 20 | offers the following flags: |
| 21 | |
| 22 | - `MODBUS_QUIRK_MAX_SLAVE` allows slave addresses between 247 and 255. |
| 23 | - `MODBUS_QUIRK_REPLY_TO_BROADCAST` force a reply to a broadcast request when the |
| 24 | device is a slave in RTU mode (should be enabled on the slave device). |
| 25 | |
| 26 | You can combine the flags by using the bitwise OR operator. |
| 27 | |
| 28 | ## Return value |
| 29 | |
| 30 | The function shall return 0 if successful. Otherwise it shall return -1 and set |
| 31 | errno. |
| 32 | |
| 33 | ## See also |
| 34 | |
| 35 | - [modbus_disable_quirks](modbus_disable_quirks.md) |