Setting Up A Wyse Terminal On Linux with 'systemd'

    These are the steps I used to configure a Wyse terminal to bring up a "login:"
    prompt using a USB RS232 serial device (a TRENDnet TU-S9 I bought on Amazon in 2014 for $10.00).





CABLE WIRING

I went with a minimal "3 wire" cable between the terminal and computer. Just about any low voltage cable with at least three conductors should work; an old network cable (CAT5, CAT5E, etc) or some multiconductor wire available from HomeDepot's wiring department should work. The back of the Wyse has a female DB25 connector. The back of the TRENDnet TU-S9 has a male DB9 connector. So the cable needs a male DB25 at one end, and a female DB9 at the other. Wiring of the cable: DB25 Male DB9 Female PIN# PIN# ----------- -------- 2 <-----------> 2 3 <-----------> 3 7 <-----------> 5 All the other pins can be left disconnected.

TERMINAL CONFIGURATION

When configuring a serial terminal, it's important both terminal and the computer agree on the baud rate settings. I chose 19200 baud; slower speeds are too slow IMHO for interactive programs like text editors and games, faster speeds some older terminals can't handle, dropping characters, or are more suceptible to noise interference over long serial cable runs. On the terminal, go into the Setup menu (hit Shift-Select), and configure: * Baud rate to be 19200 * no parity * 8 bit data * 1 stop bit * Terminal emulation to be vt100 or vt220.

UNIX CONFIGURATION

In my case I have a Scientific Linux 7.7 machine, and used a USB RS232 Serial dongle ("Trendnet TU-S9") which you can just plug in, and linux automatically recognizes it, and creates /dev/ttyUSB0 for it. No special drivers needed. Using this to control a Wyse terminal: Plugged the USB device into the MAIN input on the terminal with a NULL MODEM: USB Connection Serial Cable __ _______________________ / \ / \ ................. ............ .................. ............... : : : : : : : : : Wyse Terminal : : Computer :--->: Trendnet TU-S9 :----->: DB9-to-DB25 :----->: (MAIN Input) : :..........: :................: :.............: :...............: Male Female Male Female DB9 DB9 DB25 DB25 (Seems 57600 is too fast for the terminal.. perhaps I could have made it work by enabling XON/XOFF on both Wyse and unix stty settings.. didn't bother, 19200 is fast enough for my needs) I did some simple tests to write to the terminal BEFORE enabling agetty (so that my tests don't "fight" with agetty over access to the serial port): stty -a -F /dev/ttyUSB0 # check current settings, verify 19200 baud stty -F /dev/ttyUSB0 19200 # set baud rate to 19200 (this was the default) ls -la / > /dev/ttyUSB0 # send an 'ls' listing to the terminal ..this should show an 'ls' listing on the terminal screen. If it doesn't, check your cable wiring and make sure the terminal is configured correctly. If you have an RS232 breakout box, you should see a red light for pins 2 and 3. To test reading from the terminal, you can use: cat -u /dev/ttyUSB0 ..and then type a line on the wyse keyboard and hit ENTER, the line you typed should appear on the unix terminal as soon as you hit ENTER. If you want to see keys as you type them on the unix side, you need to disable the 'icanon' flag with stty, e.g. stty -F /dev/ttyUSB0 -icanon ..then re-execute the above 'cat -u' command, and you should now see characters appear as you type on the wyse, without having to hit ENTER.

CONFIGURING 'agetty'

To get a "login:" prompt on the terminal, configure an 'agetty' process to manage the port using systemd: 1) cp /usr/lib/systemd/system/serial-getty@.service /etc/systemd/system/getty.target.wants/serial-getty@ttyUSB0.service 2) vi /etc/systemd/system/getty.target.wants/serial-getty@ttyUSB0.service Changed this line in the file so it uses 19200 baud: BEFORE: ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM AFTER: ExecStart=-/sbin/agetty --keep-baud 19200 %I vt100 ----- 3) Tell systemd to start using the changes: systemctl daemon-reload systemctl start serial-getty@ttyUSB0.service systemctl enable serial-getty@ttyUSB0.service 4) You should now see 'agetty' started by systemd running in the process table: ps aux | grep agetty This should show a line something like: root 25198 0.0 0.0 110108 864 ttyUSB0 Ss+ 09:08 0:00 /sbin/agetty --keep-baud 19200 ttyUSB0 vt220 ^^^^^^^ ^^^^^ ^^^^^^^ ^^^^^ Our tty | | | | | Default terminal emulation | Our tty | Desired baud rate 5) You should see a 'login' prompt on the wyse by hitting ENTER a few times until you see a proper prompt. You should then be able to login as a normal user. 6) If you want to be able to login as 'root', you have to add "ttyUSB0" to the /etc/securetty file.