Rev 487 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 487 | Rev 488 | ||
---|---|---|---|
Line 124... | Line 124... | ||
124 | p++; |
124 | p++; |
125 | // printf("b read\n"); |
125 | // printf("b read\n"); |
126 | count=read(mk_socket,&in_char,1); |
126 | count=read(mk_socket,&in_char,1); |
Line 127... | Line 127... | ||
127 | 127 | ||
128 | // if ( count ==-1) exit(0); |
128 | // if ( count ==-1) exit(0); |
129 | printf("a read %d %d %c \n",p,count,in_char); |
129 | printf("a read %d %d %c %d\n",p,count,in_char,in_char); |
130 | if (count!=-1) |
130 | if (count!=-1) |
131 | { |
131 | { |
132 | // printf("%c\n",in_char); |
132 | // printf("%c\n",in_char); |
Line 174... | Line 174... | ||
174 | 174 | ||
175 | 175 | ||
Line 176... | Line 176... | ||
176 | int connect_mk_tty(char* tty_filename) |
176 | int connect_mk_tty(char* tty_filename) |
Line 177... | Line 177... | ||
177 | { |
177 | { |
178 | 178 | ||
Line 179... | Line 179... | ||
179 | mk_socket = open(tty_filename,O_RDWR); |
179 | mk_socket = open(tty_filename,O_RDWR | O_NOCTTY); |
180 | 180 | ||
- | 181 | ||
- | 182 | ||
Line 181... | Line 183... | ||
181 | 183 | struct termios termattr; |
|
- | 184 | speed_t baudRate; |
|
- | 185 | ||
- | 186 | /* Make a copy of the termios structure. */ |
|
- | 187 | tcgetattr(mk_socket, &termattr); |
|
- | 188 | termattr.c_cc[VMIN]=0; |
|
- | 189 | termattr.c_cc[VTIME]=1; |
|
- | 190 | ||
- | 191 | termattr.c_cflag|=CREAD|CLOCAL; |
|
182 | 192 | termattr.c_lflag&=(~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG)); |
|
- | 193 | termattr.c_iflag&=(~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY)); |
|
- | 194 | termattr.c_oflag&=(~OPOST); |
|
- | 195 | termattr.c_cc[VMIN]=0; |
|
- | 196 | termattr.c_cc[VINTR] = _POSIX_VDISABLE; |
|
183 | struct termios termattr; |
197 | termattr.c_cc[VQUIT] = _POSIX_VDISABLE; |
- | 198 | termattr.c_cc[VSTART] = _POSIX_VDISABLE; |
|
- | 199 | termattr.c_cc[VSTOP] = _POSIX_VDISABLE; |
|
- | 200 | termattr.c_cc[VSUSP] = _POSIX_VDISABLE; |
|
184 | speed_t baudRate; |
201 | |
- | 202 | ||
- | 203 | //data 8 |
|
- | 204 | ||
185 | 205 | termattr.c_cflag&=(~CSIZE); |
|
186 | /* Make a copy of the termios structure. */ |
206 | |
- | 207 | // no par |
|
- | 208 | termattr.c_cflag&=(~PARENB); |
|
- | 209 | ||
187 | tcgetattr(mk_socket, &termattr); |
210 | termattr.c_cflag |=CS8 | CREAD | CLOCAL ; |
188 | 211 | termattr.c_iflag |= IGNPAR; |
|
189 | termattr.c_iflag = IGNBRK | IGNPAR; |
212 | // stop1 |
- | 213 | termattr.c_cflag&=(~CSTOPB); |
|
190 | termattr.c_cflag=CS8 | CREAD | CLOCAL ; |
214 | |
Line -... | Line 215... | ||
- | 215 | // Flow off |
|
- | 216 | termattr.c_cflag&=(~CRTSCTS); |
|
Line 191... | Line 217... | ||
191 | termattr.c_cflag&= ~CBAUD; |
217 | termattr.c_iflag&=(~(IXON|IXOFF|IXANY | ICRNL)); |
192 | 218 | ||
193 | termattr.c_cflag|=B57600; |
219 | |
194 | 220 |