Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtSerialPort on Android (Qt.5.12.x)



  • Hi,
    Today I was working on a little project that reads some data from a sensor by a CP210x serial/USB device.
    on my ubuntu, I use ttyUSB0 to connect to my device but on the Android device it's not working and the serial port open function returns false for the operation result.
    I also tried ttyUSB1,2,3,4 and no luck.
    With the help of some other software looks like the device is located in /dev/bus/001/131 not in /dev/tty*.
    Any idea what is wrong or what should i do?


  • Qt Champions 2020

    What's error code returned? (I suspect that is is 'permisison' error).

    BTW: QSerialPort don't supported on Android. Use it on own risk.



  • There is no actual error code. the function only returns a boolean value.
    about the support thing i think it supports the android os because there is no library build error or log which indicates any sort of problem.



  • @md2012 said in QtSerialPort on Android (Qt.5.12.x):

    Any idea what is wrong or what should i do?

    Are you sure this hardware is supported by Android? Which version of Android you are using?
    To me, it looks like Android did not recognize the hardware.



  • Android version is 7.
    The os itself I'm not sure but i installed someother serial interaction softwares from google play and it works just fine.



  • I also used QSerialPortInfo::availablePorts() and the list is empty.


  • Qt Champions 2020

    @md2012 said in QtSerialPort on Android (Qt.5.12.x):

    There is no actual error code.

    There are QSerialPort::error()

    With the help of some other software looks like the device is located in /dev/bus/001/131 not in /dev/tty*.

    No, the serial port should be located in /dev/tty. If there are no serial port exists, this means that the Android kernel don't see that device (there are no appropriate drivers).



  • so according to this link and the evidence cp210x is not supported by the android and i need to take another approach to the matter.
    Anyway, I will share the result as soon as it's done.



  • @md2012

    Hi!

    Did you solve it? I have same problem.

    help me :)


Log in to reply