Altera_Forum
Honored Contributor
20 years agoioctl
In my application I'm using the JTAG UART as STDIO and one UART. The UART communicates with another application and the JTAG UART is used for service. My problem is that if there is no NIOS2-terminal connected, strings which are send over the JTAG UART are collected in the output buffer of the JTAG UART. Communication functions only as far as the JTAG buffer is not full.
The NIOS2 processor reference handbook tells me to call the ioctl() function with the parameter TIOCGCONNECTED ( see page 9-10) to see the JTAG UART is connected, but the function seems not to work. May be I make a mistake. Here is my source code: int jtag = 99; ioctl(STDIN_FILENO, TIOCGCONNECTED, &jtag); After the function call jtag should be 0 if the JTAG Port is not connected and 1 it is connected. After compilation no error is displayed, but it doesn't work. Has anybody an idea ?