To set RI pin as input pin:
- you need to first send an AT command: AT!RIOWNER=1
- after that you can control the RI in linux console:
echo RI > /sys/class/gpio/export
echo in > /sys/class/gpio/gpioRI/direction
cat /sys/class/gpio/gpioRI/value
In addition, I found that you can read the RTS pin status by AT command:
AT!entercnd=“A710”
AT!bsgpio?6
For setting the CTS pin, you can use ioctl():
int arg;
if (ioctl(fd1, TIOCMGET, &arg) == -1)
{
LE_DEBUG("ERROR: %s", strerror(errno));
}
if (level)
arg |= TIOCM_RTS;
else
arg &= ~TIOCM_RTS;
if (ioctl(fd1, TIOCMSET, &arg) == -1) {
LE_DEBUG("ERROR: %s", strerror(errno));
}