Hi,

On 2010.05.12 16:04, Przemysław Czerpak wrote:
I has a code that seems does not fit under the new code. I have a
simple button (well, there is a RS-latch to avoid contact bouncing)
and I need to record time when the button is pressed. Button is
connected to DSR (or CTS), so I need some way to monitor this
register and obtain some kind of "interrupt" on delta DSR (or CTS).
I do this using SetCommMask() and WaitCommEvent() under Win32. Is it
possible to have some multiplatform way to get this functionality?

I'm afraid it will be hard to implement it for all platforms.
It needs direct hardware access to set interrupt on DSR (or CTS) line
...
I do not see
any way to make implement it for POSIX systems using termios.
Such extension had to be implemented in non standard way sometimes
even using root privileges.

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));
and use select(,,, &efds). After select returns you can check the new state of lines and decide which lines was changed.

So, what could be an effective way to implement a simple button on RS232 DSR pin? I still could not imagine that polling MSR every 0.01 second is the recommended way...


Regards,
Mindaugas
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to