Important: Please read the Qt Code of Conduct -

Serial Port setRts(true) returns zero.

  • Hi everyone!

    I am rewriting the old windows application which works with serial port for old research setup, but i have some problem with QSerialPort. After creating a new QSerialPort and performing initial setting i get a false returned value when i'm trying to setRts(true)

    QSerialPort *port = new QSerialPort(QString("ttyS0"));
    port->open(QIODevice::ReadWrite) // returns true
    port->setRts(true) // returns false

    I had launched the old program and its works well so problem is not in connected device. When i set QSerialPort::SoftwareControl the port->setRts(true) returns true (that is strange) but after some time device freezes and no data arrive in buffer. That can be a reason why i cant setRts(true) when the hardware control is used? I thought that rts signal is used only with hardware control, am i wrong?

  • Qt Champions 2020

    When the HW flow control is set, then the RTS changing is prohibited manually. It does automatically by the driver (because it is HARDWARE FLOW CONTROL). The previous implementation of QSP had bugs which allow to change RTS in HW flow control.

  • Qt Champions 2020

    UPD: You allowed to change RTS only with NoFlowControl or SoftwareFlowControl.

  • wow, didn't know that in hw control it sets automatically, thx @kuzulis!

Log in to reply