[systemd-devel] starting qt application after DRM initialized

Lennart Poettering lennart at poettering.net
Fri Dec 7 11:34:29 UTC 2018


On Do, 06.12.18 22:58, Belisko Marek (marek.belisko at gmail.com) wrote:

> [Unit]
> Description=Demo
> After=systemd-user-sessions.service
>
> [Service]
> ExecStart=-/usr/bin/appcontroller /opt/test --applications-root /data/user/qt
>
> [Install]
> WantedBy=multi-user.target
>
> I think it is some kind of timing issue as when booting same image
> from usb stick application will automatically start while when booting
> from hdd I get above error. Would be possible to postpone it somehow
> until DRM display is initialized? Thanks.

You have two options:

1. The correct solution: make your tool wait internally that the
   CanGraphical= bus property of logind's Seat object "seat0" turns to
   "true". Then enumerate all devices belonging to the Seat, and open
   and use them. This is how "gdm" does and how this should be done in
   generic codepaths.

2. If you want a quicker, slightly sloppy solution that only works if
   you design for a specific hardware setup you know well: mark your
   drm device via a udev rule with the "systemd" tag
   (TAGS+="systemd"). This makes the drm device show up as a ".device"
   unit in systemd. Then, change your service to say "Wants=…" and
   "After=…" that .device unit. This then makes sure that the service
   will not even be started before the device is around.

Lennart

--
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list