How to export DBUS_SESSION_BUS_ADDRESS

后端 未结 4 1522
青春惊慌失措
青春惊慌失措 2021-02-01 09:35

I\'m trying to run D-Bus on an embedded system (Yocto Linux) and connect to it from my application code.

I get the following error when I call dbus_bus_get(DBUS_BU

相关标签:
4条回答
  • 2021-02-01 09:55
    pid_gnome=$(pgrep gnome-session)
    DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/${pid_gnome}/environ|cut -d= -f2-)
    export DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}
    

    Please make sure that the user has the DISPLAY variable set.

    Another alternative is:

    export $(dbus-launch)
    
    0 讨论(0)
  • 2021-02-01 10:00

    Type the following command into a terminal:

    eval `dbus-launch --auto-syntax`
    
    0 讨论(0)
  • 2021-02-01 10:13

    Type in terminal:

    export $DBUS_SESSION_BUS_ADDRESS
    
    0 讨论(0)
  • 2021-02-01 10:16

    I've finally found the answer, running the following command exports the output of dbus-launch:

    export $(dbus-launch)
    
    0 讨论(0)
提交回复
热议问题