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.
Option | Termios name | Type |
---|---|---|
baud | CBAUD | integer |
cooked | ICANON | boolean |
echo | ECHO | boolean |
raw | ~ICANON | boolean |
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)