Does qt support serialport in android system ?
-
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).