[comp.os.minix] PC Minix Serial Ports

seb3@gte.com (Steve Belczyk) (02/09/91)

Hi there.  I'm running PC Minix with Bruce's 386 changes.  I'm having
trouble getting the serial lines to work well with modems:

- When a caller logs out, Minix doesn't drop carrier, it just gives
  another login prompt.

- If a caller drops carrier in the middle of a session, Minix doesn't
  know about it.  The next caller picks up the session right where the
  last caller left off.

I looked through the documentation and a fair amount of the code but I
couldn't find anything obvious.  Hopefully I just have things set up
incorrectly.  Any help sure would be appreciated!

Steve Belczyk   CIS: 75126,515    BBS: +1 508 664-0149 (2400 bps)
seb3@gte.com    GEnie: sbelczyk   UUCP: {harvard,vaxine}!bunny!seb3

kevin@nuchat.sccsi.com (Kevin Brown) (02/10/91)

In article <10561@bunny.GTE.COM> seb3@gte.com (Steve Belczyk) writes:
>Hi there.  I'm running PC Minix with Bruce's 386 changes.  I'm having
>trouble getting the serial lines to work well with modems:
>
>- When a caller logs out, Minix doesn't drop carrier, it just gives
>  another login prompt.
>
>- If a caller drops carrier in the middle of a session, Minix doesn't
>  know about it.  The next caller picks up the session right where the
>  last caller left off.
>
>I looked through the documentation and a fair amount of the code but I
>couldn't find anything obvious.  Hopefully I just have things set up
>incorrectly.  Any help sure would be appreciated!

I've been asking basically the same thing.  In looking at the serial device
driver code, it looks like there is ZERO support for DTR (the line is kept
high all the time).  And it also looks like there is zero support for DCD.

So to solve your first problem, you're either going to have to (a) modify
the driver and the file system to support DTR and have a driver program
fork/exec a getty on the line, wait for the child's death, and then drop
DTR, or (b) you're going to have to write the driver program to understand
your modem so that it will get your modem into command mode and cause it to
hang up.  I suppose you could also implement DTR dropping when DCD goes
away, but that leads to the second problem...

Your second problem is, I think, more complex.  Basically, you're going to
have to implement (a) DCD detection in the serial driver, and (b) SIGHUP
generation when you see DCD go away.  I don't know how to do either (though
the code in tty.c makes it look like you can do a cause_sig() if you know the
process group associated with the terminal.  I'm not sure how to implement
this right, though.  It looks like the tty driver only deals with the
serial port via interrupts, and currently that is used for incoming and
outgoing character I/O only.  This would have to be modified for DCD status
change).

So while I'm not sure about how to handle SIGHUP generation, I have some
idea.  But I'm completely stumped about DCD line status detection.  I
don't see any clues at all about it in the serial driver.  Anyone know how
to do DCD detection on the IBM rs232 ports?  The only modem status bit defined
in the serial driver is CTS (0x10).  Could someone post a complete listing
of the modem status bits in the serial port's status register?

>Steve Belczyk   CIS: 75126,515    BBS: +1 508 664-0149 (2400 bps)
>seb3@gte.com    GEnie: sbelczyk   UUCP: {harvard,vaxine}!bunny!seb3


--
Kevin Brown						Disclaimer: huh?
nuchat!kevin@uunet.uu.net				csci31f7@cl.uh.edu 

Minix -- the Unix[tm] of the 90's.  System V -- the Multics of the 90's.  :-)

wahlsten@elixir.lne.kth.se (Torbjvrn Wahlsten) (02/11/91)

In article <1991Feb10.095318.6603@nuchat.sccsi.com> kevin@nuchat.sccsi.com (Kevin Brown) writes:
>... Anyone know how
>to do DCD detection on the IBM rs232 ports?  The only modem status bit defined
>in the serial driver is CTS (0x10).  Could someone post a complete listing
>of the modem status bits in the serial port's status register?

I've seen the problem before, but i've never tried to connect a modem to
Minix myself.

In either case, the modem-status bits are (b7 -> b4) DCD, RI, DSR, and CTS.
(Please, note that they are all active high).
Bits 3 to 0 are the delta-values (state-change) of the bits 7 to 4. Each
delta-bit will be set whenever a change is noted in the corresponding
status-bit (e.g. DCD: Bit 3 (Delta) corresponds to b7 (Status)).
The only exception is b2 (RI-Delta) which is set only whenever RI goes
from high to low state.

If Minix is already catching interrupts when CTS is changing state,
you will only need to add code to see wheter it was CTS or DCD that
caused the interrupt.

Good Luck!

/Jorgen Wahlsten
wahlsten@lne.kth.se