http://marcin-wiacek.fkn.pl/english/zips/mygnokii.tar.gz
[gnokii.git] / common / devices / unixserial.c
index 5186465..bc7e37e 100644 (file)
@@ -6,42 +6,8 @@
 
   A Linux/Unix toolset and driver for Nokia mobile phones.
 
-  Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml.
-
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
-  $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:09  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.10  2001/11/14 10:46:12  pkot
-  Small cleanup with __unices__
-
-  Revision 1.9  2001/09/14 12:15:28  pkot
-  Cleanups from 0.3.3 (part1)
-
-  Revision 1.8  2001/08/20 23:27:37  pkot
-  Add hardware shakehand to the link layer (Manfred Jonsson)
-
-  Revision 1.7  2001/07/03 00:03:36  pkot
-  Small fixes to let gnokii compile and work under solaris (thanks to Artur Kubiak)
-
-  Revision 1.6  2001/03/21 23:36:04  chris
-  Added the statemachine
-  This will break gnokii --identify and --monitor except for 6210/7110
-
-  Revision 1.5  2001/03/19 23:43:46  pkot
-  Solaris/ *BSD '#if defined' cleanup
-
-  Revision 1.4  2001/03/13 01:21:38  pkot
-  *BSD updates (Bert Driehuis)
-
-  Revision 1.3  2001/03/06 22:27:46  pkot
-  Misc docs and Makefiles updates and cleanups
-
-  Revision 1.2  2001/02/21 19:57:05  chris
-  More fiddling with the directory layout
-
 */
 
 #include "misc.h"
 #include <sys/ioctl.h>
 #include <string.h>
 
+#if __unices__
+#  include <sys/file.h>
+#endif
+
 #include <termios.h>
 #include "devices/unixserial.h"
 
@@ -213,17 +183,13 @@ void serial_setdtrrts(int __fd, int __dtr, int __rts) {
 
   flags = TIOCM_DTR;
 
-  if (__dtr)
-    ioctl(__fd, TIOCMBIS, &flags);
-  else
-    ioctl(__fd, TIOCMBIC, &flags);
+  if (__dtr) ioctl(__fd, TIOCMBIS, &flags);
+        else ioctl(__fd, TIOCMBIC, &flags);
 
   flags = TIOCM_RTS;
 
-  if (__rts)
-    ioctl(__fd, TIOCMBIS, &flags);
-  else
-    ioctl(__fd, TIOCMBIC, &flags);
+  if (__rts) ioctl(__fd, TIOCMBIS, &flags);
+        else ioctl(__fd, TIOCMBIC, &flags);
 }
 
 
@@ -265,8 +231,12 @@ void serial_changespeed(int __fd, int __speed) {
   // This is not needed! We set up the speed via cfsetspeed
   //  t.c_cflag &= ~CBAUD;
   //  t.c_cflag |= speed;
+#ifdef DEBUG
   if (cfsetspeed(&t, speed) == -1)
-       dprintf(_("Serial port speed setting failed\n"));
+       fprintf(stdout,_("Serial port speed setting failed\n"));
+#else
+  cfsetspeed(&t, speed);
+#endif
 
   tcsetattr(__fd, TCSADRAIN, &t);
 #else