/[rdesktop]/sourceforge.net/trunk/rdesktop/serial.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /sourceforge.net/trunk/rdesktop/serial.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 782 - (show annotations)
Thu Oct 7 13:00:29 2004 UTC (19 years, 7 months ago) by astrand
File MIME type: text/plain
File size: 16575 byte(s)
Indent fixes

1 #include <unistd.h>
2 #include <fcntl.h>
3 #include <termios.h>
4 #include <strings.h>
5 #include <sys/ioctl.h>
6 #include "rdesktop.h"
7
8 #define FILE_DEVICE_SERIAL_PORT 0x1b
9
10 #define SERIAL_SET_BAUD_RATE 1
11 #define SERIAL_SET_QUEUE_SIZE 2
12 #define SERIAL_SET_LINE_CONTROL 3
13 #define SERIAL_SET_BREAK_ON 4
14 #define SERIAL_SET_BREAK_OFF 5
15 #define SERIAL_IMMEDIATE_CHAR 6
16 #define SERIAL_SET_TIMEOUTS 7
17 #define SERIAL_GET_TIMEOUTS 8
18 #define SERIAL_SET_DTR 9
19 #define SERIAL_CLR_DTR 10
20 #define SERIAL_RESET_DEVICE 11
21 #define SERIAL_SET_RTS 12
22 #define SERIAL_CLR_RTS 13
23 #define SERIAL_SET_XOFF 14
24 #define SERIAL_SET_XON 15
25 #define SERIAL_GET_WAIT_MASK 16
26 #define SERIAL_SET_WAIT_MASK 17
27 #define SERIAL_WAIT_ON_MASK 18
28 #define SERIAL_PURGE 19
29 #define SERIAL_GET_BAUD_RATE 20
30 #define SERIAL_GET_LINE_CONTROL 21
31 #define SERIAL_GET_CHARS 22
32 #define SERIAL_SET_CHARS 23
33 #define SERIAL_GET_HANDFLOW 24
34 #define SERIAL_SET_HANDFLOW 25
35 #define SERIAL_GET_MODEMSTATUS 26
36 #define SERIAL_GET_COMMSTATUS 27
37 #define SERIAL_XOFF_COUNTER 28
38 #define SERIAL_GET_PROPERTIES 29
39 #define SERIAL_GET_DTRRTS 30
40 #define SERIAL_LSRMST_INSERT 31
41 #define SERIAL_CONFIG_SIZE 32
42 #define SERIAL_GET_COMMCONFIG 33
43 #define SERIAL_SET_COMMCONFIG 34
44 #define SERIAL_GET_STATS 35
45 #define SERIAL_CLEAR_STATS 36
46 #define SERIAL_GET_MODEM_CONTROL 37
47 #define SERIAL_SET_MODEM_CONTROL 38
48 #define SERIAL_SET_FIFO_CONTROL 39
49
50 #define STOP_BITS_1 0
51 #define STOP_BITS_2 2
52
53 #define NO_PARITY 0
54 #define ODD_PARITY 1
55 #define EVEN_PARITY 2
56
57 #define SERIAL_PURGE_TXABORT 0x00000001
58 #define SERIAL_PURGE_RXABORT 0x00000002
59 #define SERIAL_PURGE_TXCLEAR 0x00000004
60 #define SERIAL_PURGE_RXCLEAR 0x00000008
61
62 /* SERIAL_WAIT_ON_MASK */
63 #define SERIAL_EV_RXCHAR 0x0001 // Any Character received
64 #define SERIAL_EV_RXFLAG 0x0002 // Received certain character
65 #define SERIAL_EV_TXEMPTY 0x0004 // Transmitt Queue Empty
66 #define SERIAL_EV_CTS 0x0008 // CTS changed state
67 #define SERIAL_EV_DSR 0x0010 // DSR changed state
68 #define SERIAL_EV_RLSD 0x0020 // RLSD changed state
69 #define SERIAL_EV_BREAK 0x0040 // BREAK received
70 #define SERIAL_EV_ERR 0x0080 // Line status error occurred
71 #define SERIAL_EV_RING 0x0100 // Ring signal detected
72 #define SERIAL_EV_PERR 0x0200 // Printer error occured
73 #define SERIAL_EV_RX80FULL 0x0400 // Receive buffer is 80 percent full
74 #define SERIAL_EV_EVENT1 0x0800 // Provider specific event 1
75 #define SERIAL_EV_EVENT2 0x1000 // Provider specific event 2
76
77 /* Modem Status */
78 #define SERIAL_MS_CTS 0x10
79 #define SERIAL_MS_DSR 0x20
80 #define SERIAL_MS_RNG 0x40
81 #define SERIAL_MS_CAR 0x80
82
83 #ifndef CRTSCTS
84 #define CRTSCTS 0
85 #endif
86
87
88 extern RDPDR_DEVICE g_rdpdr_device[];
89
90 static SERIAL_DEVICE *
91 get_serial_info(NTHANDLE handle)
92 {
93 int index;
94
95 for (index = 0; index < RDPDR_MAX_DEVICES; index++)
96 {
97 if (handle == g_rdpdr_device[index].handle)
98 return (SERIAL_DEVICE *) g_rdpdr_device[index].pdevice_data;
99 }
100 return NULL;
101 }
102
103 static BOOL
104 get_termios(SERIAL_DEVICE * pser_inf, NTHANDLE serial_fd)
105 {
106 speed_t speed;
107 struct termios *ptermios;
108
109 ptermios = pser_inf->ptermios;
110
111 if (tcgetattr(serial_fd, ptermios) == -1)
112 return False;
113
114 speed = cfgetispeed(ptermios);
115 switch (speed)
116 {
117 #ifdef B75
118 case B75:
119 pser_inf->baud_rate = 75;
120 break;
121 #endif
122 #ifdef B110
123 case B110:
124 pser_inf->baud_rate = 110;
125 break;
126 #endif
127 #ifdef B134
128 case B134:
129 pser_inf->baud_rate = 134;
130 break;
131 #endif
132 #ifdef B150
133 case B150:
134 pser_inf->baud_rate = 150;
135 break;
136 #endif
137 #ifdef B300
138 case B300:
139 pser_inf->baud_rate = 300;
140 break;
141 #endif
142 #ifdef B600
143 case B600:
144 pser_inf->baud_rate = 600;
145 break;
146 #endif
147 #ifdef B1200
148 case B1200:
149 pser_inf->baud_rate = 1200;
150 break;
151 #endif
152 #ifdef B1800
153 case B1800:
154 pser_inf->baud_rate = 1800;
155 break;
156 #endif
157 #ifdef B2400
158 case B2400:
159 pser_inf->baud_rate = 2400;
160 break;
161 #endif
162 #ifdef B4800
163 case B4800:
164 pser_inf->baud_rate = 4800;
165 break;
166 #endif
167 #ifdef B9600
168 case B9600:
169 pser_inf->baud_rate = 9600;
170 break;
171 #endif
172 #ifdef B19200
173 case B19200:
174 pser_inf->baud_rate = 19200;
175 break;
176 #endif
177 #ifdef B38400
178 case B38400:
179 pser_inf->baud_rate = 38400;
180 break;
181 #endif
182 #ifdef B57600
183 case B57600:
184 pser_inf->baud_rate = 57600;
185 break;
186 #endif
187 #ifdef B115200
188 case B115200:
189 pser_inf->baud_rate = 115200;
190 break;
191 #endif
192 default:
193 pser_inf->baud_rate = 0;
194 break;
195 }
196
197 speed = cfgetospeed(ptermios);
198 pser_inf->dtr = (speed == B0) ? 0 : 1;
199
200 pser_inf->stop_bits = (ptermios->c_cflag & CSTOPB) ? STOP_BITS_2 : STOP_BITS_1;
201 pser_inf->parity =
202 (ptermios->
203 c_cflag & PARENB) ? ((ptermios->
204 c_cflag & PARODD) ? ODD_PARITY : EVEN_PARITY) : NO_PARITY;
205 switch (ptermios->c_cflag & CSIZE)
206 {
207 case CS5:
208 pser_inf->word_length = 5;
209 break;
210 case CS6:
211 pser_inf->word_length = 6;
212 break;
213 case CS7:
214 pser_inf->word_length = 7;
215 break;
216 default:
217 pser_inf->word_length = 8;
218 break;
219 }
220
221 pser_inf->rts = (ptermios->c_cflag & CRTSCTS) ? 1 : 0;
222
223 return True;
224 }
225
226 static void
227 set_termios(SERIAL_DEVICE * pser_inf, NTHANDLE serial_fd)
228 {
229 speed_t speed;
230
231 struct termios *ptermios;
232
233 ptermios = pser_inf->ptermios;
234
235
236 switch (pser_inf->baud_rate)
237 {
238 #ifdef B75
239 case 75:
240 speed = B75;
241 break;
242 #endif
243 #ifdef B110
244 case 110:
245 speed = B110;
246 break;
247 #endif
248 #ifdef B134
249 case 134:
250 speed = B134;
251 break;
252 #endif
253 #ifdef B150
254 case 150:
255 speed = B150;
256 break;
257 #endif
258 #ifdef B300
259 case 300:
260 speed = B300;
261 break;
262 #endif
263 #ifdef B600
264 case 600:
265 speed = B600;
266 break;
267 #endif
268 #ifdef B1200
269 case 1200:
270 speed = B1200;
271 break;
272 #endif
273 #ifdef B1800
274 case 1800:
275 speed = B1800;
276 break;
277 #endif
278 #ifdef B2400
279 case 2400:
280 speed = B2400;
281 break;
282 #endif
283 #ifdef B4800
284 case 4800:
285 speed = B4800;
286 break;
287 #endif
288 #ifdef B9600
289 case 9600:
290 speed = B9600;
291 break;
292 #endif
293 #ifdef B19200
294 case 19200:
295 speed = B19200;
296 break;
297 #endif
298 #ifdef B38400
299 case 38400:
300 speed = B38400;
301 break;
302 #endif
303 #ifdef B57600
304 case 57600:
305 speed = B57600;
306 break;
307 #endif
308 #ifdef B115200
309 case 115200:
310 speed = B115200;
311 break;
312 #endif
313 default:
314 speed = B0;
315 break;
316 }
317
318 /* on systems with separate ispeed and ospeed, we can remember the speed
319 in ispeed while changing DTR with ospeed */
320 cfsetispeed(pser_inf->ptermios, speed);
321 cfsetospeed(pser_inf->ptermios, pser_inf->dtr ? speed : 0);
322
323 ptermios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CSIZE | CRTSCTS);
324 switch (pser_inf->stop_bits)
325 {
326 case STOP_BITS_2:
327 ptermios->c_cflag |= CSTOPB;
328 break;
329 }
330
331 switch (pser_inf->parity)
332 {
333 case EVEN_PARITY:
334 ptermios->c_cflag |= PARENB;
335 break;
336 case ODD_PARITY:
337 ptermios->c_cflag |= PARENB | PARODD;
338 break;
339 }
340
341 switch (pser_inf->word_length)
342 {
343 case 5:
344 ptermios->c_cflag |= CS5;
345 break;
346 case 6:
347 ptermios->c_cflag |= CS6;
348 break;
349 case 7:
350 ptermios->c_cflag |= CS7;
351 break;
352 default:
353 ptermios->c_cflag |= CS8;
354 break;
355 }
356
357 if (pser_inf->rts)
358 ptermios->c_cflag |= CRTSCTS;
359
360 tcsetattr(serial_fd, TCSANOW, ptermios);
361 }
362
363 /* Enumeration of devices from rdesktop.c */
364 /* returns numer of units found and initialized. */
365 /* optarg looks like ':com1=/dev/ttyS0' */
366 /* when it arrives to this function. */
367 /* :com1=/dev/ttyS0,com2=/dev/ttyS1 */
368 int
369 serial_enum_devices(uint32 * id, char *optarg)
370 {
371 SERIAL_DEVICE *pser_inf;
372
373 char *pos = optarg;
374 char *pos2;
375 int count = 0;
376
377 // skip the first colon
378 optarg++;
379 while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES)
380 {
381 // Init data structures for device
382 pser_inf = (SERIAL_DEVICE *) xmalloc(sizeof(SERIAL_DEVICE));
383 pser_inf->ptermios = (struct termios *) xmalloc(sizeof(struct termios));
384 memset(pser_inf->ptermios, 0, sizeof(struct termios));
385 pser_inf->pold_termios = (struct termios *) xmalloc(sizeof(struct termios));
386 memset(pser_inf->pold_termios, 0, sizeof(struct termios));
387
388 pos2 = next_arg(optarg, '=');
389 strcpy(g_rdpdr_device[*id].name, optarg);
390
391 toupper_str(g_rdpdr_device[*id].name);
392
393 g_rdpdr_device[*id].local_path = xmalloc(strlen(pos2) + 1);
394 strcpy(g_rdpdr_device[*id].local_path, pos2);
395 printf("SERIAL %s to %s\n", g_rdpdr_device[*id].name,
396 g_rdpdr_device[*id].local_path);
397 // set device type
398 g_rdpdr_device[*id].device_type = DEVICE_TYPE_SERIAL;
399 g_rdpdr_device[*id].pdevice_data = (void *) pser_inf;
400 count++;
401 (*id)++;
402
403 optarg = pos;
404 }
405 return count;
406 }
407
408 static NTSTATUS
409 serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition,
410 uint32 flags_and_attributes, char *filename, NTHANDLE * handle)
411 {
412 NTHANDLE serial_fd;
413 SERIAL_DEVICE *pser_inf;
414 struct termios *ptermios;
415
416 pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[device_id].pdevice_data;
417 ptermios = pser_inf->ptermios;
418 serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY | O_NONBLOCK);
419
420 if (serial_fd == -1)
421 {
422 perror("open");
423 return STATUS_ACCESS_DENIED;
424 }
425
426 if (!get_termios(pser_inf, serial_fd))
427 {
428 printf("INFO: SERIAL %s access denied\n", g_rdpdr_device[device_id].name);
429 fflush(stdout);
430 return STATUS_ACCESS_DENIED;
431 }
432
433 // Store handle for later use
434 g_rdpdr_device[device_id].handle = serial_fd;
435
436 /* some sane information */
437 printf("INFO: SERIAL %s to %s\nINFO: speed %u baud, stop bits %u, parity %u, word length %u bits, dtr %u, rts %u\n", g_rdpdr_device[device_id].name, g_rdpdr_device[device_id].local_path, pser_inf->baud_rate, pser_inf->stop_bits, pser_inf->parity, pser_inf->word_length, pser_inf->dtr, pser_inf->rts);
438
439 printf("INFO: use stty to change settings\n");
440
441 /* ptermios->c_cflag = B115200 | CRTSCTS | CS8 | CLOCAL | CREAD;
442 ptermios->c_cflag |= CREAD;
443 ptermios->c_lflag |= ICANON;
444 ptermios->c_iflag = IGNPAR | ICRNL;
445
446 tcsetattr(serial_fd, TCSANOW, ptermios);
447 */
448 pser_inf->ptermios->c_iflag &=
449 ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
450 pser_inf->ptermios->c_oflag &= ~OPOST;
451 pser_inf->ptermios->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
452 pser_inf->ptermios->c_cflag &= ~(CSIZE | PARENB);
453 pser_inf->ptermios->c_cflag |= CS8;
454 tcsetattr(serial_fd, TCSANOW, pser_inf->ptermios);
455
456 *handle = serial_fd;
457
458 /* all read and writes should be non blocking */
459 if (fcntl(*handle, F_SETFL, O_NONBLOCK) == -1)
460 perror("fcntl");
461
462 return STATUS_SUCCESS;
463 }
464
465 static NTSTATUS
466 serial_close(NTHANDLE handle)
467 {
468 int i = get_device_index(handle);
469 if (i >= 0)
470 g_rdpdr_device[i].handle = 0;
471 close(handle);
472 return STATUS_SUCCESS;
473 }
474
475 static NTSTATUS
476 serial_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
477 {
478 long timeout;
479 SERIAL_DEVICE *pser_inf;
480 struct termios *ptermios;
481
482 timeout = 90;
483 pser_inf = get_serial_info(handle);
484 ptermios = pser_inf->ptermios;
485
486 // Set timeouts kind of like the windows serial timeout parameters. Multiply timeout
487 // with requested read size
488 if (pser_inf->read_total_timeout_multiplier | pser_inf->read_total_timeout_constant)
489 {
490 timeout =
491 (pser_inf->read_total_timeout_multiplier * length +
492 pser_inf->read_total_timeout_constant + 99) / 100;
493 }
494 else if (pser_inf->read_interval_timeout)
495 {
496 timeout = (pser_inf->read_interval_timeout * length + 99) / 100;
497 }
498
499 // If a timeout is set, do a blocking read, which times out after some time.
500 // It will make rdesktop less responsive, but it will improve serial performance, by not
501 // reading one character at a time.
502 if (timeout == 0)
503 {
504 ptermios->c_cc[VTIME] = 0;
505 ptermios->c_cc[VMIN] = 0;
506 }
507 else
508 {
509 ptermios->c_cc[VTIME] = timeout;
510 ptermios->c_cc[VMIN] = 1;
511 }
512 tcsetattr(handle, TCSANOW, ptermios);
513
514
515 *result = read(handle, data, length);
516
517 //hexdump(data, *read);
518
519 return STATUS_SUCCESS;
520 }
521
522 static NTSTATUS
523 serial_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
524 {
525 *result = write(handle, data, length);
526 return STATUS_SUCCESS;
527 }
528
529 static NTSTATUS
530 serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
531 {
532 #if 0
533 int flush_mask, purge_mask;
534 #endif
535 uint32 result, modemstate;
536 uint8 immediate;
537 SERIAL_DEVICE *pser_inf;
538 struct termios *ptermios;
539
540 if ((request >> 16) != FILE_DEVICE_SERIAL_PORT)
541 return STATUS_INVALID_PARAMETER;
542
543 pser_inf = get_serial_info(handle);
544 ptermios = pser_inf->ptermios;
545
546 /* extract operation */
547 request >>= 2;
548 request &= 0xfff;
549
550 printf("SERIAL IOCTL %d\n", request);
551
552 switch (request)
553 {
554 case SERIAL_SET_BAUD_RATE:
555 in_uint32_le(in, pser_inf->baud_rate);
556 set_termios(pser_inf, handle);
557 break;
558 case SERIAL_GET_BAUD_RATE:
559 out_uint32_le(out, pser_inf->baud_rate);
560 break;
561 case SERIAL_SET_QUEUE_SIZE:
562 in_uint32_le(in, pser_inf->queue_in_size);
563 in_uint32_le(in, pser_inf->queue_out_size);
564 break;
565 case SERIAL_SET_LINE_CONTROL:
566 in_uint8(in, pser_inf->stop_bits);
567 in_uint8(in, pser_inf->parity);
568 in_uint8(in, pser_inf->word_length);
569 set_termios(pser_inf, handle);
570 break;
571 case SERIAL_GET_LINE_CONTROL:
572 out_uint8(out, pser_inf->stop_bits);
573 out_uint8(out, pser_inf->parity);
574 out_uint8(out, pser_inf->word_length);
575 break;
576 case SERIAL_IMMEDIATE_CHAR:
577 in_uint8(in, immediate);
578 serial_write(handle, &immediate, 1, 0, &result);
579 break;
580 case SERIAL_CONFIG_SIZE:
581 out_uint32_le(out, 0);
582 break;
583 case SERIAL_GET_CHARS:
584 out_uint8s(out, 6);
585 break;
586 case SERIAL_SET_CHARS:
587 in_uint8s(in, 6);
588 break;
589 case SERIAL_GET_HANDFLOW:
590 out_uint32_le(out, 0);
591 out_uint32_le(out, 3); /* Xon/Xoff */
592 out_uint32_le(out, 0);
593 out_uint32_le(out, 0);
594 break;
595 case SERIAL_SET_HANDFLOW:
596 in_uint8s(in, 16);
597 break;
598 case SERIAL_SET_TIMEOUTS:
599 in_uint8s(in, 20);
600 break;
601 case SERIAL_GET_TIMEOUTS:
602 out_uint8s(out, 20);
603 break;
604 case SERIAL_GET_WAIT_MASK:
605 out_uint32(out, pser_inf->wait_mask);
606 break;
607 case SERIAL_SET_WAIT_MASK:
608 in_uint32(in, pser_inf->wait_mask);
609 break;
610 case SERIAL_SET_DTR:
611 pser_inf->dtr = 1;
612 set_termios(pser_inf, handle);
613 break;
614 case SERIAL_CLR_DTR:
615 pser_inf->dtr = 0;
616 set_termios(pser_inf, handle);
617 break;
618 case SERIAL_SET_RTS:
619 pser_inf->rts = 1;
620 set_termios(pser_inf, handle);
621 break;
622 case SERIAL_CLR_RTS:
623 pser_inf->rts = 0;
624 set_termios(pser_inf, handle);
625 break;
626 case SERIAL_GET_MODEMSTATUS:
627 modemstate = 0;
628 #ifdef TIOCMGET
629 ioctl(handle, TIOCMGET, &result);
630 if (result & TIOCM_CTS)
631 modemstate |= SERIAL_MS_CTS;
632 if (result & TIOCM_DSR)
633 modemstate |= SERIAL_MS_DSR;
634 if (result & TIOCM_RNG)
635 modemstate |= SERIAL_MS_RNG;
636 if (result & TIOCM_CAR)
637 modemstate |= SERIAL_MS_CAR;
638 #endif
639 out_uint32_le(out, modemstate);
640 break;
641 case SERIAL_GET_COMMSTATUS:
642 out_uint32_le(out, 0); /* Errors */
643 out_uint32_le(out, 0); /* Hold reasons */
644 out_uint32_le(out, 0); /* Amount in in queue */
645 out_uint32_le(out, 0); /* Amount in out queue */
646 out_uint8(out, 0); /* EofReceived */
647 out_uint8(out, 0); /* WaitForImmediate */
648 break;
649 #if 0
650 case SERIAL_PURGE:
651 printf("SERIAL_PURGE\n");
652 in_uint32(in, purge_mask);
653 if (purge_mask & 0x04)
654 flush_mask |= TCOFLUSH;
655 if (purge_mask & 0x08)
656 flush_mask |= TCIFLUSH;
657 if (flush_mask != 0)
658 tcflush(handle, flush_mask);
659 if (purge_mask & 0x01)
660 rdpdr_abort_io(handle, 4, STATUS_CANCELLED);
661 if (purge_mask & 0x02)
662 rdpdr_abort_io(handle, 3, STATUS_CANCELLED);
663 break;
664 case SERIAL_WAIT_ON_MASK:
665 /* XXX implement me */
666 out_uint32_le(out, pser_inf->wait_mask);
667 break;
668 case SERIAL_SET_BREAK_ON:
669 tcsendbreak(serial_fd, 0);
670 break;
671 case SERIAL_RESET_DEVICE:
672 case SERIAL_SET_BREAK_OFF:
673 case SERIAL_SET_XOFF:
674 case SERIAL_SET_XON:
675 /* ignore */
676 break;
677 #endif
678 default:
679 unimpl("SERIAL IOCTL %d\n", request);
680 return STATUS_INVALID_PARAMETER;
681 }
682
683 return STATUS_SUCCESS;
684 }
685
686 /* Read timeout for a given file descripter (device) when adding fd's to select() */
687 BOOL
688 serial_get_timeout(NTHANDLE handle, uint32 length, uint32 * timeout, uint32 * itv_timeout)
689 {
690 int index;
691 SERIAL_DEVICE *pser_inf;
692
693 index = get_device_index(handle);
694 if (index < 0)
695 return True;
696
697 if (g_rdpdr_device[index].device_type != DEVICE_TYPE_SERIAL)
698 {
699 return False;
700 }
701
702 pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[index].pdevice_data;
703
704 *timeout =
705 pser_inf->read_total_timeout_multiplier * length +
706 pser_inf->read_total_timeout_constant;
707 *itv_timeout = pser_inf->read_interval_timeout;
708 return True;
709 }
710
711 DEVICE_FNS serial_fns = {
712 serial_create,
713 serial_close,
714 serial_read,
715 serial_write,
716 serial_device_control
717 };

  ViewVC Help
Powered by ViewVC 1.1.26