# HG changeset patch # User jeandet@pc-de-jeandet3.lab-lpp.local # Date 2012-03-21 13:58:21 # Node ID ffb9425c0576533cec0994051f023a8b0267291a # Parent b220a9e23d54d92a3df2c5ee322f232425c8cb69 fixed bug on Parity hndling under linux! diff --git a/src/RS232.h b/src/RS232.h --- a/src/RS232.h +++ b/src/RS232.h @@ -1,5 +1,6 @@ // SOPSUYSI_RS232.h - +#ifndef RS232_H +#define RS232_H #define debug #include "rs232config.h" @@ -18,7 +19,7 @@ typedef int rs232port_t; typedef speed_t rs232speed_t; typedef enum {rs232OneStop=1,rs232One5Stop=2,rs232TwoStop=2}rs232stop; - typedef enum {rs232parityNo=(~PARENB),rs232parityOdd=(PARENB|PARODD),rs232parityEven=(PARENB|~PARODD)}rs232parity; + typedef enum {rs232parityNo,rs232parityOdd,rs232parityEven}rs232parity; #endif #endif #ifdef __cplusplus @@ -35,3 +36,8 @@ rs232extern int rs232setparity(rs232port rs232extern int rs232setnbstop(rs232port_t fd, rs232stop NbStop); rs232extern int rs232setcsize(rs232port_t fd, int ChSize); rs232extern int rs232setbaudrate(rs232port_t fd, int baudrate); + +#endif + + + diff --git a/src/RS232_unix.c b/src/RS232_unix.c --- a/src/RS232_unix.c +++ b/src/RS232_unix.c @@ -98,15 +98,15 @@ int rs232setparity(rs232port_t fd, rs232 switch(Parity) { case rs232parityNo: - terminos.c_cflag &= Parity; + terminos.c_cflag &= ~PARENB; break; case rs232parityOdd: - terminos.c_cflag &= ~PARENB; - terminos.c_cflag |= Parity; + terminos.c_cflag |= PARENB; + terminos.c_cflag |= PARODD; break; case rs232parityEven: - terminos.c_cflag &= ~PARENB; - terminos.c_cflag |= Parity; + terminos.c_cflag |= PARENB; + terminos.c_cflag &= ~PARODD; break; default: terminos.c_cflag &= ~PARENB; diff --git a/src/rs232config.h.in~ b/src/rs232config.h.in~ deleted file mode 100755 --- a/src/rs232config.h.in~ +++ /dev/null @@ -1,77 +0,0 @@ -/* src/rs232config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMIOS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WINDOWS_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION