Important: Please read the Qt Code of Conduct -

FTDI with Android (Odroid XU4)

  • Hello guys, i'am beginner in QT. i want ask to all of you about connecting FTDI in android (Odroid XU4). I can read available serial port, but i can't connect to serial port (/dev/ttyUSB0). What can i do?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you check that your user on the board has read/write permission for the device ?

    For classic Linux, it's usually a matter of adding the user to the dialout group but I don't know if Android follows the same principles.

  • What can i do?

    AFAIK, you need in root rights to access to the serial ports (for that you need a rooted device).

    Also, maybe you can create a some boot-script (but you need a root rights to change a system files and so on) which gives an appropriate permissions for your serial port device (e.g. changes chmod ...). Then you can access to the serial port as usual user, I guess... But it is just my assumption, I never did it.

  • @kuzulis Thanks for your response, i have tried to access root and change the permissions with chmod. But, when i check in Terminal Emulator, actually the code for access root and change the permissions doesn't work well. This is my code for access root and change the permissions..

       QProcess serialProcess;
                serialProcess.execute("chmod 777 /dev/ttyUSB0");
    void MySerialPort::openSerialPort()
        serialAvailable = false;
        serialPortName = "";
        serial = new QSerialPort(this);
        connect(serial, &QSerialPort::readyRead, this, &MySerialPort::readData);
        qDebug() << "Number of available ports : " << QSerialPortInfo::availablePorts().length();
        foreach (const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()) {
            if(serialPortInfo.hasVendorIdentifier() && serialPortInfo.hasProductIdentifier()) {
                        serialPortName = serialPortInfo.portName();
                        serialAvailable = true;
            //open and configure serial port
            qDebug() << "Connected to : " << serialPortName;
            //give message error
            qCritical() << "Serial Port error : " << serial->errorString();

  • Did you check that your 'chmod' worked correctly?

    What happens if you try to use 'chmod' from the busybox (terminal console?) and then just call 'cat /dev/ttyUSB0' ?

  • WOW, it is surprised to me, that seems an Android now has UART support. Also, seems, it is possible now to use the native C/C++ code to get access to the Peripheral I/O.

    UPD: Seems, all these features were added recently (in 2018 year) to Android Things Library.

  • Qt Champions 2019

    @kuzulis You now can buy laptops with Android :-)

  • Lifetime Qt Champion

    @jsulm whoever want's to do so ;)

  • UPD: Sadly, but, as I understand, it will work only on future "Android Things" devices (IoT). So, it is impossible to use it on any smartphone or a pad.

  • @kuzulis how can i access serial port? i can send in 'Terminal console' but not work with application (apk)

  • I don't know, seems you need to run your app as superuser. Or to use other tricks. Please search an answer in google, because this is not an Qt issue.

    PS: QSP does not supported on Android anyway..

    UPD2: At first, you can check that serial port permissions really changes. Just from your app run:

                serialProcess.execute("chmod 777 /dev/ttyUSB0");

    and then from busy-box emulator try to check, using 'ls' command that now the serial port permissions stays as '777'.

    If this will not help, then, maybe, you need to look on something like 'udev' analog on Android. Which can start required rule/action, e.g. when you insert/remove the USB/serial converter. E.g. it can change device permissions when you insert your USB/serial converter. But I'm not sure if this possible on Andrid, you need find it homself. ))

  • Thank you for all who gave answers and who read this topic. May be useful
    follow this link : FTDI

Log in to reply