How to run D-Bus session bus on ConnectCore modules running Digi Embedded Linux

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/ script accordingly.

To run session bus on modules you will have to do the following.
  1. Create rootfs project with QT & BlueZ support included
  2. Go to {workspace}/project/build/rootfs/etc/dbus-1/
  3. Create a folder 'session.d' and copy /etc/dbus-1/system.d/session.conf to here
  4. Rename /etc/dbus-1/session.d/session.conf file to /etc/dbus-1/session.d/session-local.conf
  5. Edit /etc/init.d/ script to avoid kernel boot errors on platforms without bluetooth.
  6. Build and install the project
  7. Flash images onto module and boot.
  8. Execute eval 'dbus-launch --auto-syntax' in terminal console of module.
  9. Step 8 will export DBUS_SESSION_BUS_ADDRESS on the fly.
  10. Now run your application which uses D-Bus.
  • To make steps 3-5 changes permanently in project Refer DEL docs 7.2.2. Using the 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: Jan 01, 2024

Recently Viewed

No recently viewed articles

Did you find this article helpful?