Important: Please read the Qt Code of Conduct -

QSerialPort setting echo flags

  • I am attempting to migrate to use QSerialPort for my serial device from termios calls. The existing code is

    struct termios options;
    tcgetattr(file, &options);
    options.c_cflag |= CS8 | CSTOPB | CREAD | CLOCAL;
    options.c_lflag &= ~(ECHO | ECHOE);
    tcsetattr(file, TCSANOW, &options);

    and it works. For the QSerialPort, I can set all the options but the ECHO flags. The QSerialPort connects to the device but cannot read it. When I compare the stty settings, between the old code and the QSerialPort, the only difference is the ECHO settings.

    Any idea how to set them? If I manually set them, QSerialPort rests them.

  • Lifetime Qt Champion


    You can get the native handle with QSerialPort::handle and then modify its properties.

    Hope it helps

Log in to reply