Hi,
I'm writing a small piece of code to synchronize the clock of my Sun
UltraSparc 1 running Solaris 2.5.1 to a GPS receiver. The GPS receiver
sends a short ASCII string with a timestamp (every second), and about
0.5 seconds later it sends a very short pulse on another line (CTS/RTS,
I think). Problem is, how do I make the machine detect the changing
state of the line? I've tried a quick-and-dirty approach of polling the
line continuously, like this:
ioctl(link, TIOCMGET, &oldbit);
do
ioctl(link, TIOCMGET, &bit);
while (bit == oldbit);
but this doesn't work very well; the pulse is so short that the program
skips a pulse every now and then. Ideally, I would want the system to
send my program a signal when the pulse arrives. Alternatively, I would
like a flag to be set when the sync line changes state -- and NOT
cleared when the sync line goes low again. Is there a simple (and
preferably standard) way to do this? I've looked through lots of
ioctl/termios stuff, but haven't found anything so far. Can anyone give
me a nudge in the right direction?
(Please answer both by news and mail -- our newsserver is less than 100%
reliable...)
--