1

Now I am trying to porting serial interface from linux to windows.

but I don't know how to port termios struct. The code is below.

struct termios options;

    tcgetattr(m_nDataCommFD, &options);
    cfsetispeed(&options, nBaudRate);
    cfsetospeed(&options, nBaudRate);

    options.c_cflag |= (CLOCAL | CREAD);

    options.c_cflag &= ~PARENB;
    options.c_cflag &= ~CSTOPB;
    options.c_cflag &= ~CSIZE;
    options.c_cflag |= CS8;

    options.c_iflag &= ~(IXON | IXOFF | IXANY);
    options.c_iflag &= ~(INLCR | IGNCR | ICRNL);
    options.c_oflag &= ~OPOST;

    options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);

    tcsetattr(m_nDataCommFD, TCSANOW, &options);

    fcntl(m_nDataCommFD, F_SETFL, FNDELAY);

please. help me.

0 Answers0