##// END OF EJS Templates
Improved linux support
yannic -
r11:8c2d8af9e068 alexis
parent child
Show More
@@ -140,7 +140,6 LIPO = @LIPO@
140 140 LN_S = @LN_S@
141 141 LTLIBOBJS = @LTLIBOBJS@
142 142 MAKEINFO = @MAKEINFO@
143 MANIFEST_TOOL = @MANIFEST_TOOL@
144 143 MKDIR_P = @MKDIR_P@
145 144 NM = @NM@
146 145 NMEDIT = @NMEDIT@
@@ -168,7 +167,6 abs_builddir = @abs_builddir@
168 167 abs_srcdir = @abs_srcdir@
169 168 abs_top_builddir = @abs_top_builddir@
170 169 abs_top_srcdir = @abs_top_srcdir@
171 ac_ct_AR = @ac_ct_AR@
172 170 ac_ct_CC = @ac_ct_CC@
173 171 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
174 172 am__include = @am__include@
@@ -201,6 +199,7 libdir = @libdir@
201 199 libexecdir = @libexecdir@
202 200 localedir = @localedir@
203 201 localstatedir = @localstatedir@
202 lt_ECHO = @lt_ECHO@
204 203 mandir = @mandir@
205 204 mkdir_p = @mkdir_p@
206 205 oldincludedir = @oldincludedir@
@@ -1,4 +1,7
1 1 // SOPSUYSI_RS232.h
2
3 #define debug
4
2 5 #include "rs232config.h"
3 6
4 7 #ifdef HAVE_WINDOWS_H
@@ -18,6 +18,9 rs232port_t rs232open(char* psPortName)
18 18 {
19 19 rs232port_t fd;
20 20 fd = open(psPortName, O_RDWR | O_NOCTTY | O_NDELAY);
21 #ifdef debug
22 if(fd==-1)printf("can't open Port\n");
23 #endif
21 24 return fd;
22 25 }
23 26
@@ -51,7 +54,12 int rs232setup(rs232port_t fd, int ChSiz
51 54 rs232cfparity(fd, &terminos, Parity);
52 55 rs232cfnbstop(fd, &terminos, NbStop);
53 56 rs232cfcsize(fd, &terminos, ChSize);
57
58 #ifdef debug
59 if(tcsetattr(fd, TCSANOW, &terminos)!=0)printf("bad setup\n");
60 #else
54 61 tcsetattr(fd, TCSANOW, &terminos);
62 #endif
55 63 return 0;
56 64 }
57 65 }
@@ -83,7 +91,23 int rs232setparity(rs232port_t fd, rs232
83 91 {
84 92 struct termios terminos;
85 93 tcgetattr(fd, &terminos);
86 terminos.c_cflag = Parity;
94 switch(Parity)
95 {
96 case rs232parityNo:
97 terminos.c_cflag &= Parity;
98 break;
99 case rs232parityOdd:
100 terminos.c_cflag &= ~PARENB;
101 terminos.c_cflag |= Parity;
102 break;
103 case rs232parityEven:
104 terminos.c_cflag &= ~PARENB;
105 terminos.c_cflag |= Parity;
106 break;
107 default:
108 terminos.c_cflag &= ~PARENB;
109 break;
110 }
87 111 tcsetattr(fd, TCSANOW, &terminos);
88 112 return 0;
89 113 }
@@ -212,7 +236,23 int rs232cfparity(int fd, struct termios
212 236 }
213 237 else
214 238 {
215 terminos->c_cflag = Parity;
239 switch(Parity)
240 {
241 case rs232parityNo:
242 terminos->c_cflag &= Parity;
243 break;
244 case rs232parityOdd:
245 terminos->c_cflag &= ~PARENB;
246 terminos->c_cflag |= Parity;
247 break;
248 case rs232parityEven:
249 terminos->c_cflag &= ~PARENB;
250 terminos->c_cflag |= Parity;
251 break;
252 default:
253 terminos->c_cflag &= ~PARENB;
254 break;
255 }
216 256 return 0;
217 257 }
218 258 }
General Comments 0
You need to be logged in to leave comments. Login now