QSerialPort support Android



  • The documentation for Qt 5.6 says that Qt for Android does not support QSerialPort. I'm using USB to RS232 convertor with OTG used on the android tablet. If Anyone knows when to expect the QSerialPort support on Android? or anyone suggest some workaround?


  • Lifetime Qt Champion

    Hi,

    That's a question best asked on the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.



  • If Anyone knows when to expect the QSerialPort support on Android?

    In the near future it it isn't planned. I, as maintainer, have no resources as for time, as for stimulus, and as for existence of appropriate stuff (because there are a lot of USB/Serial chips with own I/O protocols).

    So, say, "THANKS", for the Google, that the Android has not an Java classess with access to the serial ports. :)

    By the way:

    1. There are some patch-set which are "implements" the OTG support for some USB/Serial converters,which nobody are tested: https://codereview.qt-project.org/#/c/84338/ .

    2. If your device is rooted, then you can use QSerialPort similar to linux way (but, with the root privileges), which also are not tested.



  • Thank you very much kuzulis for the informattions. I'll try your suggestions, as usual I'll write back. I found a suggestion on the net to use bluetooth to rs232 converter, but for now I consider it as less robust, more expensive and more unsecured solution. Thanks again.



  • Just to confirm that QSerialPort can be used on rooted Android. (Some info)

    Notes:

        #ifdef Q_OS_ANDROID
            /* This will open the Superuser app,
             * prompting for root permisions
             */
            QProcess proc(&a);
            proc.start("su -c \"chmod 666 /dev/ttyUSB0\"");
        #endif
    
    • Don't forget to disable SELinux on Android 4.2 and above :)

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.