aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/util.py')
-rw-r--r--klippy/util.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/klippy/util.py b/klippy/util.py
index caac827e..6bbfd9af 100644
--- a/klippy/util.py
+++ b/klippy/util.py
@@ -16,6 +16,12 @@ def set_nonblock(fd):
fcntl.fcntl(fd, fcntl.F_SETFL
, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
+# Clear HUPCL flag
+def clear_hupcl(fd):
+ attrs = termios.tcgetattr(fd)
+ attrs[2] = attrs[2] & ~termios.HUPCL
+ termios.tcsetattr(fd, termios.TCSADRAIN, attrs)
+
# Support for creating a pseudo-tty for emulating a serial port
def create_pty(ptyname):
mfd, sfd = pty.openpty()