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 Mac OS authorization

QSerialPort Mac OS authorization

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 4 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.
  • M Offline
    M Offline
    Mathmathxc
    wrote on last edited by Mathmathxc
    #1

    Hello,
    I use MacOS Sierra and Qt Creator.
    I've just start a project with an USB/RS485 adapter, so I naturally use the QSerialPort module.
    I start by opening the device:
    if (!serialPort.open(QIODevice::ReadWrite))
    {
    ....
    }

    My serial port is something like: tty.usbserial-xxxxxx.
    But when I execute the program, it was unable to open the serial port. The only solution for me is to launch the program manually from my build directory with the sudo command.
    It appears as a problem of rights, like adding the user to the dialout group in Linux, but I can't find anything about it on Mac.
    Some of my colleagues use Qt on MacOS with several UART devices and they never had any issues with it.

    Did I miss something?

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

      Hi and welcome to devnet,

      What did you install to make your serial port(s) work ?

      What version of macOS are you using ?

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

        Thank you SGaist.
        I'm using Sierra, what do you mean by "what did you install"?
        My USB device is based on a FTDI chip, it works out of the box and appears in /dev when I plug it.
        When I launch ./myapp I got:
        QIODevice::write (QSerialPort): device not open

        When I launch sudo ./myapp everything works fine.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rondog
          wrote on last edited by
          #4

          I use a USB-Serial adapter on my Mac (Yosemite) and I have never had permission problems. I had to install the prolific driver for the device so I assume this is the difference.

          On GNU/Linux I had to change the permissions on the device to allow user level access. Something like chmod 666 /dev/ttyUSB0 would work until it was removed and re-connected. I used '666' because it was easy to remember but you really only need read/write access for the current user (or users).

          I am sure there is a way to set default permissions on this device when you connect it (something automatic). I was thinking about looking into this on GNU/Linux but never got around to it. It hasn't come up on OS X for me at least so I am not sure what the mechanism to do this would be.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mathmathxc
            wrote on last edited by
            #5

            The only difference is that you are use a Prolific driver not a FTDI one.
            I've try to switch from Apple FTDI drivers to official FTDI drivers without success.
            I hope somebody will have the same problem one day to help me found a fix.

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

              Did you follow the FTDI guide for the installation ?

              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
              1
              • M Offline
                M Offline
                Mathmathxc
                wrote on last edited by Mathmathxc
                #7

                Yes but I didn't notice section 7 "Disabling the Apple-provided VCP on OS X 10.9 and later".
                The AppleUSBFTDI.kext didn't appear on my system but messing up with Kernel Extensions solved my problem.
                I can now access my device everytime I execute my program whatever the method.

                Thanks for the reminder SGaist.

                StokestackS 1 Reply Last reply
                0
                • M Mathmathxc

                  Yes but I didn't notice section 7 "Disabling the Apple-provided VCP on OS X 10.9 and later".
                  The AppleUSBFTDI.kext didn't appear on my system but messing up with Kernel Extensions solved my problem.
                  I can now access my device everytime I execute my program whatever the method.

                  Thanks for the reminder SGaist.

                  StokestackS Offline
                  StokestackS Offline
                  Stokestack
                  wrote on last edited by Stokestack
                  #8

                  @Mathmathxc I have the same problem with the same setup: a Prolific USB-to-serial adapter, but QSerialPort doesn't see it.

                  The enumeration example application doesn't list it. Can you please describe exactly what you did to enable it? I don't know what this means:
                  @Mathmathxc said in QSerialPort Mac OS authorization:

                  messing up with Kernel Extensions solved my problem.

                  I'm on Mac OS 10.15.5, and I have unloaded the com.apple.driver.AppleUSBPLCOM kext to no avail.

                  Hm.... not sure I installed the official Prolific one yet though...

                  UPDATE: DO NOT INSTALL THE PROLIFIC USB-TO-SERIAL DRIVER! It will brick your Mac. I couldn't even start in Safe Mode. Had to boot into Recovery Mode and delete the kext in terminal.

                  Oddly enough, after that I tried the example again and it sees the USB serial device fine. Maybe I had unloaded the Apple kext before running the example, leaving nothing to provide the access. Maybe Apple has fixed theirs...

                  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