Using DIGI TS 16. Redhat EL6. dgrp-1.9-30.x86_64. Cannot set custom baud rate. Ioctl calls return -1. Using ioctl calls with a non-DIGI usb to serial (RS422) device (code bellow) works fine. Trying to convert to use DIGI. Does DIGI have special ioctl call definitions for setting custom baud rate?
/* Setup a Custom Divisor Baud Rate */
int rate=11520; //ICD says 12Kbps
struct serial_struct serinfo;
serinfo.reserved_char[0] = 0;
ioctl(xfd, TIOCGSERIAL, &serinfo);
serinfo.flags &= ~ASYNC_SPD_MASK;
serinfo.flags |= ASYNC_SPD_CUST;
serinfo.custom_divisor = (serinfo.baud_base + (rate / 2)) / rate;
if (serinfo.custom_divisor < 1) {
serinfo.custom_divisor = 1;
}
ioctl(xfd, TIOCSSERIAL, &serinfo);
int speed = 0;
struct termios options;
fcntl(xfd, F_SETFL, 0);
tcgetattr(xfd, &options);
cfsetispeed(&options, speed ?: B38400);
cfsetospeed(&options, speed ?: B38400);
cfmakeraw(&options);
options.c_cflag &= ~CRTSCTS;
options.c_cflag |= CS7|PARENB|PARODD|CREAD|CLOCAL;
tcsetattr(xfd, TCSANOW, &options);
Help?!