Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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);
    cfmakeraw(&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

    Hi,

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

    Hope it helps


Log in to reply