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. [SOLVED]-Qt open port problem
QtWS25 Last Chance

[SOLVED]-Qt open port problem

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.5k Views
  • 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.
  • H Offline
    H Offline
    hmdi
    wrote on last edited by
    #1

    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

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

      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.

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

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        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).

        (Z(:^

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hmdi
          wrote on last edited by
          #4

          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

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

            That's a security hole you opened there

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

            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