Hi,
I am using QT5.2 Android
How to use read & write serial port data in android?
Hi,
I am using QT5.2 Android
How to use read & write serial port data in android?
What have you found already? What have you tried?
I used QtSerial port API for Windows & Ubuntu 12.04 (i.e Desktop based Application as well as embedded linux).It's working fine.
But i don't know how to do in Qt5.2 Android.
Same as in others OS. The only thing it is correct to build and to install of QtSerialPort manually from the source codes. For this purpose I recommend to use QtCreator. Details see in WIKI.But i don't know how to do in Qt5.2 Android.
Thanks,I done it.
Hi,
I am also able to build my code with serial port print in android platform. When I run the application in android I can read port names with help of QSerialPortInfo. But I am unable to open the port as error "Permission denied" is thrown.
I've read that I need to root the android on my device with permission to port folders. I am not clear about the steps not even practical to me to root all devices on which I install my application.
Is there a way to do it?
Thanks in advance.
No. Android has not a public API to use of serial port. You should root each of your device to start application from the root rights (or to set desired acces to /dev/ttyXX devices when reboot).Is there a way to do it?
This option are available (make sense) if you is a developer of custom Android's firmware (e.g. provide a ready made devices as vendor).
Also it is possible to use the "USB host mode" (in case if you planns to use USB/Serial converters as serial ports role).
In this case there are a patch: https://codereview.qt-project.org/#/c/84338/ . But this patch is incomplete and you should to fix it himself.
Or to write a JAVA wrapper manually, using https://github.com/mik3y/usb-serial-for-android project (since this patch based on this project).
So, no other ways available (unfortunately).
phyatt (2nd April 2015)
I put some time into getting Qt + Android + QtSerialPort to work from a windows computer.
I used the referenced patch and got it working! It wasn't as straight forward as I thought it would be so I documented the steps somewhat.
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-...d-serial-port/
Hope that helps.
hi,I have tried your way,but it didn't work. In your way ,i download the QtSerialPort for android by Mike Goza ttps://codereview.qt-project.org/#/c/84338/.Then when I try to open it,it makes mistakes.
" 系统找ä¸åˆ°æŒ‡å®šçš 路径。
Project MESSAGE: perl -w F:\Android\5.4\android_armv7\bin\syncqt.pl -module QtSerialPort -version 5.5.0 -outdir F:/code/build-qtserialport-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_1-Debug F:/code/qtserialport
系统找ä¸åˆ°æŒ‡å®šçš 路径。
Project MESSAGE: cmake executable not found. Not running CMake unit tests
Project MESSAGE: perl -w F:\Android\5.4\android_armv7\bin\syncqt.pl -module QtSerialPort -version 5.5.0 -outdir F:/code/build-qtserialport-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_1-Debug F:/code/qtserialport
系统找ä¸åˆ°æŒ‡å®šçš 路径。
Project MESSAGE: cmake executable not found. Not running CMake unit tests "
I don't know how to fix it.Can you help me ? thank you.
You need to download and install CMake and ensure that the cmake executable is in your system path.Project MESSAGE: cmake executable not found.
Bookmarks