Auto-baud detection

Hi Ho Silver silver at xrtll.uucp
Wed Oct 17 22:52:15 AEST 1990


   I have to write a program which needs to be able to detect at what speed
an inbound modem connects and change to that baud rate, then read some data
and detect when the modem hangs up.  It must do this repeatedly and must do
it flawlessly, as the client for whom this is to be written will use it for
their livelihood.  It must also work with a pre-existing protocol, so I can
not require them to send a series of breaks and a login sequence so that it
can be done by getty.

   I've tried a program which does the following:

while (true) do
   read a line from the modem
   print it on the screen
   if it's a CONNECT message then
      read the speed from the message
      run stty to change the port's speed
   endif
done

   It doesn't seem to be able to change the port's speed, and of course it
shows garbage until the next time I try connecting at whatever baud rate I
set the port at.  In fact, I've tried running stty [options] </dev/ttyh27,
where [options] could be a baud rate or a series of flags or whatever, and
it only affects the port when it's enabled; as soon as I disable the port,
it goes back to its prior settings.

   Any ideas?
-- 
HI ROGER |Nikebo says "Nikebo knows how to post.  Just do it."| silver at xrtll
_________|-----------------------|_______________|------------|_____________
yunexus!xrtll!silver (L, not 1)  | Hi Ho Silver  | costing the net thousands
Silver:  Ever Searching for SNTF |i need a grilf | upon thousands of dollars



More information about the Comp.unix.xenix.sco mailing list