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]Serialport permission programmatically
Qt 6.11 is out! See what's new in the release blog

[SOLVED]Serialport permission programmatically

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.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.
  • J Offline
    J Offline
    JustGreg
    wrote on last edited by
    #1

    Hi!

    In my application I'm using a virtual serial port which is actually a USB-UART converter chip. If it is connected it recognized as /dev/ttyUSBx, where x=0...3. Each time I want to use that particular port I have to fire up the terminal and look it up with dmesg | grep ttyUSB*, then sudo chmod 0666 ttyUSBx to gain access. How can I do this programmatically?

    Thank you.

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

      Hi,

      Simpler (and more secure) way: check the group of ttyUSB* (if on *buntu should be dialout) and add your user to that group (don't forget to logout/login).

      If the group is root, add an udev rule to make so that the device gets another group and add your user to that group.

      Hope it helps.

      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
      • J Offline
        J Offline
        JustGreg
        wrote on last edited by
        #3

        Hi Sgaist,

        thank you for the tip! I added myself to the dialout group and after reboot my app was able to access the port. Cheers!

        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