SCOMM | SCOMM Serial Communication Utility |
SCOMM is another UNIX terminal utility program to provide communications through a serial port. SCOMM is new (2014), has been implemented in C on MacOSX, and is intended for providing communication with legacy serial interfaces, devices and systems.
SCOMM sets as an objective the ability to have full two-way binary transparency through the communication port, in addition to text-oriented functionality. This allows for example, SCOMM to emulate an ASR-33 teletype where text functionality is desired for console or terminal operations as well as emulating the paper-tape punch and reader of the ASR-33 where full 8-bit binary transfer is required. A related objective is providing a fairly fine-grain level of control over character-handling such as new-line translation.
SCOMM was written because the "screen" program of MacOSX, despite it's complexity, still didn't provide - or guarantee - certain requirements, and I was too lazy to go looking for another program.
If SCOMM doesn't provide some desired facility, the source is available to hack.
Contents (this page): | Resources: |
The main process - the sender - reads bytes from the user input (stdin) and writes them to the port. The sender may be switched from this 'send state' to the 'command state', to execute SCOMM commands entered by the user. Files may also be sent to the port.
A child process - the receiver - is created to read bytes from the port and write them to the user display (stdout). Non-printing bytes from the port may be displayed in hex. The binary data from the port may be directed for collection in a file. The sender process controls the receiver process through a pipe and signalling.
At startup, the sender is in the send state. Command state is entered by typing
In send state, the sender may operate in either character-immediate mode or line-at-a-time mode:
The default sender mode is character-immediate with echo enabled.
-u | : Display usage line. |
-d commDevice | : Specify the serial communication port device.
The default device is "/dev/tty.usbserial".
A special device - "loopback" - is provided for testing without a hardware device. Another special device is "sbb" - see Teletype Support. |
-s speed | : Set the port speed. speed is a numeric value, accepted values are system-dependant. |
-b bits | : Set the number of data bits and stop bits for the port. bits may be 5, 6, 7, 8, 52, 62, 72 or 82.
If 52 is specified, translation to and from ITA2 character code is performed, for use, of course, with 5-level teletypes. 10xx = set CTS output flow control (CTS_OFLOW flag). 20xx = set carrier flow control (MDMBUF flag). |
-c | : Enter command mode at startup rather than send mode. |
-cmd arg* | : The SCOMM command cmd with any arguments is executed. Arguments cannot begin with a "-". |
At startup:
To quit SCOMM, enter CTL-D in either send or command state, or the quit or exit command. If quit or exit is specified in the invokation command line, SCOMM will not terminate until subsequent commands in the command line have been executed.
sl*ine [off] | : Set sender mode to line-at-a-time or character-immediate (off).
Initial state: character-immediate. |
se*cho [off] | : Enable/disable echoing in sender character-immediate mode.
Echoing is always performed in line-at-a-time mode.
Initial state: on. |
sknl [off|cr|crlf] | : Set sender keyboard NL->CRLF translation mode.
When off, Carriage-Returns and Line-Feeds from the keyboard are transparently sent to the port.
In cr mode, a CR or LF from the keyboard sends a CR.
In crlf mode (default), a CR or LF from the keyboard sends a CRLF pair.
Initial state: off. |
sfnl [off|cr|crlf] | : Same as sknl but for characters from send-files rather than the keyboard.
Initial state: off. |
sfcrd*elay [mS] | : Delay for mS milli-seconds after sending a CR.
Initial/default: 0. |
sfnln*ulls [num] | : Send num nulls after a NL, if NL translation is enabled.
Initial/default: 0. |
sf*ile [+e] file | : Send the contents of the specified file to the port.
If +e is specified, the contents are also echoed to the display.
|
sby*tes num* | : Send each numeric value as a byte. |
srep*eat string [num] | : Send string repeatedly, num times. num defaults to 1. |
sbr*eak duration | : Send break. duration is system dependant (see GNU tcsendbreak).
Device/system dependant (see Anomylies). |
test*path [clean] | : Send bytes of value 0 to 255 to the port. With the port serial line wired in loopback this provides a means to test the port for binary transparency. A new-line will be sent every 16 bytes, in accordance with the keyboard new-line mode, unless the optional argument is specified, in which case only the 256 byte-values are sent. Normally it will be desirable to have the receiver in display hex = all and display new-line = crlf modes to provide full display and separation of lines. |
rdhex [off|all] | : Control the receiver hex display mode.
Characters or bytes may be classed in 3 categories: text, control, and undefined.
Recognised control characters are CR, LF, HT and NULL.
Undefined characters are the remaining non-text, non-control byte values.
If hex display is off, undefined characters are presented to the display transparently (as a binary byte).
If hex display is on, undefined characters are displayed in hex.
If all is specified, both undefined and control characters are displayed in hex,
control characters nonetheless continuing to have their normal effect.
Initial state: on. |
rdnl [off] | : Enable/disable receiver CRLF->NL translation for the display.
When enabled, incoming Carriage-Returns and Line-Feeds on their way to the display are translated to New-Lines,
with the exception that a LF immediately following a CR is ignored.
Initial state: off. |
rfnl [off] | : Same as rdnl but affects data on its way to a collecting file rather than the display.
Initial state: off. |
rdi8 [off] | : When this mode is enabled the eighth bit is ignored as bytes are being processed for display. This is an allowance for external sources which insist on sending a parity bit. |
rf*ile [[+s] file] | : Collect received bytes in the specified file. +s suppresses the normal display of received bytes for the duration of the collecting. If no arguments are specified, collecting is terminated. |
code [ita*2] | : Set character code translation. ITA2 is the only alternative to ASCII currently provided.
Initial state: ASCII. |
s*tatus | : Display current status & mode info. |
h*elp | ? | : Display a command summary. |
q*uit | exit | : Terminate SCOMM. |
The SBB interface allows for any baud rate desired, within the limits of the interface and RPi to generate the timing with sufficient accuracy. Currently the timing is done from user-land C, so it's not exactly guaranteed, but should be fine for the intended low baud rates, on an RPi with no conflicting tasks. (Timing error has been measured in the range of 50uS / bit.) If the -s speed option is specified as a negative number, the value is taken as the rate in hundredths, e.g. "-s -4545" is 45.45 bits/S while "-s 45" is 45 bits/S.
Additionally, 1.5 stop bits with 5 data bits is provided by specifying "-b 515".
As an example, to invoke scomm for working with a Model 15 teletype, the following might be used:
Note that some USB-RS232 adapters will go down to 75 baud, as it is a factor-of-two relation in the standard ../9600/4800/2400/1200/.. series, and do 5-data/2-stop bits, useful for Model 28 teletypes with the appropriate speed gears.
The send-file and receive-file commands are then used for paper-tape read and punch operations, with 8-bit transparency between the files and the attached system.
SCOMM | bhilpert 2014 Oct |