Does qt support serialport in android system ?
-
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 :
- Does qt really not supprot serial port in android yet ?
- Are there some methods can help me going on the project ?
thank you very much !
-
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.
-
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]
-
UPD: The Android's support for the QtSerialPort still has a "experimental" status. So, about any errors and any questions, please, let us know.
-
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 -
The blog post spoke too soon. It won't be ready for Qt 5.2 after all: https://codereview.qt-project.org/#change,70618
-
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] -
[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
-
I don't find any information about QSerialPort in android.
http://qt-project.org/wiki/New-Features-in-Qt-5.3
Does Qt 5.3.0 support serialport in android system?
-
no. it is still in "experimental" support, only for the rooted devices. You should take and re-build QtSerialPort from sources from Git.
-
@ 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 testthen 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 deviceCan anyone tell me how to do with it . and how to get open device permission .
-
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. :)
-
@ kuzulis
thanks , but i have no idea how to run my application as superuser , can you give me some tips ? -
@sudo <path/to/my/app>@
no?
-
@ 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 pathi did these steps .
sudo E:/QT5.3_beta_code/serialport/build-master-Android_for_armeabi_v7a_GCC_4_7_Qt_5_3_1-Debugthen 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!
-
To be honest, I don't know how to do it from QtCreator.
-
@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.
-
sorry, I am new in this forum
-
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.
-
If you're going to connect the FTDI chip, then you can approach this sample https://github.com/HelloZB/QtAndroidFTDI (no need root device).