datacalls decoding patches
[gnokii.git] / common / devices / unixserial.c
index bc7e37e..7ad6128 100644 (file)
@@ -81,8 +81,10 @@ int serial_open(__const char *__file, int __oflag) {
   if(retcode==-1) {
     perror("Gnokii serial_open:tcgetattr");
     /* Don't call serial_close since serial_termios is not valid */
+#if 0
     close(__fd);
     return(-1);
+#endif
   }
   
   return __fd;
@@ -108,7 +110,7 @@ int serial_opendevice(__const char *__file, int __with_odd_parity, int __with_as
 
   /* Open device */
 
-  fd = serial_open(__file, O_RDWR | O_NOCTTY | O_NONBLOCK);
+  fd = serial_open(__file, O_RDONLY | O_NOCTTY | O_NONBLOCK);
 
   if (fd < 0) 
     return fd;
@@ -119,8 +121,10 @@ int serial_opendevice(__const char *__file, int __with_odd_parity, int __with_as
   retcode = fcntl(fd, F_SETOWN, getpid());
   if (retcode == -1){
     perror("Gnokii serial_opendevice: fnctl(F_SETOWN)");
+#if 0
     serial_close(fd);
     return(-1);
+#endif
   }
 #endif
 
@@ -130,8 +134,10 @@ int serial_opendevice(__const char *__file, int __with_odd_parity, int __with_as
     retcode=fcntl(fd, F_SETFL, FASYNC);
     if (retcode == -1){
       perror("Gnokii serial_opendevice: fnctl(F_SETFL)");
+#if 0
       serial_close(fd);
       return(-1);
+#endif
     }
   }
   
@@ -161,15 +167,19 @@ int serial_opendevice(__const char *__file, int __with_odd_parity, int __with_as
   retcode=tcflush(fd, TCIFLUSH);
   if (retcode == -1) {
     perror("Gnokii serial_opendevice: tcflush");
+#if 0
     serial_close(fd);
     return(-1);
+#endif
   }
 
   retcode=tcsetattr(fd, TCSANOW, &tp);
   if (retcode == -1){
     perror("Gnokii serial_opendevice: tcsetattr");
+#if 0
     serial_close(fd);
     return(-1);
+#endif
   }
 
   return fd;
@@ -260,7 +270,10 @@ size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes) {
 
 size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n) {
        
+#if 0
        return (write(__fd, __buf, __n));
+#endif
+       return __n;
 }
 
 #endif  /* WIN32 */