Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Serial Communication permissions from Qt on Android
Forum Updated to NodeBB v4.3 + New Features

Serial Communication permissions from Qt on Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 2.8k Views 1 Watching
  • 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.
  • carles.sole.grauC Offline
    carles.sole.grauC Offline
    carles.sole.grau
    wrote on last edited by carles.sole.grau
    #1

    Hi everybody,
    I'm trying to connect an Arduino device to my Qt Android App.
    When I run it from ubuntu, first I'm not able to connect to my serial port because I need to give permissions, it's easy solved typing this on Ubuntu terminal:

    sudo chmod a+rw /dev/ttyACM0
    

    When I connect Arduino on the App running on Android Device, I'm not able to connect and I don't know what I have to do (if it's possible I would like to solve it without having to root my Android device).
    There is a way to give permissions inside Qt Code?

    I've tried with:

    mySerialPort->open(QSerialPort::ReadWrite);
    

    And then to see the permissions:

    if(mySerialPort->isWritable())
          qInfo("Is writable");
    else
          qInfo("Is not writable");
    if(mySerialPort->isReadable())
          qInfo("Is readable");
    else
          qInfo("Is not readable");
    

    And until I set permissions through Ubuntu terminal, I haven't got Read/Write permissions. So on my Android device, I'm not able to connect.

    Any help will be very appreciated,
    Thank you very much.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Take a look at this thread it contains some interesting pointers.

      Warning: your "easy solution" on Ubuntu is just opening a security hole on your system. Now everybody can read and write on the serial port. The correct way to get the permissions to the serial port is to make you user member of the group that has access to the device.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      carles.sole.grauC 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Take a look at this thread it contains some interesting pointers.

        Warning: your "easy solution" on Ubuntu is just opening a security hole on your system. Now everybody can read and write on the serial port. The correct way to get the permissions to the serial port is to make you user member of the group that has access to the device.

        carles.sole.grauC Offline
        carles.sole.grauC Offline
        carles.sole.grau
        wrote on last edited by
        #3

        @SGaist
        "The correct way to get the permissions to the serial port is to make you user member of the group that has access to the device".
        I don't understand what it really means.
        And refering to the thread you linked, I saw before, but I don't really understand it. (I don't know either which comment is the good one).
        My purpose is connecting with Arduino, and I'm afraid that it doesn't use FTDI chip.
        Thanks.

        jsulmJ 1 Reply Last reply
        0
        • carles.sole.grauC carles.sole.grau

          @SGaist
          "The correct way to get the permissions to the serial port is to make you user member of the group that has access to the device".
          I don't understand what it really means.
          And refering to the thread you linked, I saw before, but I don't really understand it. (I don't know either which comment is the good one).
          My purpose is connecting with Arduino, and I'm afraid that it doesn't use FTDI chip.
          Thanks.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @carles.sole.grau You should read about user and groups on UNIX/Linux. You just need to add your user to the group which has access rights for the serial port.
          Use

          ls -lh /dev/ttyACM0
          

          to see what the group is. Then add your user to that group:

          useradd -G {group-name} username
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • carles.sole.grauC Offline
            carles.sole.grauC Offline
            carles.sole.grau
            wrote on last edited by
            #5

            So, anybody has tried to send serial data with Qt on Android?
            I've found this: https://www.allaboutcircuits.com/projects/communicate-with-your-arduino-through-android/
            But it's in pure Java, so I think that is not the way.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved