Commit 3803f89e6e8aac951a24fd2b3f0df455494ef63b

Authored by Stéphane Raimbault
1 parent 76284c17

Extract serial_mode attribute from platform tests

Bonus side effect: the integer isn't present anymore when TIOCSRS485
isn't supported on non Win32 platforms.
src/modbus-rtu-private.h
... ... @@ -77,6 +77,8 @@ typedef struct _modbus_rtu {
77 77 #else
78 78 /* Save old termios settings */
79 79 struct termios old_tios;
  80 +#endif
  81 +#if HAVE_DECL_TIOCSRS485
80 82 int serial_mode;
81 83 #endif
82 84 } modbus_rtu_t;
... ...
src/modbus-rtu.c
... ... @@ -698,10 +698,13 @@ static int _modbus_rtu_connect(modbus_t *ctx)
698 698 if (tcsetattr(ctx->s, TCSANOW, &tios) < 0) {
699 699 return -1;
700 700 }
  701 +#endif
701 702  
  703 +#if HAVE_DECL_TIOCSRS485
702 704 /* The RS232 mode has been set by default */
703 705 ctx_rtu->serial_mode = MODBUS_RTU_RS232;
704 706 #endif
  707 +
705 708 return 0;
706 709 }
707 710  
... ...