Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15496467
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2009-06-24 09:11:29

1.session发送测试
首先运行
《一个dbus精简IPC实例源码》示例中的dbus-example接收程序,如下:
luther@gliethttp:/vobs/dbus$ ./dbus-example receive
Listening for signals
Match rule sent
Got Signal with value gliethttp.cublog.cn
Got Signal with value gliethttp.cublog.cn
接下来使用dbus-send工具发送数据.
luther@gliethttp:~$ dbus-send --session --type=signal --dest=test.signal.sink /luther/gliethttp test.signal.Type.Test string:'gliethttp.cublog.cn'
或者不指定dest,因为dbus-session的daemon程序如果发现message类型为signal,那么即便没有dest,它也将尝试将该message发送到interface,signal想匹配的应用程序上.
luther@gliethttp:~$ dbus-send --session --type=signal /luther/gliethttp test.signal.Type.Test string:'gliethttp.cublog.cn'
ps:不加
--print-reply,是因为signal没有返回数据.《对dbus路由端口名称创建和使用的一点理解》
2.system发送测试
luther@gliethttp:~$ dbus-send --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/Manager org.freedesktop.Hal.Manager.GetAllDevices
method return sender=:1.1 -> dest=:1.62 reply_serial=2
   array [
      string "/org/freedesktop/Hal/devices/acpi_CPU0"
      string "/org/freedesktop/Hal/devices/acpi_CPU1"
      string "/org/freedesktop/Hal/devices/computer_alsa_timer"
      string "/org/freedesktop/Hal/devices/computer_oss_sequencer_0"
      string "/org/freedesktop/Hal/devices/computer_oss_sequencer"
      string "/org/freedesktop/Hal/devices/computer_alsa_sequencer"
      string "/org/freedesktop/Hal/devices/computer_logicaldev_input_1"
      string "/org/freedesktop/Hal/devices/pnp_PNP0501_serial_platform_0"
      string "/org/freedesktop/Hal/devices/platform_pcspkr_logicaldev_input"
      string "/org/freedesktop/Hal/devices/pci_8086_2926_scsi_host_0"
      string "/org/freedesktop/Hal/devices/pci_8086_2926_scsi_host"
      string "/org/freedesktop/Hal/devices/pci_8086_2920_scsi_host_0_scsi_device_lun0_scsi_generic"
      string "/org/freedesktop/Hal/devices/storage_model_DVD__RW_DH_16A6S"
      string "/org/freedesktop/Hal/devices/pci_8086_2920_scsi_host_0_scsi_host"
      string "/org/freedesktop/Hal/devices/pci_8086_2920_scsi_host_scsi_device_lun0_scsi_generic"
      string "/org/freedesktop/Hal/devices/volume_uuid_12367144_2ed2_4aec_9bce_3a19f8d75aa8"
      string "/org/freedesktop/Hal/devices/volume_uuid_72d754bd_c275_45fd_a6bd_82ddc96317a8"
      string "/org/freedesktop/Hal/devices/volume_uuid_ecc6faa2_fc27_483b_9f8e_b9807fcf793f"
      string "/org/freedesktop/Hal/devices/volume_uuid_9286_9286"
      string "/org/freedesktop/Hal/devices/volume_part2_size_1024"
      string "/org/freedesktop/Hal/devices/volume_uuid_9287_9287"
      string "/org/freedesktop/Hal/devices/storage_serial_1ATA_ST3160815AS_9RX9TVTX"
      string "/org/freedesktop/Hal/devices/computer"
      string "/org/freedesktop/Hal/devices/pci_8086_2920_scsi_host_scsi_host"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0_alsa_playback_1"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0_alsa_playback_0"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0_alsa_capture_0"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0_oss_mixer__1"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0_oss_pcm_0_0"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0_alsa_control__1"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0_oss_pcm_0"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0_oss_pcm_1"
      string "/org/freedesktop/Hal/devices/pci_8086_293e_sound_card_0"
      string "/org/freedesktop/Hal/devices/usb_device_461_4d22_noserial_if0_logicaldev_input"
      string "/org/freedesktop/Hal/devices/usb_device_413c_2105_noserial_if0_logicaldev_input"
      string "/org/freedesktop/Hal/devices/net_00_21_9b_3a_1a_0b"
      string "/org/freedesktop/Hal/devices/pci_8086_29b7_serial_platform_1"
      string "/org/freedesktop/Hal/devices/fuse"
      string "/org/freedesktop/Hal/devices/computer_logicaldev_input_0"
      string "/org/freedesktop/Hal/devices/computer_logicaldev_input"
      string "/org/freedesktop/Hal/devices/pnp_PNP0103"
      string "/org/freedesktop/Hal/devices/pnp_PNP0501"
      string "/org/freedesktop/Hal/devices/pnp_PNP0401"
      string "/org/freedesktop/Hal/devices/pnp_PNP0b00"
      string "/org/freedesktop/Hal/devices/pnp_PNP0800"
      string "/org/freedesktop/Hal/devices/pnp_PNP0c04"
      string "/org/freedesktop/Hal/devices/pnp_PNP0200"
      string "/org/freedesktop/Hal/devices/pnp_PNP0c01"
      string "/org/freedesktop/Hal/devices/pnp_PNP0a03"
      string "/org/freedesktop/Hal/devices/platform_serial8250"
      string "/org/freedesktop/Hal/devices/platform_pcspkr"
      string "/org/freedesktop/Hal/devices/platform_iTCO_wdt"
      string "/org/freedesktop/Hal/devices/platform_i8042_i8042_AUX_port"
      string "/org/freedesktop/Hal/devices/platform_i8042_i8042_KBD_port"
      string "/org/freedesktop/Hal/devices/platform_i8042"
      string "/org/freedesktop/Hal/devices/platform_eisa_0"
      string "/org/freedesktop/Hal/devices/platform_dcdbas"
      string "/org/freedesktop/Hal/devices/platform_coretemp_1"
      string "/org/freedesktop/Hal/devices/platform_coretemp_0"
      string "/org/freedesktop/Hal/devices/pci_8086_2926"
      string "/org/freedesktop/Hal/devices/pci_8086_2930"
      string "/org/freedesktop/Hal/devices/pci_8086_2920_scsi_host_0_scsi_device_lun0"
      string "/org/freedesktop/Hal/devices/pci_8086_2920_scsi_host_0"
      string "/org/freedesktop/Hal/devices/pci_8086_2920_scsi_host_scsi_device_lun0"
      string "/org/freedesktop/Hal/devices/pci_8086_2920_scsi_host"
      string "/org/freedesktop/Hal/devices/pci_8086_2920"
      string "/org/freedesktop/Hal/devices/pci_8086_2914"
      string "/org/freedesktop/Hal/devices/pci_8086_244e"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_2_0000_00_1d_7_if0"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_2_0000_00_1d_7"
      string "/org/freedesktop/Hal/devices/pci_8086_293a"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1d_2_if0"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1d_2"
      string "/org/freedesktop/Hal/devices/pci_8086_2936"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1d_1_if0"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1d_1"
      string "/org/freedesktop/Hal/devices/pci_8086_2935"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1d_0_if0"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1d_0"
      string "/org/freedesktop/Hal/devices/pci_8086_2934"
      string "/org/freedesktop/Hal/devices/pci_8086_2940"
      string "/org/freedesktop/Hal/devices/pci_8086_293e"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_2_0000_00_1a_7_if0"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_2_0000_00_1a_7"
      string "/org/freedesktop/Hal/devices/pci_8086_293c"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1a_1_if0"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1a_1"
      string "/org/freedesktop/Hal/devices/pci_8086_2938"
      string "/org/freedesktop/Hal/devices/usb_device_461_4d22_noserial_if0"
      string "/org/freedesktop/Hal/devices/usb_device_461_4d22_noserial"
      string "/org/freedesktop/Hal/devices/usb_device_413c_2105_noserial_if0"
      string "/org/freedesktop/Hal/devices/usb_device_413c_2105_noserial"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1a_0_if0"
      string "/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1a_0"
      string "/org/freedesktop/Hal/devices/pci_8086_2937"
      string "/org/freedesktop/Hal/devices/pci_8086_10bd"
      string "/org/freedesktop/Hal/devices/pci_8086_29b7"
      string "/org/freedesktop/Hal/devices/pci_8086_29b6"
      string "/org/freedesktop/Hal/devices/pci_8086_29b4"
      string "/org/freedesktop/Hal/devices/pci_8086_29b3"
      string "/org/freedesktop/Hal/devices/pci_8086_29b2"
      string "/org/freedesktop/Hal/devices/pci_8086_29b1"
      string "/org/freedesktop/Hal/devices/pci_8086_29b0"
   ]
luther@gliethttp:~$
==========================================
luther@gliethttp:~$ dbus-send --system --print-reply --dest=org.freedesktop.DBus /luther/gliethttp org.freedesktop.DBus.ListNames
method return sender=org.freedesktop.DBus -> dest=:1.95 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string ":1.7"
      string ":1.8"
      string ":1.9"
      string "org.freedesktop.SystemToolsBackends"
      string "org.freedesktop.NetworkManager"
      string ":1.40"
      string ":1.20"
      string "org.bluez"
      string ":1.22"
      string ":1.23"
      string "org.freedesktop.NetworkManagerSystemSettings"
      string ":1.24"
      string ":1.25"
      string ":1.48"
      string ":1.26"
      string ":1.27"
      string "com.redhat.NewPrinterNotification"
      string "fi.epitest.hostap.WPASupplicant"
      string ":1.28"
      string ":1.29"
      string "org.freedesktop.Avahi"
      string "org.freedesktop.ConsoleKit"
      string "org.freedesktop.Hal"
      string ":1.95"
      string ":1.52"
      string ":1.30"
      string "org.freedesktop.NetworkManagerUserSettings"
      string ":1.31"
      string ":1.10"
      string ":1.32"
      string ":1.11"
      string ":1.33"
      string ":1.12"
      string ":1.34"
      string ":1.0"
      string ":1.13"
      string ":1.1"
      string ":1.14"
      string ":1.2"
      string ":1.15"
      string ":1.37"
      string ":1.3"
      string ":1.16"
      string ":1.38"
      string ":1.4"
      string ":1.17"
      string ":1.39"
      string ":1.5"
      string ":1.18"
      string ":1.6"
      string ":1.19"
   ]
luther@gliethttp:~$ dbus-send --session --print-reply --dest=org.freedesktop.DBus /luther/gliethttp org.freedesktop.DBus.ListNames
method return sender=org.freedesktop.DBus -> dest=:1.359 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string "org.freedesktop.Notifications"
      string "org.freedesktop.PowerManagement"
      string ":1.7"
      string ":1.8"
      string ":1.9"
      string "org.gtk.vfs.Daemon"
      string "org.gnome.Vino"
      string "org.gnome.SessionManager"
      string ":1.60"
      string ":1.61"
      string ":1.62"
      string "org.gnome.GConf"
      string ":1.40"
      string ":1.63"
      string ":1.41"
      string ":1.64"
      string ":1.20"
      string ":1.42"
      string ":1.65"
      string ":1.21"
      string ":1.66"
      string "org.gnome.keyring"
      string ":1.22"
      string ":1.23"
      string ":1.24"
      string ":1.25"
      string ":1.47"
      string ":1.26"
      string ":1.48"
      string ":1.49"
      string ":1.27"
      string ":1.28"
      string ":1.29"
      string "org.gnome.SettingsDaemon"
      string ":1.359"
      string "org.gnome.ScreenSaver"
      string ":1.50"
      string "org.gtk.Private.HalVolumeMonitor"
      string "org.bluez.applet"
      string ":1.51"
      string ":1.52"
      string ":1.30"
      string ":1.53"
      string ":1.31"
      string ":1.54"
      string ":1.32"
      string ":1.55"
      string ":1.11"
      string ":1.33"
      string ":1.56"
      string ":1.12"
      string ":1.34"
      string ":1.57"
      string ":1.0"
      string ":1.35"
      string ":1.58"
      string ":1.1"
      string ":1.36"
      string ":1.59"
      string ":1.2"
      string ":1.37"
      string ":1.16"
      string ":1.38"
      string ":1.4"
      string ":1.17"
      string ":1.5"
      string ":1.18"
      string "org.gtk.Private.GPhoto2VolumeMonitor"
      string ":1.6"
      string ":1.19"
   ]
luther@gliethttp:~$
阅读(5232) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~