# using getty with serial port consoles



## kilowatt (Apr 5, 2001)

Hey, on my linux box I've got this line in my /etc/inittab
S2:12345:respawn:/sbin/getty ttyS0 DT19200 vt300

Now, I know mac os x is a bit different, but here's what I've figured out:
/sbin/getty in linux is like /usr/libexec/getty
(except that I can't figure out how to use it)
and, /etc/inittab is kinda like /etc/ttys
(except I can't figure it out, either).

Basically, I want a login prompt on my dumb terminal hooked up to my /dev/tty.modem port (via a null-modem cable). Does anyone know how to do this on mac os x? I don't mind if it doesn't start osx with that, I guess I really just want the correct useage for /usr/libexec/getty (yeah, I read the man page, etc etc)

Thanks!


----------



## scruffy (Apr 5, 2001)

I don't know how to do this, but take a look at macaddict - Brian Sammis has got some sort of terminal connected to an OS X box.

I sure would love to get an old vt100 and do this for the geek value, but I have a post-serial-port mac, and no modem on it...


----------



## kilowatt (Apr 7, 2001)

Did you mean the article at this location:

http://www.macaddict.com/content/news/2001/04/03/29468

I read it, and now I have confidence! Thanks.


PS: My terminal is a Motorola TM3100, form 1978, I think. I got it for $10 at the surplus store at the university of cincinnati. I've had it connected to my intel redhat linux computer for a long time, but, seeing how os x doesn't appear to have 'virtural consoles' (on rh, I can press ctl-alt-Fn where n is 1 to 7, and get a new 'screen' of either cli or gui), I guess I'll be moving the terminal. (I think you can use modems, too... that could be interesting). When I get it hooked up, I'll send in a photo.


----------



## kilowatt (Apr 7, 2001)

Well, I got the serial console up and running! Here's how:

become root (su)
go to /etc (cd /etc)
edit the file "ttys" (pico ttys)
You'll see a line "tty07 "/usr/libexec/getty std.9600" unknown off secure""
Add this line under it "tty.printer "/usr/libexec/getty t9600" vt100 on secure"

the tty.printer is the printer port (you can use tty.modem) and the t9600 part refers to a description found in /etc/gettytab (it sets the speed and such). the vt100 part tells it you have a vt100 or compatable (vt220, vt300, etc should work, too). The 'on' part enables the console. And 'secure' means that it will only be activated in 'secure' mode (ie; non-single-user modes).

Of course, you do need a null-modem cable for this to work. And, I had to reboot.
BTW, if you are having trouble with all this try this stuff:

stty -f /dev/tty.modem    that will tell you the speed and parity of the port. See 'man stty' for information on how to use it.
If you want to test your null-modem cable and port speed, become root and type something like this:
ls > /dev/tty.modem   (that prints the output of 'ls' to the port /dev/tty.modem)

Now, the real question: will making those tty0x lines (top of the /etc/ttys file) from 'off' to 'on' allow you to press ctrl-alt-fn to switch between consoles as on other linux systems?

I hope yall enjoy this!


----------



## fletch (Feb 8, 2002)

I have tried your method with my Keyspan USb-Serial but have had no luck.

In /Dev it lists the ports as tty.KeyUSA281822.1 and .2.  

Thanks,

Pete


----------



## kilowatt (Feb 11, 2002)

Well, I don't have any usb to serial adaptors to test this with, but here are a few ideas I have:

1) make certain you are using a Null-Modem cable. These cables switch the transmit and revieve wires, as well as handshaking. Without one, its pretty much useless.

2) Check to see that you have the right speed selected on the dumb terminal or terminal-emmulating pc. Offten you will simply see nothing unless it is correct

3) Here's an easy way to check your null modem cable:

```
%date > /dev/tty.KeyUSA281822.1
%date > /dev/tty.KeyUSA281822.2
```
As you may have guessed, this echo's the date to each serial port.

4) Check your console logs, dmesg, and /var/log/system.log for any getty errors. Also, I believe that in 'top' you should see some process like getty using the tty's you assigned it to.

Good luck dude, I hope you get it working because it is VERY cool once you do. Oh, and its also possable to use a modem in this fassion so you can dial in and use a shell. Cool, huh?


----------



## Gabriel Camiro (Feb 14, 2002)

Use GUI App "ZTerm"  ! It rocks.  I use it to configure Switches and Cisco Routers.


----------



## fletch (Feb 16, 2002)

I was unable to get it work with the Keyspan Adapter, but I installed the CubePort from Griffin in my Cube and now my Circa 1979 Atari 800 can connect to Darwin.  The only issue I seem to be having is with screen size.

The old Atari is only able to display 40 columns x 23 rows (I think).  Is there away to set Darwin's output to 40 column mode?  If not I can live with it, but man is this cool!

Pete


----------



## kilowatt (Feb 19, 2002)

DUDE!!!
Thats exactly what I wanted to do with my atari! I was going to snap a picture of the atari pluged into my 1960's black and white tv, sitting next to my G4. then I was going to send it into macaddict.  But you beat me to it - so go for it! send that sucka in!

screensize...

```
tty.printer "/usr/libexec/getty std.19200"      vt100   on      secure
tty.modem "/usr/libexec/getty std.19200"        vt100   on      secure
```

ok so the line 'vt100' defines the screen size and stuff. The 'vt100' refers to an entry in a file called 'termcap'. Under linux (and I think FreeBSD as well), this file is in /etc/termcap.

On Mac OS X its in /usr/share/misc/termcap.

just do a:
cat /usr/share/misc/termcap | more
to browse the file. Now I know the file looks pretty messed up - almost as bad as FreeBSD 4.5's /etc/sudoers file .

Basically, you are looking for an entry that describes your atari's terminal well. The alternative is to go looking on the internet for a pre-made termcap entry (or you could allways write one yourself - see man termcap).

However, it looks like this could turn out to be really easy - try duplicating the vt100 entry, and changing 'co#80:li#24:' to fit your needs. Just a guess on that one, but it sounds pretty close.

Ain't this stuff cool!?!

PS: SEND A PICTURE!!! Please post one or something, I gotta see this one!


----------



## kilowatt (Feb 19, 2002)

ooh, hey, there is an entry for 'atari' in the file! but it looks like its a bit too big still... maybe duplicate it, name it 'myatari' and edit the co and li entries?! 

I can't wait to see that photo, btw - you are going to snap one right? 

cheers


----------



## fletch (Feb 19, 2002)

I will certainly get you a picture.  I'll try your suggestions.  I'm no UNIX god so bear with me if I encounter some issues I may need your help with.

Thanks dude!

Pete


----------

