The serial port handle is available in /dev and has the prefix cu, which stands for calling-unit. To access the serial port, this handle is just opened as an ordinary file. The opened serial port file descriptor also conforms to the TTY API for setting serial port specific settings like baudrate. This tutorial describes how to implement the simple serial port program in OS X in Swift. Serial Serial is a great Terminal Emulation Program with built-in driver support for most common USB to serial devices. So, if you can't find an OS X driver for your adapter (eg, Belkin), give Serial a try - available from the Mac App Store.
Requirements
Apr 27, 2013 Hi, Can anyone point me in the right direction for how to connect to my Catalyst Switch over console using OSX terminal. I've got my blue DB9 - RJ45, bought a USB - DB9, ensured the driver was installed and followed various peoples advice and have had no results what so ever. English horror story books pdf free download. Jun 23, 2017 Setting up a Serial Terminal with Mac. OS X. You have now established a serial communication with your board. You can interact with your board by entering common Linux commands. For a summary of useful commands, see Common commands for the Intel® Edison board.
You have assembled your Arduino* expansion board or your mini breakout expansion board, installed the appropriate drivers, and flashed the OS image (formerly called firmware).
Steps to Set Up a Serial Terminal
For more complete information about compiler optimizations, see our Optimization Notice.
Active1 year, 11 months ago
Background
I've got a Wyse WY-50 terminal here that, for various nolstagia and productivity reasons (really!), I'd like to connect to my Macbook and use as a login terminal. I'm using OSX 10.10 El Capitan.
The terminal itself has two ports on the back, one marked MODEM and one marked AUX. From the manual, normally the device you're connecting to uses the MODEM port, and another ancilliary device like a printer uses the AUX port. These are both DB25 ports.
The MODEM port is connected to my mac via a DB25-DB9 converter, and from there to the mac via a USB-DB9 adapter using a Prolific chipset.
I had to install a driver for the converter to become available. After that was done, I got two devices created in
/dev/ , those are cu.usbserial and tty.usbserial .
I followed the guide here to set up a LaunchDaemon Plist to spawn a
getty session attached to the terminal, since apparently you can't just either edit /etc/ttys or run getty by hand in modern OSXes.
The terminal itself is set to VT100 emulation mode at 19200 baud, with DTR flow control on receive and no flow control on send (the only option for send flow control is
XON/XOFF )
Difficulty
This setup has proven difficult to troubleshoot, since incorrect communication with the serial device tends to 'hang' it, requiring a reboot to become usable again.
In all cases, calls to
getty whether in a file or by hand were of the form /usr/libexec/getty std.19200 cu.usbserial
Anytime you see 'No output', this means the terminal was slient, showing nothing, and was unresponsive to keypresses.
From here, I tried the plist method by adding a file to
/Library/LaunchDaemons named console.plist with the following content:
After loading and running the job, the following things were tried, each time attempting to stop, edit, unload, reload, and run the job in order:
On another port
So, I can get basic communication if the computer is connected to the terminal by way of the AUX port. With settings as follows:
However, this results in a lot of garbage characters on the terminal screen. The login prompt itself is clean, but hitting return always generates a small amount of garbage. After logging in, this garbage tends to get concatenated to the end of commands, making the session almost unreliable and unusable.
With the settings as described above, here's an example of what I mean on the terminal output:
You can see some noise once the port is initialized, and then a 'clean' login display. I enter my username and press Return on the terminal keyboard. Rather than dropping down a line and prompting for a password, You see the
UTHx appear, and then the Password prompt on the same line.
Entering my password (which is properly not echoed) displays the 'last login' message, and then a completely trashed shell afterwards. It's almost as if linefeed characters are being mangled somehow.
If I press Ctrl+l on the terminal, the last line resets itself, and I see a clean prompt (not pictured). However, the garbage returns the next time I press return on the terminal. Fifa 12 download pc windows 10 free.
My terminal is set to
/bin/sh .
Another suggestion I read was to try using the
reset command to clear the display to known-good settings. Typing reset and hitting return gives me a clean error 'Unknown terminal type: su (-1)'. With a prompt for Terminal type? .
Changing the 'personality' setting on the terminal, correlated with a reset above, to other promising options only modifies the 'kind' of garbage I see - none of it is clean.
Hardware?
I don't think so. The exact same adapter/terminal/etc setup was connected to an Ubuntu Linux machine, with
getty configured as described, and it Just Worked®, with no noise or garbage on the screen.
Furthermore, using the third party application Serial to just write plain text to the terminal works without issue - no garbage, and newlines are handled correctly.
Something about Mac OS's configuration with
getty is causing issues with this terminal.
Update 1
I found a way to get a usable terminal session. Run
screen , pointed at the serial port like so:
And then from within screen, hit ctrl + a, : and then type:
Et voila, a clean and usable login shell appears on the terminal!
However, this method still has some drawbacks.
The prompt line is doubled. that is, any time you hit return at the prompt, the prompt, a newline, and another prompt appears. There's also still a ton of noise on the line - any commands that dump a lot of text at once like an
ls results in garbled output.
Pictured below:
Programs are convinced that the terminal type is set to
screen , even if i do an export term='vt100' - this means that most full screen terminal apps like vim and mutt drop a lot of control codes that the terminal can't handle, usually hanging it to the point a reset is necessary to gain input again.
I'm still searching for a way to have the terminal Just Work on login.
Mikey T.K.
Mikey T.K.Mikey T.K.
2,24033 gold badges2121 silver badges4242 bronze badges
1 Answer
After much fiddling around, I finally figured out the right combination of things to use for a fully usable terminal.
The detailsHardware
I got a new USB/Serial cable. This one has the FTDI, rather than the Prolific chipset. This is important since OSX comes with the FTDI drivers in the box, rather than having to install the third party Prolific drivers. This made troubleshooting much easier, since the serial port stopped getting stuck after each experiment, meaning no more reboots to become usable again.
If you're going to try this yourself, the cable I used was the StarTech Industrial USB RS232 Serial Adapter. This was in conjunction with a random DB9/DB25 adapter, and a gender changer since the ports on the back of the terminal are female.
Note: A previous version of this guide suggested using a different cable - this particular cable will let us use the modem port on the terminal, correcting some various display glitches!
This cable should be connected to the MODEM port on the terminal.
System Configuration
Ignore any guide that suggests you use
/etc/ttys , since this file is ignored in modern versions of OS X. This would be the way to go on Linux/BSD, but not here.
I was left wondering how to set the terminal type for the login, since as described above, just using the
std.19200 that's provided in /etc/gettytab left the terminal set to su for some reason, and nothing worked.
I added a line as follows:
This sets the login banner to a simple CRLF, sets the line speed to 57600 baud, and most importantly, sets the terminal to
vt220 . This will become important later.
Now we need to actually start this. As described elsewhere, you can't just run
getty , since that's restricted to launchd . We have to make and load a daemon plist.
To
/Library/LaunchDaemons , I added a serialconsole.plist with the following contents:
If you do this yourself, the third string will almost certainly be different, since this is the serial number of the adapter. The second line references the line we just added to to
/etc/gettytab . Also note the setting of KeepAlive to true - this means that when the process exits (say, we log out), a new instance will spawn. Without this, you have to manually start the job.
Terminal Settings
Finally, the terminal itself has to be configured. This is a Wyse WY50, but it can emulate many other terminal types. I find that VT220 mode gives the best experience.
To enter setup mode on the terminal from factory settings, hit Shift + Setup.
Pressing F1 to enter the
DISP menu, I set:
F2 to the General screen.
F3 to the KEYCODE screen
F4 to the COMM screen
More super important stuff:
Serial Port Terminal
One more - F5 to the PORTS screen
Everything else I left at factory defaults.
Hit F12, then Space to set Save to Yes, and then F12 once more to save settings.
Putting it all together
We're ready to go. Make sure the terminal is on and plugged in to the port, verify the settings are as described above both
gettytab and the plist file you created.
We load the created plist into launchd:
And finally start it:
Linux Serial Port Terminal
And in a moment, you should have a login prompt on your terminal! Some photos:
Display glitchesLinux Serial Port Terminal Program
You might notice that certain applications still write garbage onto the screen, especially if they do anything fancy like bold text or certain ASCII characters. Most recent machines, macs included, use UTF-8 for their character set. But this venerable glass terminal has no idea what that is! You'll need to set the locale to the appropriate legacy codepage for your region. In the USA, this is Mikey T.K.Mikey T.K.
en_US.ISO-8859-1 . Have a look at the output of locale , and work the command export LC_ALL='en_US.ISO-8859-1' into a login script that checks your $TERM variable. You really don't want to set this system wide, but only on sessions where your glass terminal is being used.
Serial Terminal For Linux
2,24033 gold badges2121 silver badges4242 bronze badges
Linux Serial Port Terminal EmulatorNot the answer you're looking for? Browse other questions tagged macoscommand-lineterminalserial-port or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |