stty

An access object for the terminal settings for the spawned object.

Attributes

baud
Get or set the baud rate with an integer, or None (to reflect a reset, i.e. B0).
cc
Get or set a dictionary of canonical key values.
cooked
Get or set canonical key evaluation; true means to interpret control keys. The opposite is "raw", which is provided for convenience.
echo
Get or set the local echo feature; true means to output the characters typed.
rates (read-only)
Return a list of values usable for baud above.
raw
Get or set non-canonical key evaluation; true means to pass control keys through to the application. The opposite is "cooked".

Other "hidden" attributes

_cflag
Get or set the cflag termios value.
_fd (read-only)
Get the file descriptor for the object.
_iflag
Get or set the iflag termios value.
_lflag
Get or set the lflag termios value.
_oflag
Get or set the oflag termios value.

Operations

__call__

obj.stty()

Return the currently terminal values. The return value is usable as an argument to stty() to reset the values.

When given arguments, they can be either ordered values or keyword arguments.

obj.stty(option, ...)

Set an value (as listed below), options proceeded by a "-" is turned off.

obj.stty(option=value, ...)

Or a combination of ordered values and keywords.


OptionTermios nameType
baudCBAUDinteger
cookedICANONboolean
echoECHOboolean
raw~ICANONboolean

__repr__
Print in the format "<stty fd=%d>".
__cmp__
Compare the file descriptors of two objects; can take another stty object, a file object (with a fileno method), or a file descriptor.

Methods

termios([data]) conditional build
Convert the stty values to a form as the termios module would use. If an argument is given, sets those values. Otherwise, return the values already set.

Only built when the C macro STTY_TERMIOS_FUNCTION is defined.

Examples

Make the terminal raw with no echo.

original_tty_values = tty_spawn_id.stty()
tty_spawn_id.stty('-echo', 'raw')

tty_spawn_id.stty(original_tty_values)

Or another way:

tty_spawn_id.stty('raw', echo=1)

Set up a modem device at 19200 baud, then force a hangup of the modem.

modem = spawnfile(open('/dev/cua', 'w+'))
modem.stty.baud = 19200
modem.stty.baud = None