How to disable the hardware flow control for uucp's cu command?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5

Issue

A server is connected to a Communication Module via serial port. To connect to CMM we use 'cu' command.

When opening the connection there is the following behaviour:

1. cu -l /dev/ttyS0 -s 115200
2. I am getting "Connected." however I can not type anything and terminal is "frozen" no output at all.

To make progress I have to open another terminal on the same server and type "stty -F /dev/ttyS0 -crtscts"
than on first terminal I am getting "bash-2.04#".

I found that command cu is changing "-crtscts" to "crtscts". Please see output from "stty -a -F /dev/ttyS0":

  • before running cu:
# stty -a -F /dev/ttyS0
speed 115200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 1;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -cdtrdsr
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
  • when cu command is running ("frozen"):
# stty -a -F /dev/ttyS0
speed 115200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 1;
-parenb -parodd cs8 hupcl -cstopb cread clocal crtscts -cdtrdsr
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

cu command modify "crtscts" option and the only way to push it forward is to run "stty -F /dev/ttyS0 -crtscts".

Resolution

From info uucp, hardware flow control is on by default. But there is a configuration file to change the setting /etc/uucp/port:

   The port files may be used to name and describe ports.  By default
there is a single port file, named `port' in the directory
NEWCONFIGDIR.  This may be overridden by the `portfile' command in the
main configuration file; see *Note Configuration File Names::.

`hardflow BOOLEAN [ modem and direct only ]'
     The argument indicates whether the port supports hardware flow
     control.  If it does not, hardware flow control will not be turned
     on for this port.  The default is true.  Hardware flow control is
     only supported on some systems.

Please set the following values there - /etc/uucp/port:

# Everything after a '#' character is a comment.
port      ttyS0       # Port name
type      direct      # Direct connection to other system
device    /dev/ttyS0  # Port device node
hardflow  false       # No hardware flow control
speed     115200      # Line speed

# cu -I /etc/uucp/port -l /dev/ttyS0 -s 115200

In another configuration file /etc/uucp/sys the target systems can be configured:

# system: target
system  target   # Remote system name
port    ttyS0    # Port name
time    any      # Access is possible at any time

With this information, the following simple command will establish the session and all settings will be gathered from the configuration files:

# cu target

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments