gpsd-dev
[Top][All Lists]
Advanced

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

[gpsd-dev] cfmakeraw part 2


From: Greg Troxel
Subject: [gpsd-dev] cfmakeraw part 2
Date: Wed, 19 Jun 2019 20:35:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix)

An explanation of the cfmakeraw issue is at:

  https://perkin.org.uk/posts/solaris-portability-cfmakeraw.html

The short story is that cfmakeraw is a nonportable extension, but
apparently the same everywhere it exists, which I think includes linux,
*bsd, mac.

Perhaps gpsd.h should add __sun to the cfmakeraw decl, making the
implementation in serial.c visible, and not patch gpspipe.c.  I am
inclined to just do this and let the solaris people deal on the slight
chance that's wrong.

Is that ok?

$NetBSD: patch-gpspipe.c,v 1.2 2019/05/01 20:22:02 gdt Exp $

cfmakeraw compatability for SunOS.

--- gpspipe.c.orig      2018-09-22 23:24:39.000000000 +0000
+++ gpspipe.c
@@ -97,7 +97,15 @@ static void open_serial(char *device)
     memset(&newtio, 0, sizeof(newtio));
 
     /* make it raw */
+#if defined(__sun)
+    newtio.c_iflag &= 
~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    newtio.c_oflag &= ~OPOST;
+    newtio.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+    newtio.c_cflag &= ~(CSIZE|PARENB);
+    newtio.c_cflag |= CS8;
+#else
     (void)cfmakeraw(&newtio);
+#endif
     /* set speed */
     (void)cfsetospeed(&newtio, BAUDRATE);
 





reply via email to

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