mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-23 22:54:10 -06:00
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>
This commit is contained in:
parent
cad1e0b985
commit
74fa8a3907
2 changed files with 8 additions and 1 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue