changeset 96098:0d318323f2b7

* configure.in: Check for presence of cfmakeraw and cfsetspeed. * sysdep.c (cfmakeraw): Provide fallback implementation. (serial_configure): Provide fallback implementation of cfsetspeed.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 20 Jun 2008 14:50:20 +0000
parents 9c0e174f3a9c
children eb403674cfbf
files ChangeLog configure.in src/ChangeLog src/sysdep.c
diffstat 4 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 20 13:12:26 2008 +0000
+++ b/ChangeLog	Fri Jun 20 14:50:20 2008 +0000
@@ -1,3 +1,7 @@
+2008-06-20  Angelo Graziosi  <angelo.graziosi@alice.it>  (tiny change)
+
+	* configure.in: Check for presence of cfmakeraw and cfsetspeed.
+
 2008-06-15  Glenn Morris  <rgm@gnu.org>
 
 	* info/dir: Add sasl.
--- a/configure.in	Fri Jun 20 13:12:26 2008 +0000
+++ b/configure.in	Fri Jun 20 14:50:20 2008 +0000
@@ -2300,7 +2300,8 @@
 __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
 sendto recvfrom getsockopt setsockopt getsockname getpeername \
 gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
-memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign)
+memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
+cfmakeraw cfsetspeed)
 
 AC_CHECK_HEADERS(sys/un.h)
 
--- a/src/ChangeLog	Fri Jun 20 13:12:26 2008 +0000
+++ b/src/ChangeLog	Fri Jun 20 14:50:20 2008 +0000
@@ -1,3 +1,8 @@
+2008-06-20  Angelo Graziosi  <angelo.graziosi@alice.it>  (tiny change)
+
+	* sysdep.c (cfmakeraw): Provide fallback implementation.
+	(serial_configure): Provide fallback implementation of cfsetspeed.
+
 2008-06-20  Kenichi Handa  <handa@m17n.org>
 
 	* xftfont.c (xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to
--- a/src/sysdep.c	Fri Jun 20 13:12:26 2008 +0000
+++ b/src/sysdep.c	Fri Jun 20 14:50:20 2008 +0000
@@ -244,6 +244,10 @@
 
 SIGMASKTYPE sigprocmask_set;
 
+#if !defined (HAVE_CFMAKERAW)
+void cfmakeraw(struct termios *);
+#endif /* !defined (HAVE_CFMAKERAW */
+
 
 #if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME)
 
@@ -5447,7 +5451,12 @@
   else
     tem = Fplist_get (p->childp, QCspeed);
   CHECK_NUMBER (tem);
+#ifdef HAVE_CFSETSPEED
   err = cfsetspeed (&attr, XINT (tem));
+#else
+  err = cfsetispeed(&attr, XINT (tem));
+  err = err +  cfsetospeed(&attr, XINT (tem));
+#endif
   if (err != 0)
     error ("cfsetspeed(%d) failed: %s", XINT (tem), emacs_strerror (errno));
   childp2 = Fplist_put (childp2, QCspeed, tem);
@@ -5577,6 +5586,18 @@
   p->childp = childp2;
 
 }
+#if !defined (HAVE_CFMAKERAW)
+/* Workaround for targets which are missing cfmakeraw */
+/* Pasted from man page; added in serial.c arbitrarily */
+void cfmakeraw(struct termios *termios_p)
+{
+    termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    termios_p->c_oflag &= ~OPOST;
+    termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+    termios_p->c_cflag &= ~(CSIZE|PARENB);
+    termios_p->c_cflag |= CS8;
+}
+#endif /* !defined (HAVE_CFMAKERAW */
 #endif /* TERMIOS  */
 
 /* arch-tag: edb43589-4e09-4544-b325-978b5b121dcf