Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Does qt support serialport in android system ?

    Mobile and Embedded
    7
    20
    16743
    Loading More Posts
    • 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.
    • L
      liangliang last edited by

      hai ,everyone , now i want to do a project ablout serial port communication in android phone , i simulate it ok in windows7 system .but i found that i can not compile the code in android enviroment . my question is :

      1. Does qt really not supprot serial port in android yet ?
      2. Are there some methods can help me going on the project ?

      thank you very much !

      1 Reply Last reply Reply Quote 0
      • JKSH
        JKSH Moderators last edited by

        Hi,

        According to "this page":http://doc-snapshot.qt-project.org/qt5-stable/topics-network-connectivity.html#serial-port-communication, Qt Serial Port is currently supported on Windows, Mac and Linux only.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply Reply Quote 0
        • L
          liangliang last edited by

          thank you ~
          [quote author="JKSH" date="1383806858"]Hi,

          According to "this page":http://doc-snapshot.qt-project.org/qt5-stable/topics-network-connectivity.html#serial-port-communication, Qt Serial Port is currently supported on Windows, Mac and Linux only.[/quote]

          1 Reply Last reply Reply Quote 0
          • K
            kuzulis Qt Champions 2020 last edited by

            UPD: The Android's support for the QtSerialPort still has a "experimental" status. So, about any errors and any questions, please, let us know.

            1 Reply Last reply Reply Quote 0
            • P
              peterlin82 last edited by

              Android Qt 5.2 SerialPort support added
              http://www.kdab.com/qt-on-android-episode-1/?utm_source=rss&utm_medium=rss&utm_campaign=qt-on-android-episode-1

              1 Reply Last reply Reply Quote 0
              • JKSH
                JKSH Moderators last edited by

                The blog post spoke too soon. It won't be ready for Qt 5.2 after all: https://codereview.qt-project.org/#change,70618

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply Reply Quote 0
                • L
                  liangliang last edited by

                  after read
                  https://codereview.qt-project.org/#change,70618 i am confused ,
                  so i want to make the question clear :

                  in https://codereview.qt-project.org/#change,70618 said that now
                  qt have support serial port for android ,right ?
                  but the fact is ,now qt do not support serial port for android , right ?

                  and where can i download the newest patch if you upload qt code.

                  thanks very much !
                  [quote author="JKSH" date="1383827868"]The blog post spoke too soon. It won't be ready for Qt 5.2 after all: https://codereview.qt-project.org/#change,70618[/quote]

                  1 Reply Last reply Reply Quote 0
                  • JKSH
                    JKSH Moderators last edited by

                    [quote author="liangliang" date="1383877061"]in https://codereview.qt-project.org/#change,70618 said that now
                    qt have support serial port for android ,right ?[/quote]No. After I read Bogdan's blog post, I submitted that patch to update the documentation, to say that Android is supported.

                    However, in the comments below, Laszlo said it's not supported properly yet. So, the patch was not accepted.

                    [quote]but the fact is ,now qt do not support serial port for android , right ?[/quote]Right.

                    [quote]and where can i download the newest patch if you upload qt code.[/quote]From the same codereview page. Scroll down until you see "Download".

                    If you want to apply these patches, you will need to download the git repository, apply the patch, and then compile all of the Qt libraries yourself: http://qt-project.org/wiki/Building_Qt_5_from_Git

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply Reply Quote 0
                    • P
                      peterlin82 last edited by

                      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 Reply Quote 0
                      • K
                        kuzulis Qt Champions 2020 last edited by

                        @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 Reply Quote 0
                        • L
                          liangliang last edited by

                          @ 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 Reply Quote 0
                          • K
                            kuzulis Qt Champions 2020 last edited by

                            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 Reply Quote 0
                            • L
                              liangliang last edited by

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

                              1 Reply Last reply Reply Quote 0
                              • K
                                kuzulis Qt Champions 2020 last edited by

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

                                no?

                                1 Reply Last reply Reply Quote 0
                                • L
                                  liangliang last edited by

                                  @ 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 Reply Quote 0
                                  • K
                                    kuzulis Qt Champions 2020 last edited by

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

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      mr_wallyit last edited by

                                      @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 Reply Quote 0
                                      • M
                                        mr_wallyit last edited by

                                        sorry, I am new in this forum

                                        1 Reply Last reply Reply Quote 0
                                        • P
                                          phyatt last edited by

                                          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 Reply Quote 0
                                          • H
                                            Hello_ZB last edited by

                                            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 Reply Quote 0
                                            • First post
                                              Last post