本文整理汇总了Python中termios.IXOFF属性的典型用法代码示例。如果您正苦于以下问题:Python termios.IXOFF属性的具体用法?Python termios.IXOFF怎么用?Python termios.IXOFF使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类termios
的用法示例。
在下文中一共展示了termios.IXOFF属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_xonxoff
# 需要导入模块: import termios [as 别名]
# 或者: from termios import IXOFF [as 别名]
def _set_xonxoff(self, enabled):
if not isinstance(enabled, bool):
raise TypeError("Invalid enabled type, should be boolean.")
# Get tty attributes
try:
(iflag, oflag, cflag, lflag, ispeed, ospeed, cc) = termios.tcgetattr(self._fd)
except termios.error as e:
raise SerialError(e.errno, "Getting serial port attributes: " + e.strerror)
# Modify tty attributes
iflag &= ~(termios.IXON | termios.IXOFF | termios.IXANY)
if enabled:
iflag |= (termios.IXON | termios.IXOFF)
# Set tty attributes
try:
termios.tcsetattr(self._fd, termios.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
except termios.error as e:
raise SerialError(e.errno, "Setting serial port attributes: " + e.strerror)
示例2: _get_xonxoff
# 需要导入模块: import termios [as 别名]
# 或者: from termios import IXOFF [as 别名]
def _get_xonxoff(self):
# Get tty attributes
try:
(iflag, _, _, _, _, _, _) = termios.tcgetattr(self._fd)
except termios.error as e:
raise SerialError(e.errno, "Getting serial port attributes: " + e.strerror)
if (iflag & (termios.IXON | termios.IXOFF)) != 0:
return True
else:
return False
示例3: _patch_iflag
# 需要导入模块: import termios [as 别名]
# 或者: from termios import IXOFF [as 别名]
def _patch_iflag(cls, attrs):
return attrs & ~(
# Disable XON/XOFF flow control on output and input.
# (Don't capture Ctrl-S and Ctrl-Q.)
# Like executing: "stty -ixon."
termios.IXON
| termios.IXOFF
|
# Don't translate carriage return into newline on input.
termios.ICRNL
| termios.INLCR
| termios.IGNCR
)
示例4: _patch_iflag
# 需要导入模块: import termios [as 别名]
# 或者: from termios import IXOFF [as 别名]
def _patch_iflag(cls, attrs):
return attrs & ~(
# Disable XON/XOFF flow control on output and input.
# (Don't capture Ctrl-S and Ctrl-Q.)
# Like executing: "stty -ixon."
termios.IXON | termios.IXOFF |
# Don't translate carriage return into newline on input.
termios.ICRNL | termios.INLCR | termios.IGNCR
)