QSerialPort hangs as normal user Ubuntu



  • 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
    

  • Qt Champions 2017

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



  • 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


  • Qt Champions 2017

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.