Starting a Qt program at power up on a BBB
-
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? -
Hi,
Do you start the X server prior to your application ?
-
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.
-
I should have said that lightdm is the display manager and isn't started by systemd until X is up and running.
-
AFAIK, you would need to create a .desktop file to auto start the application once lightdm is started
-
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=lxqtThe display is set to:
DISPLAY=:0so 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 :0It 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.
-
Did you try run it with "sudo" ?