PATCH: X25 speed (AIX does not define B115200)

"Bostock James" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <84E219D8B81E5F4688C4A8992426CD8301318271@fr-par-mail01.comverse.com>
Hi,

There seemed to be consensus that this patch was acceptable but it
hasn't made its way into CVS so I am resending it (with the inclusion of
Vincent's suggestion to check the return value of tcsetattr()).

-james
kannel.x25.patch (application/octet-stream, 1 KB)
Index: gw/smsc/smsc_emi_x25.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_emi_x25.c,v
retrieving revision 1.9
diff -u -r1.9 smsc_emi_x25.c
--- gw/smsc/smsc_emi_x25.c	5 Mar 2008 08:01:07 -0000	1.9
+++ gw/smsc/smsc_emi_x25.c	10 Jul 2008 14:35:35 -0000
@@ -496,11 +496,22 @@
 
     /* The speed initialisation is pretty important. */
     tcgetattr(fd, &tios);
+#if defined(B115200)
     cfsetospeed(&tios, B115200);
     cfsetispeed(&tios, B115200);
+#elif defined(B57600)
+    cfsetospeed(&tios, B57600);
+    cfsetispeed(&tios, B57600);
+#elif defined(B38400)
+    cfsetospeed(&tios, B38400);
+    cfsetispeed(&tios, B38400);
+#endif
     kannel_cfmakeraw(&tios);
     tios.c_cflag |= (HUPCL | CREAD | CRTSCTS);
-    tcsetattr(fd, TCSANOW, &tios);
+    ret = tcsetattr(fd, TCSANOW, &tios);
+    if (ret == -1) {
+        error(errno, "EMI[X25]: at_dial: fail to set termios attribute");
+    }
 
     /* Dial using an AT command string. */
     for (redial = 1; redial; ) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.