RE: PATCH: X25 speed (AIX does not define B115200)
"Bostock James" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <84E219D8B81E5F4688C4A8992426CD8301318309@fr-par-mail01.comverse.com> |
> From: Vincent CHAVANIS > Sent: 10 July 2008 18:06 > > I'm +0 as it. > > The fact is that we need to choose the fastest available speed. > But assume at lease a default working speed as 9600bps > > Could you please modify your patch and submit it again? > > thanks! > > Vincent > Speeds of up to B38400 are defined by the Single UNIX Specification (http://www.opengroup.org/onlinepubs/007908799/xsh/termios.h.html) so I am not sure whether it is necessary to check for each constant from B9600 up to B115200 (by the way, does anyone know why B115200 is used and not one of the higher speeds that seemed to be defined in termios.h on operating systems other than AIX 5.2?). However, if this will make the difference between my patch being accepted or rejected, the updated patch (attached) does this. -james
kannel.x25-2.patch
(application/octet-stream, 1.3 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 11 Jul 2008 06:44:40 -0000
@@ -496,11 +496,31 @@
/* The speed initialisation is pretty important. */
tcgetattr(fd, &tios);
+#if defined(B115200)
cfsetospeed(&tios, B115200);
cfsetispeed(&tios, B115200);
+#elif defined(B76800)
+ cfsetospeed(&tios, B76800);
+ cfsetispeed(&tios, B76800);
+#elif defined(B57600)
+ cfsetospeed(&tios, B57600);
+ cfsetispeed(&tios, B57600);
+#elif defined(B38400)
+ cfsetospeed(&tios, B38400);
+ cfsetispeed(&tios, B38400);
+#elif defined(B19200)
+ cfsetospeed(&tios, B19200);
+ cfsetispeed(&tios, B19200);
+#elif defined(B9600)
+ cfsetospeed(&tios, B9600);
+ cfsetispeed(&tios, B9600);
+#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; ) {