用dbus-send查看当前system bus或者session bus上面挂载了多少service.

 

在Linux PC/手机启动后,dbus-daemo就启动了。

这是如果一个程序启动了,会有一个connection挂载到dbus-daemon上面的,同时维护了这个程序的service.

可以采用dbus-send命令来查看system bus或者session bus上面到底挂载了哪些service, 即,当前有哪些程序

是和dbus-daemon有关联的:

 

1 查看system bus上面挂载的service.

test@test-desktop:~$ dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListActivatableNames

method return sender=org.freedesktop.DBus -> dest=:1.25 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string "net.ekiga.helper"
      string "org.freedesktop.PowerManagement"
      string "org.freedesktop.Tracker"
      string "org.freedesktop.Notifications"
      string "org.freedesktop.SystemToolsBackends.GroupsConfig"
      string "org.freedesktop.SystemToolsBackends.NTPConfig"
      string "org.freedesktop.SystemToolsBackends.NFSConfig"
      string "org.gnome.Tomboy"
      string "org.freedesktop.SystemToolsBackends.HostsConfig"
      string "org.freedesktop.SystemToolsBackends"
      string "net.ekiga.instance"
      string "org.gnome.GnomeVFS.Daemon"
      string "com.redhat.dhcp"
      string "org.freedesktop.SystemToolsBackends.IfacesConfig"
      string "org.freedesktop.SystemToolsBackends.TimeConfig"
      string "org.freedesktop.SystemToolsBackends.ServicesConfig"
      string "org.gnome.Rhythmbox"
      string "org.freedesktop.SystemToolsBackends.Platform"
      string "org.freedesktop.SystemToolsBackends.SMBConfig"
      string "org.gnome.SettingsDaemon"
      string "org.freedesktop.SystemToolsBackends.UsersConfig"
   ]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2 查看session bus上面挂载的service .
test@test-desktop:~$ dbus-send --session --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListActivatableNames
method return sender=org.freedesktop.DBus -> dest=:1.18 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string "net.ekiga.helper"
      string "org.freedesktop.PowerManagement"
      string "org.freedesktop.Tracker"
      string "org.freedesktop.Notifications"
      string "org.freedesktop.SystemToolsBackends.GroupsConfig"
      string "org.freedesktop.SystemToolsBackends.NTPConfig"
      string "org.freedesktop.SystemToolsBackends.NFSConfig"
      string "org.gnome.Tomboy"
      string "org.freedesktop.SystemToolsBackends.HostsConfig"
      string "org.freedesktop.SystemToolsBackends"
      string "net.ekiga.instance"
      string "org.gnome.GnomeVFS.Daemon"
      string "com.redhat.dhcp"
      string "org.freedesktop.SystemToolsBackends.IfacesConfig"
      string "org.freedesktop.SystemToolsBackends.TimeConfig"
      string "org.freedesktop.SystemToolsBackends.ServicesConfig"
      string "org.gnome.Rhythmbox"
      string "org.freedesktop.SystemToolsBackends.Platform"
      string "org.freedesktop.SystemToolsBackends.SMBConfig"
      string "org.gnome.SettingsDaemon"
      string "org.freedesktop.SystemToolsBackends.UsersConfig"
   ]

 

看看Nokia的maemo平台启动后,我们可以看有哪些后台程序在和D-BUS之间有通信:

用dbus-send查看当前system bus或者session bus上面挂载了多少service._第1张图片

 

更多的用法,其实就是调用org.freedesktop.Dbus提供的标准接口:

[sbox-CHINOOK_X86: ~] >  dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.Introspectable.Introspect

method return sender=org.freedesktop.DBus -> dest=:1.8
   string ""http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">

 
   
     
   

 

 
   
     
     
     
   

   
     
     
   

   
     
     
     
   

   
     
   

   
     
     
   

   
     
   

   
     
   

   
     
   

   
     
   

   
     
     
   

   
     
     
   

   
     
     
   

   
     
     
   

   
     
     
   

   
   

   
     
     
     
   

   
     
   

   
     
   

 


"

 

///////////////////////////////////////////////////////////////////////////

[sbox-CHINOOK_X86: ~] >  dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
method return sender=org.freedesktop.DBus -> dest=:1.10
   array [
      string "org.freedesktop.DBus"
      string "com.nokia.hildon-desktop"
      string "com.nokia.SM_DIMMED_infoprint"
      string "org.gnome.GConf"
      string "com.nokia.hildon_input_method"
      string ":1.10"
      string "com.nokia.AS_DIMMED_infoprint"
      string ":1.0"
      string ":1.1"
      string ":1.2"
      string ":1.3"
      string ":1.4"
      string ":1.5"
   ]
[sbox-CHINOOK_X86: ~] >

/////////////////////////////////////////////////////////////////////////////

详细的东西多看看dbus的文档:

http://dbus.freedesktop.org/doc/dbus-specification.html

 

你可能感兴趣的:(A1:,嵌入式Linux开发)