[SOLVED]-Qt open port problem



  • hi,

    I am trying to run Qt's own example but I could not to open port with Qt although the device attached to the serial port.
    I am trying to run this example: http://qt-project.org/doc/qt-5/qtserialport-blockingslave-example.html

    and I am getting this error:

    Status: Not running, Can't oprn ttyUSB0, error code 2.

    I use my device information:

    Port: ttyUSB0
    Location: /dev/ttyUSB0
    Description: USB-Srial Controller
    Manufacturer: Prolific Technology Inc.
    Serial number:
    Vendor Identifier: 67b
    Product Identifier:2303
    Busy: No

    and i am using ubuntu 12.04.

    How can I fix this error?

    thanks


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Just an educated guess but what are the user:group rights on the device ?

    Probably something like root:tty or an equivalent.

    You would need then to ensure that your user is in that group.


  • Moderators

    Make sure you are setting up the connection correctly (parity, baud rate, etc.), and also verify your operating system actually does see any data on the port (use another program to read from ttyUSB0, or read it with cat).



  • I solved the problem with "chmod". I did not have permission to access serial ports.

    before:

    @hamdi@eng:~$ ls -l /dev/ttyUSB0
    crw-rw---- 1 root dialout 188, 0 Aug 12 15:31 /dev/ttyUSB0@

    after:

    @hamdi@eng:~$ sudo chmod 777 /dev/ttyUSB0
    hamdi@eng:~$ ls -l /dev/ttyUSB0
    crwxrwxrwx 1 root dialout 188, 0 Aug 12 15:31 /dev/ttyUSB0@

    also there are different type for chmod like chmod 664, chmod +r etc.

    thanks


  • Lifetime Qt Champion

    That's a security hole you opened there


Log in to reply
 

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