mirror of
https://github.com/andreili/katapult.git
synced 2025-08-23 19:34:06 +02:00
flashtool: usb bootloader request fix
Open the usb device with the O_NOCTTY flag. This prevents a SIGHUP signal from killing the flashtool process if the bootloader request results in a hangup event. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
b734c57d3e
commit
418b43b0fa
@ -959,16 +959,13 @@ class SerialSocket(BaseSocket):
|
||||
start_usb_id = usb_info["usb_id"]
|
||||
fd: Optional[int] = None
|
||||
with contextlib.suppress(OSError):
|
||||
fd = os.open(str(device), os.O_RDWR)
|
||||
fcntl.ioctl(
|
||||
fd, termios.TIOCMBIS, struct.pack('I', termios.TIOCM_DTR)
|
||||
)
|
||||
fd = os.open(str(device), os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
|
||||
dtr_data = struct.pack('I', termios.TIOCM_DTR)
|
||||
fcntl.ioctl(fd, termios.TIOCMBIS, dtr_data)
|
||||
t = termios.tcgetattr(fd)
|
||||
t[4] = t[5] = termios.B1200
|
||||
termios.tcsetattr(fd, termios.TCSANOW, t)
|
||||
fcntl.ioctl(
|
||||
fd, termios.TIOCMBIC, struct.pack('I', termios.TIOCM_DTR)
|
||||
)
|
||||
fcntl.ioctl(fd, termios.TIOCMBIC, dtr_data)
|
||||
if fd is not None:
|
||||
os.close(fd)
|
||||
output("Waiting for USB Reconnect.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user