Hi
I’m trying to use legacy serial port code within a Legato app. I need to be able to control the state of the CTS OP pin (on a PC or USB tty this would be RTS out).
ctx->s is a FILE pointer to /dev/ttyHS0
static void set_OpLocal_cbh(modbus_t *ctx , int on)
{
int fd = ctx->s;
int flags;LE_INFO("CTS set : %d", on); LE_INFO("device %s", ctx->device); ioctl(fd, TIOCMGET, &flags); if (on) { flags |= TIOCM_CTS; } else { flags &= ~TIOCM_CTS; } ioctl(fd, TIOCMSET, &flags);
}
HS0 is opening fine - other code is writing and reading from it OK.
The code above is running
But set_OpLocal_cbh() isn’t able to set the state of the CTS pin (it’s stuck high).
I also tried TIOCM_RTS just in case CTS isn’t really it’s name
Any ideas?
- should this work?
- any workarounds to manually drive the CTS whilst HSO is opened by the app?