Results 1 to 10 of 10

Thread: Serial Port in Android

  1. #1
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Serial Port in Android

    Hi,
    I am using QT5.2 Android
    How to use read & write serial port data in android?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Serial Port in Android

    What have you found already? What have you tried?

  3. #3
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Serial Port in Android

    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.

  4. #4
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Serial Port in Android

    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.

  5. #5
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Serial Port in Android

    Thanks,I done it.

  6. #6
    Join Date
    Oct 2014
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Serial Port in Android

    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.

  7. #7
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Serial Port in Android

    Is there a way to do it?
    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).
    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).

  8. The following user says thank you to kuzulis for this useful post:

    phyatt (2nd April 2015)

  9. #8
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows
    Wiki edits
    1

    Default Re: Serial Port in Android

    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.

  10. #9
    Join Date
    May 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Android

    Default Re: Serial Port in Android

    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.

  11. #10
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Serial Port in Android

    Project MESSAGE: cmake executable not found.
    You need to download and install CMake and ensure that the cmake executable is in your system path.

Similar Threads

  1. qt serial port
    By saman_artorious in forum Newbie
    Replies: 9
    Last Post: 24th April 2013, 16:19
  2. Port Qt on Android without using Ministro.apk
    By ankit jain in forum Installation and Deployment
    Replies: 1
    Last Post: 31st May 2012, 12:51
  3. QT to Android serial port API problem?
    By eddis in forum Newbie
    Replies: 5
    Last Post: 5th January 2012, 00:09
  4. serial port programming in qt
    By sar_van81 in forum Qt Programming
    Replies: 46
    Last Post: 13th June 2007, 12:27
  5. Serial Port
    By b1 in forum Qt Programming
    Replies: 2
    Last Post: 18th January 2007, 02:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.