From 1aa8035594cbb574f7ebe88bea36f976069c8105 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 9 Aug 2020 22:24:39 +0200 Subject: [PATCH] sp_close(): disable exclusive mode to allow re-opening the port later --- serialport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/serialport.c b/serialport.c index 1daba1c..3189935 100644 --- a/serialport.c +++ b/serialport.c @@ -680,6 +680,10 @@ SP_API enum sp_return sp_close(struct sp_port *port) port->write_buf = NULL; } #else +#ifdef TIOCNXCL + ioctl(port->fd, TIOCNXCL); +#endif + /* Returns 0 upon success, -1 upon failure. */ if (close(port->fd) == -1) RETURN_FAIL("close() failed");