Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSerialPort hangs as normal user Ubuntu
Forum Updated to NodeBB v4.3 + New Features

QSerialPort hangs as normal user Ubuntu

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 753 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.
  • G Offline
    G Offline
    Goddard
    wrote on last edited by Goddard
    #1

    I'm trying to connect to my serial USART device as a normal user and my program hangs. I tried catching the error with open function which returns a boolean, but it still hangs.

    open(QIODevice::ReadWrite)
    

    I checked my permissions of the tty and I am apart of the dialout group and I created a udev rule to set the permissions to 666.

    crw-rw-rw- 1 root dialout 188, 0 Apr 18 07:29 /dev/ttyUSB0
    

    Here is my udev rule.

    ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ENV{ID_MM_DEVICE_IGNORE}="1"
    ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ENV{MTP_NO_PROBE}="1"
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0666"
    SUBSYSTEMS=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0666"
    KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0666"
    

    My program works fine as sudo, but it makes it harder to debug in Qt Creator among other things when running as root.

    I'm running Ubuntu 14.04 and my Qt info is below.

    QMake version 3.0
    Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      hi
      did u try with the
      http://doc.qt.io/qt-5/qtserialport-terminal-example.html
      sample and see if it hangs too ?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Goddard
        wrote on last edited by
        #3

        Well my program works when ran as sudo, but I just did a reboot and now it works. I was reading some where that a lock file may be limiting me running as a normal user so I decided to try a reboot..

        Where are those lock files located for future reference?

        Thanks

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          hi
          Normally in
          /var/lock
          (i think)
          Which normally points to /run/lock
          on newer ubuntu as far as i know

          1 Reply Last reply
          1

          • Login

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