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. Serial communication stops when window is hidden or minimized on Mac
QtWS25 Last Chance

Serial communication stops when window is hidden or minimized on Mac

Scheduled Pinned Locked Moved Unsolved General and Desktop
macosmacosx
4 Posts 3 Posters 874 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.
  • T Offline
    T Offline
    Tomassino
    wrote on 8 Aug 2018, 12:53 last edited by
    #1

    I have a qt application using an instance of QSerialPort in a separate thread. The thread has its own event loop and I use QSerialPort asynchronously (i.e. no blocking calls, only signals and slots). The application works as expected on Windows and Linux, but serial communication stops after a while on Mac when the window is hidden or minimized. If I keep the application minimized it receives and sends few bytes from time to time. When the application has focus again, communication starts again as expected.

    I have almost no experience with Mac applications, but I've seen the same behavior in other applications using serial communication. I haven't found much on the web, so event tips on how to search documentation on this issue is highly appreciated :-)

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 8 Aug 2018, 21:12 last edited by
      #2

      Hi and welcome to devnet,

      That's likely because of macOS's App Nap facility.

      See this GitHub page about that subject and Qt.

      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
      4
      • K Offline
        K Offline
        kuzulis
        Qt Champions 2020
        wrote on 9 Aug 2018, 06:48 last edited by
        #3

        QSerialPort relies on QSocketNotifier class. If a problem is in "App Nap" then all classes using QSocketNotifier (I guess) becomes unworked (as QAbstractSocket and so on).

        PS: If to be honet, I'm not faced with this issue before.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Tomassino
          wrote on 9 Aug 2018, 21:44 last edited by Tomassino 8 Sept 2018, 21:45
          #4

          Thank you both very much for your help. I had a suspect that the problem was related to power saving because when on AC the problem was still present but intervals with no communication were shorter. Unfortunately I won't be able to test the solution in the linked page before a week or so. I will read something about App Nap in the meanwhile, now that I know what to look for :-)

          1 Reply Last reply
          0

          2/4

          8 Aug 2018, 21:12

          • Login

          • Login or register to search.
          2 out of 4
          • First post
            2/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved