本文整理匯總了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
)