[systemd-devel] starting qt application after DRM initialized

Belisko Marek marek.belisko at gmail.com
Tue Dec 11 20:25:47 UTC 2018


On Fri, Dec 7, 2018 at 12:45 PM Belisko Marek <marek.belisko at gmail.com> wrote:
>
> On Fri, Dec 7, 2018 at 12:34 PM Lennart Poettering
> <lennart at poettering.net> wrote:
> >
> > 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.
> Thanks a lot for valuable info. I'll try and get back with results.
Works as expected. For other who maybe hit same issue I've extend
99-systemd.rules with:
SUBSYSTEM=="drm", KERNEL=="card[0-9]*", TAG+="systemd"

and added to service:

[Unit]
Requires=dev-dri-card0.device
After=dev-dri-card0.device

> >
> > Lennart
> >
> > --
> > Lennart Poettering, Red Hat
>
> BR,
>
> marek
>
>

Thanks and BR,

marek


More information about the systemd-devel mailing list