MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / tcsetattr

Function tcsetattr

lib/termios.c:2621–2824  ·  view source on GitHub ↗

---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/

Source from the content-addressed store, hash-verified

2619 comments:
2620----------------------------------------------------------*/
2621int tcsetattr(int fd, int when, struct termios *s_termios)
2622{
2623 int vtime;
2624 DCB dcb;
2625 COMMTIMEOUTS timeouts;
2626 struct termios_list *index;
2627
2628 ENTER("tcsetattr");
2629
2630 if (fd <= 0)
2631 {
2632 return 0;
2633 }
2634
2635 index = win32_serial_find_port(fd);
2636
2637 if (!index)
2638 {
2639 LEAVE("tcsetattr");
2640 return -1;
2641 }
2642
2643 fflush(stdout);
2644
2645 if (s_termios->c_lflag & ICANON)
2646 {
2647 report("tcsetattr: no canonical mode support\n");
2648 /* and all other c_lflags too */
2649 return -1;
2650 }
2651
2652 if (!GetCommState(index->hComm, &dcb))
2653 {
2654 YACK();
2655 report("tcsetattr:GetCommState\n");
2656 return -1;
2657 }
2658
2659 if (!GetCommTimeouts(index->hComm, &timeouts))
2660 {
2661 YACK();
2662 report("tcsetattr:GetCommTimeouts\n");
2663 return -1;
2664 }
2665
2666 /*** control flags, c_cflag **/
2667 if (!(s_termios->c_cflag & CIGNORE))
2668 {
2669 dcb.fParity = 1;
2670
2671 /* CIGNORE: ignore control modes and baudrate */
2672 /* baudrate */
2673 if (termios_to_DCB(s_termios, &dcb) < 0) { return -1; }
2674 }
2675 else
2676 {
2677 }
2678

Callers 4

win32_serial_openFunction · 0.85
serial_setupFunction · 0.85
ser_closeFunction · 0.85
finddevicesFunction · 0.85

Calls 2

win32_serial_find_portFunction · 0.85
termios_to_DCBFunction · 0.85

Tested by

no test coverage detected