Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Does qt support serialport in android system ?

Does qt support serialport in android system ?

Scheduled Pinned Locked Moved Mobile and Embedded
20 Posts 7 Posters 18.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    peterlin82
    wrote on last edited by
    #9

    I don't find any information about QSerialPort in android.

    http://doc-snapshot.qt-project.org/qt5-stable/topics-network-connectivity.html#serial-port-communication

    http://qt-project.org/wiki/New-Features-in-Qt-5.3

    Does Qt 5.3.0 support serialport in android system?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kuzulis
      Qt Champions 2020
      wrote on last edited by
      #10

      @peterlin82,

      no. it is still in "experimental" support, only for the rooted devices. You should take and re-build QtSerialPort from sources from Git.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        liangliang
        wrote on last edited by
        #11

        @ kuzulis ,
        I take and re-build Qt source from Git successful.

        http://qt-project.org/wiki/building_qt-android_on_windows

        then I root my phone.
        i use the demo named master in serialport examples to test

        then i found that i can not open device
        here is the error log .

        W/Qt (25097): qserialport_unix.cpp:94 (QString serialPortLockFilePath(const QString&)): The following directories are not readable or writable for detaling with lock files
        W/Qt (25097):
        W/Qt (25097): qserialport_unix.cpp:96 (QString serialPortLockFilePath(const QString&)): /var/lock
        W/Qt (25097):
        W/Qt (25097): qserialport_unix.cpp:96 (QString serialPortLockFilePath(const QString&)): /etc/locks
        W/Qt (25097):
        W/Qt (25097): qserialport_unix.cpp:96 (QString serialPortLockFilePath(const QString&)): /var/spool/locks
        W/Qt (25097):
        W/Qt (25097): qserialport_unix.cpp:96 (QString serialPortLockFilePath(const QString&)): /var/spool/uucp
        W/Qt (25097):
        W/Qt (25097): qserialport_unix.cpp:96 (QString serialPortLockFilePath(const QString&)): /tmp
        W/Qt (25097):
        W/Qt (25097): qserialport_unix.cpp:96 (QString serialPortLockFilePath(const QString&)): /data/local/tmp
        W/Qt (25097):
        W/Qt (25097): qserialport_unix.cpp:197 (bool QSerialPortPrivate::open(QIODevice::OpenMode)): Failed to create a lock file for opening the device

        Can anyone tell me how to do with it . and how to get open device permission .

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kuzulis
          Qt Champions 2020
          wrote on last edited by
          #12

          bq. Can anyone tell me how to do with it . and how to get open device permission .

          Seems, you should to run your application as superuser.

          PS: Now is in process an attempt to implement support of QtSerialPort for non-rooted Android devices : https://codereview.qt-project.org/#change,83480

          But I do not know when this solution will be completed. So, need for waiting only. :)

          1 Reply Last reply
          0
          • L Offline
            L Offline
            liangliang
            wrote on last edited by
            #13

            @ kuzulis
            thanks , but i have no idea how to run my application as superuser , can you give me some tips ?

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kuzulis
              Qt Champions 2020
              wrote on last edited by
              #14

              @sudo <path/to/my/app>@

              no?

              1 Reply Last reply
              0
              • L Offline
                L Offline
                liangliang
                wrote on last edited by
                #15

                @ kuzulis ,
                my computer is win7 system, and i use qtCreator to deploy application
                afer google , some people give some advise :

                QT Creator switch to Projects > "Run Settings" > "Run configuration:"
                select "custom executable"
                Executable: sudo /d4/workspace/qt/test2-build-desktop/test2
                change the above line to match your project path

                i did these steps .
                sudo E:/QT5.3_beta_code/serialport/build-master-Android_for_armeabi_v7a_GCC_4_7_Qt_5_3_1-Debug

                then some errors occured.
                *sudo E:/QT5.3_beta_code/serialport/build-master-Android_for_armeabi_v7a_GCC_4_7_Qt_5_3_1-Debug
                can not be found in the path. *

                these step is right ? i am not so familiar with sudo command , i don‘t know if i do the right command.

                thanks!

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kuzulis
                  Qt Champions 2020
                  wrote on last edited by
                  #16

                  To be honest, I don't know how to do it from QtCreator.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mr_wallyit
                    wrote on last edited by
                    #17

                    @lab Rat
                    I have build QtSerialport with the library 5.3.0 but i have always equal message.

                    The device is unblocked because if i use serial-java i can open the port.

                    thanks.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mr_wallyit
                      wrote on last edited by
                      #18

                      sorry, I am new in this forum

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        phyatt
                        wrote on last edited by
                        #19

                        I put some time into getting Qt + Android + QtSerialPort to work from a windows computer. I wrote a blog post about how I went about it. It works really well when it was all done.

                        I also needed to do my own JNI calls, too, so I ended up copying the UsbJNIActivity and inserting my own code.

                        http://phyatt.t15.org/wp/2015/04/qt-android-serial-port/

                        Hope that helps.

                        1 Reply Last reply
                        0
                        • H Offline
                          H Offline
                          Hello_ZB
                          wrote on last edited by
                          #20

                          If you're going to connect the FTDI chip, then you can approach this sample https://github.com/HelloZB/QtAndroidFTDI (no need root device).

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved