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;
/* Open device */
- fd = serial_open(__file, O_RDONLY | O_NOCTTY | O_NONBLOCK);
+ fd = serial_open(__file, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd < 0)
return fd;
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
retcode=fcntl(fd, F_SETFL, FASYNC);
if (retcode == -1){
perror("Gnokii serial_opendevice: fnctl(F_SETFL)");
-#if 0
serial_close(fd);
return(-1);
-#endif
}
}
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;
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 */