见到你很高兴。
我创建了一个应用程序(car<->控制器),它使用Qt提供的qtdbus进行通信。看见。https://doc.qt.io/qt-5/qtdbus-remotecontrolledcar-example.html
幸运的是,我能够验证应用程序的通信是否正常。
但是,当我使用systemd在系统启动时自动运行应用程序时,我遇到了没有通信的问题。
下面是我写的服务。
[Unit]
Description=Controller App execution
ConditionPathExists=/var/run/user/root/wayland-0
[Service]
Type=dbus
BusName=org.example.CarExample.service
EnvironmentFile=/etc/sysconfig/weston
ExecStart=/home/root/controller_app
WorkingDirectory=/home/root/
[Install]
WantedBy=multi-user.target[Unit]
Description=Car app execution
ConditionPathExists=/var/run/user/root/wayland-0
[Service]
Type=dbus
BusName=org.example.CarExample.service
EnvironmentFile=/etc/sysconfig/weston
ExecStart=/home/root/car_app
WorkingDirectory=/home/root/
[Install]
WantedBy=multi-user.target[D-BUS Service]
Name=org.example.CarExample.service
Exec=/usr/bin/car_dbus我的目的是让使用qtdbus的两个应用程序在系统引导时正常工作。
看来你现在走错路了。
我还应该找什么呢?
发布于 2020-12-04 01:25:46
找到答案了。
问题是如何在系统区域实现服务。
已经发现,qtbus在用户区域进行通信。
因此,如果在systemd的用户区域中创建了服务,则可以确认它在没有连接到dbus服务的情况下正常运行。
https://unix.stackexchange.com/questions/622670
复制相似问题