Serial Line Emulation Notes

Table of contents

Serial Lines for Emulated Systems

Most models emulated by Charon-PAR have two serial lines (LDev 20 and 21). One of these emulated lines is mapped to the serial console, the other to a second serial port. Some models may have more serial lines. Please refer to Emulated Model Hardware Configuration Details for more information. This section provides an overview of the serial line configuration. Please also refer to the Configuration File Reference.

Configuration Parameters Overview

Each emulated line has a device path denoting bus and slot information in the emulated system (see configuration file template or chapter Emulated Model Hardware Configuration Details) and a configuration path. The configuration path is used to set up the serial line configuration in the emulator configuration file.

The following table shows the device and configuration paths used for the two serial lines:

Charon-PAR 64-bit modelsCharon-PAR 32-bit model 720Charon-PAR 32-bit model B132L
Serial lineConfig. pathSerial lineConfig. pathSerial lineConfig. path
1 = Consoleserial.uart0.device1 = Consoleasp.uart0.device1 = Consolegsc.lasi.uart.device
2serial.uart2.device2asp.uart1.device2gsc.wax.uart.device

Serial port configuration options are specified using the following syntax:

serial.uartX.device.<option>="<value>"

or (for model 720)

asp.uartX.device.<option>="<value>"

or (for model B132L)

gsc.lasi.uart.device.<option>="<value"


If the Super/IO module has been loaded, there are two additional serial lines. In the configuration, they are identified by 

  • superio_001.uart0 and
  • superio_001.uart1.

The basic configuration options are the same as for the default serial lines.

The most important configuration options are listed below. For additional parameters and more detailed information, please refer to the Configuration File Reference.

Serial port optionDescription
type

The serial port type determines the protocol used on the serial port. Possible values are:

  • DUMMY: serial interface presented to emulator is not connected.
  • socket: the port is set to TCP raw mode.
  • telnet: the port supports the telnet protocol.
  • pty: indicates that the emulated serial line is connected to a Linux pseudo-terminal.
  • tty: emulated serial line is connected to physical hardware (serial hardware must be supported by Linux).
  • RFC2217: emulated serial line is connected to a serial line server across the IP network.
port

Each port is mapped to a TCP socket on the emulator host or to a physical line. This parameter defines the TCP port used, the name of the physical device, or the port and address of a serial line server. A port number must be unique among all active port numbers on the host system.

A TCP port is specified as "<where-to-listen>:<portnumber>". It requires a port type of socket or telnet.

Default values (listening on all interfaces):

  • ":30000" for line 1
  • ":30002" for line 2

To restrict console connections to certain host interfaces or host IP addresses, set where-to-listen to the respective interface name or IP address. The settings lo:<portnumber> and <portnumber> (without the colon) are equivalent.

A physical device is specified as "<device-file>". It requires a port type of device.

Example:

  • "/dev/ttyS0"
  • "/dev/ttyUSB0"

A serial line server is specified as "<ip-address>:<port>".

commandThis parameter is optional. It can be used to specify a terminal emulation program that is started automatically when the emulated system is started. Charon-PAR provides preconfigured profiles for PuTTY (PAR-Socket PAR-Telnet PAR-Telnet-VT100) that can be used to connect to the emulated system via a serial line.


The configuration file templates contain the following default configurations:

LineCharon-PAR/PA3Charon-PAR/PA9

Emulated serial console on port 30000 using the telnet protocol. PuTTY started automatically with preconfigured profile.
1 serial.uart0.device.type="telnet"
serial.uart0.device.port=":30000"
serial.uart0.device.command="putty -load PAR-Telnet"

PA9-64

serial.uart0.device.type="telnet"
serial.uart0.device.port=":30000"
serial.uart0.device.command="putty -load PAR-Telnet-VT100"

PA9-32 (model 720)

asp.uart0.device.type="telnet"
asp.uart0.device.port=":30000"
asp.uart0.device.command="putty -load PAR-Telnet-VT100"

PA9-32 (model B132L)

gsc.lasi.uart.device.type = "telnet"
gsc.lasi.uart.device.port = ":30000"
gsc.lasi.uart.device.command="setsid putty -load PAR-Telnet-VT100"


Emulated second serial line in raw mode on port 30002.
2 serial.uart2.device.type="socket"
serial.uart2.device.port=":30002"

PA9-64

serial.uart2.device.type="socket"
serial.uart2.device.port=":30002"

PA9-32 (model 720)

asp.uart1.device.type="socket"
asp.uart1.device.port=":30002"

PA9-32 (model B132L)

gsc.wax.uart.device.type = "socket"
gsc.wax.uart.device.port = ":30002"

Please note:

By default, pressing Ctrl+C in the Charon-PAR console is passed to the emulator's child processes and kills the PuTTY console process. If this is not desired, you can modify the command line to include the setsid command to start the telnet command in a new session.
For example: serial.uart0.device.command="setsid putty -telnet -P 30000 localhost"


HP-UX Interactive Login Activation

To enable interactive login on a non-console serial line in HP-UX, a GETTY process has to be started for the terminal line.

In versions before 11.31, you can add an additional terminal via SAM  (Peripheral Devices > Terminals and Modems > Actions > Add Terminal). This will also add the necessary entries in to /etc/inittab.

You can also (as the root user) edit /etc/inittab to add the configuration manually or to modify an existing configuration.

To identify available serial lines, you can use the ioscan command:

# ioscan -fn -C tty

Class I H/W Path Driver S/W State H/W Type Description

==================================================================

tty 0 0/0/4/0 asio0 CLAIMED INTERFACE PCI Serial (103c1048)

/dev/GSPdiag1   /dev/tty0p0  /dev/tty0p4

/dev/diag/mux0  /dev/tty0p1

/dev/mux0       /dev/tty0p2

Sample inittab entry:

ttp2:234:respawn:/usr/sbin/getty -h tty0p2 9600

After editing the file, any changes must be activated by running the command 

# init q

The command 

# ps -ef | grep -i getty 

can be used to verify that the processes are running. Note that a GETTY process is only shown for lines without active login session.


After this configuration, when connecting to the serial line, a login prompt should be displayed. If you use the Linux telnet client to connect to an emulated line mapped to a TCP socket, use mode character to avoid local echo.

Please note: in version 11.31, SAM was replaced by SMH. This tool does not have the same configuration option, so only the manual configuration option is available.

Terminal Emulation Considerations

The emulated serial lines can be accessed via a terminal emulation program running on the emulator host system or on a remote system. 

Please note: if the terminal emulation program runs on a remote system, any firewall between the remote system and the emulator host system must permit the configured ports.

Stromasys supplies PuTTY profiles with the Charon-PAR kit. However, customers can select another terminal emulation program better suited to their purposes. This is especially true for MPE/iX guest systems where applications often use block mode terminals. This mode is not supported by PuTTY.

If not done so already during the installation, copy the provided PuTTY profiles to the correct directory on the host system. See Post-Installation Tasks in  Charon-PAR Software Installation.

Accessing Emulated Charon-PAR/PA3 Systems via Terminal Emulation

Charon-PA3 guest systems can be accessed directly from the Linux emulator host using either the PuTTY or xhpterm terminal emulator described below, both of which run directly on the Linux host desktop, or by simply using the telnet command. Each has limitations, however. Neither terminal emulator provides a reliable way to paste multiple lines of text into :EDITOR , for example.
Once the network of the Charon-PAR/PA3 guest system has been configured configured, it may be preferable to connect to the emulated system from a networked PC using any of the robust commercially-available terminal emulators.


Using Non-Graphical Telnet Client

In the absence of a graphical user environment, terminal emulators such as PuTTY and xhpterm cannot be used. In such cases, you can use the telnet command on the Charon host or from a remote system to access the serial console port of the emulated PA3 system.

The basic command syntax is as follows:

$ telnet <charon-host> <console-tcp-port>

Parameters:

  • charon-host: IP address or hostname of the Charon-PAR host system on which the emulator runs
  • console-tcp-port: The TCP port configured for the serial console port in the configuration file of the emulated PA3 system

Please note: Line-editing is very limited. To delete a character on the command-line, use CTRL+BACKSPACE. Note that the deleted character will still be visible until it is overwritten. Block-mode applications are not supported.

Using PuTTY

The PuTTY terminal emulator is the preferred method to use as the Charon-PAR/PA3 console. It does not, however, support the terminal escape sequences used by the legacy hardware, so any inverse or highlighted text codes will be ignored, and block mode applications cannot be run. Using PuTTY in telnet mode (as supplied) allows use of the Break key. PuTTY supports copy and paste. To copy text to the clipboard, just select it with the left mouse button (this automatically copies the selection to the clipboard). To paste the clipboard into a PuTTY window, use Shift-Ins . Unfortunately, PuTTY cannot be used to reliably paste large blocks of text (even with MPE type-ahead enabled), as data overruns can easily occur.

By default, the emulator configuration is set up to start PuTTY on the console port with a command similar to the following example:

serial.uart0.device.command="putty -load PAR-Telnet" (default port 30000). 

To start an terminal emulator manually, perform the following steps:


StepCommand / Action
1Make sure the preconfigured PuTTY profiles are in the directory .putty/sessions or .config/putty/sessions in your home directory.(see Post-Installation Tasks in  Charon-PAR Software Installation)
2Start PuTTY from the command-line. 

$ putty -load PAR-Telnet

3Should you get an error that a font was not found, change the font.

Start PuTTY from the command-line.

$ putty

  • Select and load the required profile.
  • Select Fonts on the left and select a monospace font.
  • Select Session on the left and save the profile.
4To connect from a remote host, change localhost in the template to the correct hostname or IP address.

Start PuTTY from the command-line.

$ putty

  • Select and load the required profile.
  • Change the hostname to the one of the Charon-PAR host as required.
  • Connect to the remote Charon-PAR system.

The image below shows a PuTTY terminal window connected to the guest MPE/iX system console:

Please note: Line-editing is very limited. To delete a character on the command-line, use BACKSPACE. Note that the deleted character will still be visible until it is overwritten. Block-mode applications are not supported.


Using xhpterm

The xhpterm terminal emulation (an X Windows version of freevt3k ) does not support many terminal escape sequences used by historic PA-RISC hardware for MPE/iX, but it can be used to run block-mode applications. It must be used on a serial line set up for raw mode.

Sample command (run on Charon host): /opt/charon/bin/xhpterm -port 30002 -clean -font 10x20

The following image shows an xhpterm window connected to the second serial line of an emulated MPE/iX system (running NMMGR):


Working without Block-Mode Enter key

If working without a block-mode Enter key, you can navigate using the function keys of your keyboard. They correspond to the selection fields at the bottom of the screen.

For example, in the above window,

  • F1 would correspond to Open Config,
  • F8 would correspond to Exit Program.

Mapping the Block-Mode Enter key

The primary purpose for including this terminal emulator is to allow block-mode applications (like NMMGR ) to be run from the Linux desktop. xhpterm uses the numeric keypad Enter key to simulate block-mode Enter. If your keyboard does not have a numeric key pad, the Enter key can be mapped to another key or key combination using xmodmap on Linux. 

Example mapping the numeric key pad Enter key to Right-Ctrl:


StepCommand
1Determine the key code of the Right-Ctrl key.

$ xmodmap -pk | grep "Control_R"

You will receive an output similar to: 

105 0xffe4 (Control_R) 0x0000 (NoSymbol) 55 0xffe4 (Control_R)

2Redefine the key code to the numeric keypad Enter key.$ xmodmap -e "keycode 105 = KP_Enter"
3If original key mapping is required, reverse step 2.$ xmodmap -e "keycode 105 = Control_R"

Please note: these settings are not persistent across X-sessions. To always use a certain setting when running xhpterm, you could, for example, use a small script to set and reset the key mapping. An example (only for illustrative purposes only) is shown below.

#!/usr/bin/bash
#
# parameter: -f <font> -p <port>
#
while getopts "f:p:" opt; do
    case "$opt" in
    (f) font="-font $OPTARG" ;;
    (p) port="-port $OPTARG" ;;
    (*) print "flag [$opt] unknown. abort." && exit 1 ;;
    esac
done

if [[ -z "$port" ]]; then
	echo "Port (-p) is mandatory"
	exit 1
fi

xmodmap -e "keycode 105 = KP_Enter"
/opt/charon/bin/xhpterm -clean $font $port
xmodmap -e "keycode 105 = Control_R"


Using Different Fonts

The default command-line to start xhpterm is:  $ xhpterm -port 30000 -clean -font 10x20

If the 10x20 font is not found, you can try -font 6x13 instead.

Additional fonts (e.g. the 9x15 font) can be installed using the command

# yum install xorg-x11-fonts-misc

Please note: When using xhpterm , avoid resizing the window - it can result in input and output fields in block-mode programs being misaligned. Changing the screen font will change the window size automatically, without causing this problem.


Accessing Emulated Charon-PAR/PA9 Systems via Terminal Emulation

Using Non-Graphical Telnet Client

In the absence of a graphical user environment, terminal emulators such as PuTTY and xhpterm cannot be used. In such cases, you can use the telnet command on the Charon host or from a remote system (if the serial line configuration permits it) to access the serial console port of the emulated PA3 system.

The basic command syntax is as follows:

$ telnet <charon-host> <console-tcp-port>

Parameters:

  • charon-host: IP address or hostname of the Charon-PAR host system on which the emulator runs
  • console-tcp-port: The TCP port configured for the serial console port in the configuration file of the emulated PA3 system

Please note: To make character deletion via the BACKSPACE key work on the command-line of HP-UX, you may have to enter the command$ stty erase <backspace-key> (and add it to your shell startup file, e.g., $HOME/.profile).


Using PuTTY

Stromasys provides preconfigured PuTTY profiles to access the serial console of an HP-UX system running on Charon-PAR. PuTTY does not support all control characters used by HP-UX, but many utilities (e.g., SAM) will work with some restrictions.

By default, the emulator configuration is set up to start PuTTY on the console port with a command similar to the following example: 
   serial.uart0.device.command="putty -load PAR-Telnet-VT100".

To start an terminal emulator manually, perform the following steps:


StepCommand / Action
1Make sure the preconfigured PuTTY profiles are in the directory .putty/sessions or .config/putty/sessions in your home directory.(see Post Installation Tasks in Charon-PAR Software Installation)
2Start PuTTY from the command-line. $ putty -load PAR-Telnet-VT100
3Should you get an error that a font was not found, change the font.


Start PuTTY from the command-line.

$ putty

  • Select and load the required profile.
  • Select Fonts on the left and select a monospace font.
  • Select Session on the left and save the profile.
4To connect from a remote host, change localhost in the template to the correct hostname or IP address.

Start PuTTY from the command-line.

$ putty

  • Select and load the required profile.
  • Change the hostname to the one of the Charon-PAR host as required.
  • Connect to the remote Charon-PAR system.


Instead of PuTTY, you can also use the standard telnet command on your local or remote Linux system (telnet <charon-par-host> <port>). However, Stromasys does not provide profiles for this. To make character deletion via the BACKSPACE key work on the command-line of HP-UX, you may have to use the command $ stty erase <backspace-key>.



Additional configuration steps to improve the behavior of the terminal emulation:

StepCommand
To enable better line drawing with the VT100 setting do the following on system where PuTTY runs
PuTTY versions before 0.71
Temporary set locale to C before starting PuTTY if you use a different locale. 

$ export LC_ALL=C

Then start PuTTY.

This setting will enable proper line-drawing.

PuTTY versions starting with 0.71
Use the new UTF8linedraw parameter in the PuTTY configuration.

Either add the line UTF8linedraw=1 to your session configuration file

or

Start PuTTY from the command-line, load the PAR-Telnet-VT100 session, enable VT100 line drawing for UTF-8 (the last parameter in Window > Translation), and save the session.

On the HP-UX guest system
Set the terminal type to vt100 after logging in to the system (this can be added to the login profile, if required).

$ TERM=vt100

$ export TERM

This will configure a terminal type known to HP-UX. Without a known terminal type many screen-based applications (e.g., editor, SAM) will not work.


Additional information: Cannot get correct line drawing on Linux/UNIX with Putty.



Other Terminal Emulation Considerations

Accessing the Emulated System Console Directly via telnet from a Remote System

This is not recommended due to the inherent security risk of using an unencrypted program across a potentially insecure network. This option is described for completeness.

Please note:

  • The serial line port configuration must allow the remote connection.
  • intermediate firewalls must allow the ports used.
  • There can be only one connection to an emulated serial line at one time.

The following two options provide two examples of how to connect to the console of an emulated system from a remote system using telnet

Option 1: using PuTTY installed on the remote system

If PuTTY is installed on the remote system, you can use the session profiles provided by Charon-PAR (copy them from the emulator host) to connect to the emulated system:

  • Start PuTTY.
  • Load the correct session profile (see sections above).
  • Change localhost to the name or IP-address of the emulator host.
  • Start the session.

Option 2: use the telnet program on the remote system

Run the following program from the command-line:

$ telnet <emulator-host> <serial-line-port>

emulator-host is the name or IP-address of the Linux emulator host.

serial-line-port is the port of the emulated serial line using the telnet protocol (default 30000).

To exit the session, use the telnet escape key sequence CTRL+} and type quit.

Running the telnet Terminal Emulation through an SSH Connection

Even though a plain telnet connection can be used to connect to the emulated system's console, this plaintext connection creates security problems. As an alternative, you run a telnet terminal emulation through an SSH connection using one of several options. The following sections show examples.

Please note: Any intermediate firewall must permit the port used for SSH (default 22).

Start Telnet from an Interactive SSH Login to the Charon Host

This is the easiest way to secure your connection:

  • Login via SSH to the Charon host.
  • Start a local telnet session from the command-line (sample uses the default console port):
    telnet localhost 30000



Display PuTTY via X11 through an SSH Tunnel

Prerequisite: X11 is enabled on the emulator host and the remote system.

Use the following steps to start a PuTTY session across an SSH tunnel:


StepCommand
1Connect to the emulator host via SSH specifying that X11 should be tunneled.$ ssh -X <user>@<emulator-host>
2Enter the password of user to log into the emulator host system.
3Start the terminal emulation program (e.g., PuTTY, assuming the Charon-PAR session configurations have been installed for the user).$ putty -load PAR-Telnet-VT100

Use SSH Port-Forwarding to Create a Secure Connection

SSH port-forwarding creates a secure communication path for insecure protocols like telnet. The following example shows how to create such a basic tunnel on a Linux system for a serial console connection to a Charon-PAR emulator running on a remote Charon host:

  • Step 1: initiate the port-forwarding connection:
    ssh -i ~/.ssh/<my-private-key> -N -L50000:localhost:30000 <user>@<charon-host>

    In the local port 50000 is forwarded to the remote port 30000 (default console port) on the charon host system.
    The example assumes a password-less login via an SSH key-pair, but this is not mandatory.
    The parameter -N prevents an interactive session from being created. This is also not mandatory.
    Please refer to the SSH manpages of your Linux system for details on port-forwarding.
  • Step 2: use the tunnel for your telnet connection:
    • Either from the command-line: telnet localhost 50000
    • or point your PuTTY telnet session to localhost port 50000



© Stromasys, 1999-2024  - All the information is provided on the best effort basis, and might be changed anytime without notice. Information provided does not mean Stromasys commitment to any features described.