Chen, Did you make any progress about this?
I connected a max485 to the UART of a wr703n and plan to use the gpio8 as rts line.
My program start like so:
ctx = modbus_new_rtu("/dev/ttyATH0", 9600, 'N', 8, 2);
modbus_set_debug(ctx, 1);
modbus_set_slave(ctx, 103);
modbus_rtu_set_serial_mode(ctx, MODBUS_RTU_RS485);
modbus_rtu_set_rts(ctx, MODBUS_RTU_RTS_DOWN);
modbus_rtu_set_custom_rts(ctx, csetrts());
All works when I compile on my linux box. However when I cross compile it with the OpenWRT SDK I get the following error:
modbus-rtu.c: In function 'modbus_rtu_set_serial_mode':
modbus-rtu.c:916:31: error: 'TIOCSRS485' undeclared (first use in this function)
if (ioctl(ctx->s, TIOCSRS485, &rs485conf) < 0) {
Should I set HAVE_DECL_TIOCM_RTS = 0 in config.h?
How can I get TIOCSRS485 properly declared otherwise?