gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] gpsd: skip tcdrain() when closing in readonly mode


From: Jean Pierre TOSONI
Subject: [gpsd-dev] gpsd: skip tcdrain() when closing in readonly mode
Date: Mon, 12 Mar 2018 09:52:26 +0000

The Quectel EC25 device used with the Linux 3.10.20 usb/option driver
makes gpsd hang when it closes the serial port after receiving a SIGTERM.

Hanging is caused by the call to tcdrain(), which happens even when
gpsd is in read-only mode (-b argument).

In this mode, since nothing is ever written to the serial port, the
tcdrain call is not needed. Skip it.

--- a/serial.c
+++ b/serial.c
@@ -727,7 +727,8 @@ void gpsd_close(struct gps_device_t *ses
 #ifdef TIOCNXCL
        (void)ioctl(session->gpsdata.gps_fd, (unsigned long)TIOCNXCL);
 #endif /* TIOCNXCL */
-       (void)tcdrain(session->gpsdata.gps_fd);
+       if (!session->context->readonly)
+               (void)tcdrain(session->gpsdata.gps_fd);
        if (isatty(session->gpsdata.gps_fd) != 0) {
            /* force hangup on close on systems that don't do HUPCL properly */
            (void)cfsetispeed(&session->ttyset, (speed_t) B0);
--
quilt 0.48



reply via email to

[Prev in Thread] Current Thread [Next in Thread]