How to LOGIN to a MacBook Using the USB Serial Port and a Terminal

VT-100 Terminal Board (Geoff Graham-Peter Hizalev software/hardware design), with VGA monitor & PS-2 keyboard, logged into MacBook on USB serial port, running "top" to display most active sessions.


   Login to USB Serial Port - using a VT100 or any Terminal  -   Apr. 9, 2020
   [Updated: May 9, 2020]
   ----------------------------------------------------------------------------------------------------

   You can use a USB serial port, to LOGIN & access a MacBook. This is useful
   for testing a VT-100 serial board, and also if you want to have your
   Z-80 NorthStar computer control your MacBook "bash" session.

   You have to create a file called: serialconsole.plist
   with the text shown below.  You may need to be root on the Mac to do this.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0/EN"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>serialconsole</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/libexec/getty</string>
        <string>vt100.115200</string>
        <string>cu.usbserial-AC00HEIO</string>        
    </array>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>



   MacOSX uses these .plist files.  The are just XML parameter stuff, and
   you create "serialconsole.plist" in this directory:

     /Library/LaunchDaemons/

   The serial port running thru the USB port on the MACbook, is called
   by the string:  cu.usbserial-AC00HEIO  
   on MCL's MACbook.  It will be a different name on a different MACbook.

   The USB driver, which creates the "cu.usbserial-AC00HEIO" device, gets
   invoked and the device gets created in "/dev" directory, when a USB
   device is plugged in.  You should be able to do a "ps -aux" (to see
   all running sessions), or do a "ls -l" of the "/dev" directory to see
   what the USB device is called on your MacBook.  Each MacBook seems to
   name the device with a different hex string.  You need to create your
   .plist file with the name for the USB port on YOUR MacBook.  

   The "serialconsole.plist" file defines an application called: serialconsole
   and that program has these arguments:

           /usr/libexec/getty  - the tty program, uses: /etc/gettytab
           vt100.115200        - the place in gettytab where baudrate, parity,
                                 and other parms get set.
           cu.usbserial-AC00HEIO  - the USB serial port, created by the FTDI
                                    drive in MacOSX  (you need to use yours!)

   The config file:  /etc/gettytab

   has the definition info for the VT100 terminal that connects to the
   USB port.  (The VT100 "Terminal" is the little Geoff Graham board, used
   by the Z80 "NorthStar" SBC (Single Board Computer)).



   Edit to "/etc/gettytab" to get VT-100 serial port access to work:
   -------------------------------------------------------------------------------------------------------------

   (part of the contents of "gettytab" file are shown... )
   ( file inserted with vi command :r<filename>          )
#
# Parity defaults to even, but the Pc entry and all the `std' entries
# specify no parity.   The different parities are:
#     (none): same as even except -inpck instead of inpck for login.
#     ep:     getty will use raw mode (cs8 -parenb) (unless rw is set) and
#             fake parity.  login will use even parity (cs7 parenb -parodd).
#     op:     same as ep except odd parity (cs7 parenb parodd) for login.
#             op overrides ep.
#     ap:     same as ep except -inpck instead of inpck for login.
#             ap overrides op and ep.
#     np:     1. don't fake parity in getty.  The fake parity garbles
#                characters on non-terminals (like pccons) that don't
#                support parity.  It would probably better for getty not to
#                try to fake parity.  It could just use cbreak mode so as
#                not to force cs8 and let the hardware handle the parity.
#                login has to be rely on the hardware anyway.
#             2. set PASS8, giving cs8 -parenb -istrip -inpck.
#     np:ep:  same as np except inpck.
#     np:op:  same as np:ep except for parodd (but parodd is overridden).
#     np:ap:  same as np except istrip.
#
default:\
    :cb:ce:ck:lc:fd#1000:im=\r\nDarwin/BSD (%h) (%t)\r\n\r\n:sp#1200:
#
# --- MCL Hack! ---  from: github.com/mastmees/STM32F030F4-VGA/blob/master/STM32F030F4/Firmware/ChibTerm/readme_osx_serial_console
# --- set up the USB port for VT100 access as the device console.  Really!  Lets you use a Macbook like VAX or DECSystem 2020... :)
# vt100.115200:115200-baud:\
#    :np:sp#115200:cb:ce:ck:lc:im=\r\nDarwin/BSD (%h) (%t)\r\n\r\n:tt=vt100:
#
vt100.115200:38400-baud:\
    :np:sp#38400:cb:ce:ck:lc:im=\r\nDarwin/BSD (%h) (%t)\r\n\r\n:tt=vt100:
# --- End of Hack. Note that the active option here sets the Serial port to 38400 baud, default for VT-100 board ----
   (End of the inserted piece of "/etc/gettytab" file from MacBook Pro. )
   (As indicated, this is from URL:                                     )
   (  ===>    github.com/mastmees/STM32F030F4-VGA/blob/master/STM32F030F4/Firmware/ChibTerm/readme_osx_serial_console  )


   Starting the Serial-Port MacBook Session:
   --------------------------------------------------------------------------------------------

   To engage the USB port as a Serial Console for the MAC:

     As root:   

        launchctl load -F /Library/LaunchDaemons/serialconsole.plist

        launchctl start serialconsole


    To End:

        launchctl stop serialconsole

        launchctl unload -F /Library/LaunchDaemons/serialconsole.plist

    -----------

    Once logged into the Mac's USB port as a serial console, you can
    set the VT100 terminal characterisitcs, as follows:

      stty  rows 24
      stty  columns 80
      export LINES=24        (you can use 38 instead of 24, on VT100 board if you want)

    -----------

    On the VT100 emulator board (Peter Hizalev's Board, using Geoff Graham's
    code in the chip), can use either 24 or 38 display lines.  The 38 line
    option is useful, if you want to display a bunch of graphic-ish data on
    the VT100 monitor.

      To bring up Config-Screen on Geoff-Graham-VT100:   SHIFT-F12
      And then K to save, or J to discard.  (Note, you lose the
      VT100 display, if you invoke the SHIFT-F12 config. screen)

   ***** Update: Critical Tweak Needed *****

      If using the Geoff-Graham-VT100 (& Peter Hizalev's board from Tindie)
      you might have to INVERT SERIAL for (RS232).  I had to do this on my
      version of Peter's board. (Note; Peter Hizalev's board works fine -
      he sold me his early version which has VGA and Composite video, and
      it works great on the Z-80 and the MacBook.  Thanx Peter. )
      You can INVERT the RS232 serial link with option "F".  TO do:
             - (on the VT-100 board emulator attached keyboard)
                   SHIFT-F12
                        (brings up the config. screen)
             - Press "F"
             - Select option "2" to invert
             - Press "K" to save the changes (for the session).

      Remember, to connect to the MacBook or the Z-80, you need to have a
      "Null-Modem" cable in circuit between the VT-100 emulator board and
      the device you want to connect to.  Without doing the INVERT SERIAL
      option, I would get garbage characters, but once the INVERT SERIAL
      option was engaged, the link worked perfectly.  You can even run
      "top" on the VT-100 "terminal" and monitor your MacBook's operation
      in real-time.  You have a complete "bash" session, and /etc/gettytab
      lets the VT-100 session use some basic screen-addressing control
      codes.

      You can run VI on the VT-100 "terminal" session (board), and it seems
      to work, but badly. (I don't know the old keyboard-only up and down
      sequences - but if you do, it might be usable. Probably with some
      tweaks to the /etc/gettytab table, one might get it working fine.)

      This trick should also let you "dial-in" to a MacBook, if you have
      a phone-line modem.  Why do this?  Well, what if the internet is
      fully hacked, tapped and meta-monitored in the country where you
      live, but you still want to communicate with the world? Just dial-in
      to a remote MacBook, and run Kermit to upload/download files.  :)
      Of course, you'll need a modem for your VT-100 "terminal" as well.

    -------------------                            MCL, Apr. 9, 2020 / May 9, 2020