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. Starting a Qt program at power up on a BBB
Forum Updated to NodeBB v4.3 + New Features

Starting a Qt program at power up on a BBB

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

    I'm trying to get my program to autostart on powerup. I've set up a systemd service file that has WantedBy=multi-user.target and After=lightdm.service. Systemd is trying to start it, but it's getting an error 'can't connect to display'. I have set Environment=DISPLAY "0:0" in the service file also, still the same results.
    Does anybody here have any idea on what I need to do to get my program to connect to the display so it can run?

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

      Hi,

      Do you start the X server prior to your application ?

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

        The system is running lightdm and the systemd .service file that I created specifies After=lightdm.service, so it is not supposed to be started until after lightdm is running.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          GregWilsonLindberg
          wrote on last edited by
          #4

          I should have said that lightdm is the display manager and isn't started by systemd until X is up and running.

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

            AFAIK, you would need to create a .desktop file to auto start the application once lightdm is started

            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
            • G Offline
              G Offline
              GregWilsonLindberg
              wrote on last edited by
              #6

              I've done some more poking, prodding and testing and come up with the following:
              The QT environment variables set in the lightdm/lxqt terminal that allows me to run my program are:
              QT_IM_MODULE=compose
              QT_PLATFORM_PLUGIN=lxqt
              QT_QPA_PLATFORMTHEME=lxqt

              The display is set to:
              DISPLAY=:0

              so I added the following line to my .service file:
              Environment="DISPLAY=:0" "QT_IM_MODULE=compose" "QT_PLATFORM_PLUGIN=lxqt" "QT_QPA_PLATFORMTHEME=lxqt"

              The result is the following error:
              Apr 20 18:12:57 beaglebone Cryo3Cube[485]: No protocol specified
              Apr 20 18:12:57 beaglebone Cryo3Cube[485]: QXcbConnection: Could not connect to display :0

              It appears that QT is trying to connect but doesn't know how, although I've specified the same environment parameters as the program gets when executed from a command line.

              1 Reply Last reply
              0
              • Malek_KhlifM Offline
                Malek_KhlifM Offline
                Malek_Khlif
                wrote on last edited by
                #7

                Did you try run it with "sudo" ?

                I Love Qt <3

                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