On Wed, 12 May 2010, Mindaugas Kavaliauskas wrote: Hi,
> On 2010.05.12 16:21, Mindaugas Kavaliauskas wrote: > >I've very surprised :( I expected to be some way to wait for line change > >event in POSIX/UNIX/Linux. I just guessed that there is a way to make > >line change to emit error condition, ex., > >ioctl(fd, TIO_ERROR_ON_CHANGE, TIO_DSR)); > Looking to Wine source I found some text about TIOCMIWAIT, the sad > part of story is that it says: "TIOCMIWAIT is not adequate" and Wine > uses 10ms pooling to emulate Windows behaviour, see: > dlls/ntdll/serial.c:wait_for_event() Thanks for the hint, I'll look at it. > Google finds some samples of code that implements > ioctl( fd, TIOCMIWAIT, wait_mask ), > ex.: > http://www.linuxquestions.org/questions/programming-9/serial-port-programming-285597/ > http://www.dslreports.com/forum/r21801613-Linux-Interrupt-based-on-serial-port-pin The main problem with TIOCMIWAIT is that it does not respect modifications on inspected lines which appeared before you called this function. In some protocols it may even cause deadlock because you can freeze application waiting for event which come just before you called TIOCMIWAIT. Anyhow if it's acceptable then it can be used though it's also not well portable extension. It should work with modern Linux kernels though I do not know if all TTY devices supports it. For sure standard RS-232 serial ports should. I'll think about it and also about adding some other extensions which probably exists only in Linux, i.e. TIOCM_OUT1/TIOCM_OUT2/ TIOCM_LOOP or TIOCSERGETLSR. best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) [email protected] http://lists.harbour-project.org/mailman/listinfo/harbour
