When you work with QT's Inter-Process Communication (IPC) and Remote Procedure Calling (RPC) mechanism , ie: D-Bus , you might have faced some errors like shown below:
Failed to start message bus:Failed to read directory '/etc/dbus-1/session.d':No such file or directory
EOF in dbus-launch reading address from bus daemon.
Or while executing dbus-monitor or dbus-launch commands you might have faced:
'ERROR:Couldn’t connect to session bus (Using x11 for dbus-daemon autolaunch was disabled at compile time,set your DBUS_SESSION_BUS_ADDRESS instead'.
This is why because by default when QT & D-Bus support is included in DEL rootfs projects it is set to start *only* D-Bus system bus. Session bus will not be running.
In DEL D-Bus support is included in rootfs only when BlueZ utilities are added. On platforms with no bluetooth hardware present kernel will throw error on boot. This error can be avoided by editing /etc/init.d/S32bluez-bg.sh script accordingly.
To run session bus on modules you will have to do the following.
- Create rootfs project with QT & BlueZ support included
- Go to {workspace}/project/build/rootfs/etc/dbus-1/
- Create a folder 'session.d' and copy /etc/dbus-1/system.d/session.conf to here
- Rename /etc/dbus-1/session.d/session.conf file to /etc/dbus-1/session.d/session-local.conf
- Edit /etc/init.d/S32bluez-bg.sh script to avoid kernel boot errors on platforms without bluetooth.
- Build and install the project
- Flash images onto module and boot.
- Execute eval 'dbus-launch --auto-syntax' in terminal console of module.
- Step 8 will export DBUS_SESSION_BUS_ADDRESS on the fly.
- Now run your application which uses D-Bus.
Note:
- To make steps 3-5 changes permanently in project Refer DEL docs 7.2.2. Using the add_files.sh script to understand how to add files to rootfs.
- Add steps 7-8 in /etc/init.d/ so as to make session bus running right after bootup.
Last updated:
Oct 31, 2024