|
@@ -704,10 +704,10 @@ static int _modbus_rtu_connect(modbus_t *ctx)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-#if defined(HAVE_DECL_TIOCSRS485)
|
|
|
int modbus_rtu_set_serial_mode(modbus_t *ctx, int mode)
|
|
|
{
|
|
|
if (ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_RTU) {
|
|
|
+#if defined(HAVE_DECL_TIOCSRS485)
|
|
|
modbus_rtu_t *ctx_rtu = ctx->backend_data;
|
|
|
struct serial_rs485 rs485conf;
|
|
|
memset(&rs485conf, 0x0, sizeof(struct serial_rs485));
|
|
@@ -728,6 +728,13 @@ int modbus_rtu_set_serial_mode(modbus_t *ctx, int mode)
|
|
|
ctx_rtu->serial_mode = MODBUS_RTU_RS232;
|
|
|
return 0;
|
|
|
}
|
|
|
+#else
|
|
|
+ if (ctx->debug) {
|
|
|
+ fprintf(stderr, "This function isn't supported on your platform\n");
|
|
|
+ }
|
|
|
+ errno = ENOTSUP;
|
|
|
+ return -1;
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/* Wrong backend and invalid mode specified */
|
|
@@ -744,7 +751,6 @@ int modbus_rtu_get_serial_mode(modbus_t *ctx) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
void _modbus_rtu_close(modbus_t *ctx)
|
|
|
{
|