I encountered the problem of stopping the show when developing an interface application for the USB-RS422 converter module.
I need to get UART error counters for cropping, overflow, parity and interrupt errors. But the ioctl call always returns -1, and the counter values ββfrom the extracted structure jump to very large numbers.
The code I use to retrieve the counters is as follows:
struct serial_icounter_struct counters; int ret = ioctl(portDescriptor, TIOCGICOUNT, &counters);
To install portDescriptor, I use similar code for:
int portDescriptor = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY); struct termios new_port_settings;
Sometimes we also need to enable flow control or parity, for example.
new_port_settings.c_cflag = new_port_settings.c_cflag | CRTSCTS;
I tried the code on Ubuntu 11.10 32bit and on SLIS11 SP1 64bit, as with the FTDI_SIO kernel module.
Does anyone know of any problem using TIOCGICOUNT, or am I doing something wrong?
Thank you in advance for your help! Edward
source share