Please nominate your Qt Champions for 2021!

Qt4.7.4 Serial Port Linux

  • Hi,

    I need to send and transmit data on the ttyGS0 serial gadget in my embedded linux system.

    I'm a bit concerned about upgrading to qt5 just yet.

    What is my best option for using this device with my current Qt version?

    Thank you.

  • Qt Champions 2020

    You can try to build the QtSerialPort. Though, for it is declared support from Qt 4.8 and above. But you can try and Qt 4.7. If will appears a compilation errors, then, think, they can be fixed easily. Most likely the errors will be related to the QElapsedTimer, etc. which aren't present in Qt 4.7.x. It is rather simple to replace these classes with the similar from Qt 4.7.

  • There exists an external library for communicating via serial ports:


  • Hi, thanks for reply.

    In the end I used the low level ::read() and ::write() commands found in fcntl.h.

    The only major issue I had with this was turning off the serial ports canonical mode which appeared to be on by default with the following:

    @ //get current settings
    termios tc;
    ::tcgetattr(fd, &tc);

        //canonical mode - off
        tc.c_lflag &= ~ICANON;
        //save current settings
        ::tcsetattr(fd, 0, &tc);@

    ...again thanks for comments.

Log in to reply