diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-12-09 19:04:30 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-12-09 19:07:03 -0500 |
commit | 74fa8a3907359a7c7e9159601b8a8c2c6b79e960 (patch) | |
tree | 2acb67d85e9a29891f440d5d05e06fdc958b4def /klippy/util.py | |
parent | cad1e0b985299ff1b3210a2b9cdfbaac7d5b2c51 (diff) | |
download | kutter-74fa8a3907359a7c7e9159601b8a8c2c6b79e960.tar.gz kutter-74fa8a3907359a7c7e9159601b8a8c2c6b79e960.tar.xz kutter-74fa8a3907359a7c7e9159601b8a8c2c6b79e960.zip |
serialhdl: Clear "hupcl" bit from serial port
The arduino style serial port interfaces can reset the MCU when the
serial port is opened. Clearing the HUPCL flag makes this less
likely.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/util.py')
-rw-r--r-- | klippy/util.py | 6 |
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() |