X-Git-Url: http://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=common%2Fdevices%2Funixserial.c;h=bc7e37eb0dbace25d9f7dfd91df3ea5ad0cca651;hp=7ad6128a39fc667875d3630141bf611da8af6732;hb=83b249229c87ceae3a67ab55a1f88ce07bae638c;hpb=5d49fe8eea4e11457b4f9904eb0d5db435679841 diff --git a/common/devices/unixserial.c b/common/devices/unixserial.c index 7ad6128..bc7e37e 100644 --- a/common/devices/unixserial.c +++ b/common/devices/unixserial.c @@ -81,10 +81,8 @@ 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; @@ -110,7 +108,7 @@ int serial_opendevice(__const char *__file, int __with_odd_parity, int __with_as /* 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; @@ -121,10 +119,8 @@ 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 @@ -134,10 +130,8 @@ 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 } } @@ -167,19 +161,15 @@ 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; @@ -270,10 +260,7 @@ 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 */