Chinaunix首页 | 论坛 | 博客
  • 博客访问: 143338
  • 博文数量: 35
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 260
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-16 22:30
文章分类

全部博文(35)

文章存档

2016年(2)

2015年(24)

2014年(9)

我的朋友

分类: LINUX

2015-02-16 09:38:41

1. Configuretion

This is trickier, because D-Bus policy typically prevents anything but signals from being viewable by dbus-monitor. But we can change that.

1.1 Create a file /etc/dbus-1/system-local.conf, with these contents:

"-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
">

1.2 Modify file /etc/dbus-1/system.conf to enable method call 

Original

Modify to 

2.Run dbus monitor

2.1 Reboot

Reboot your machine to pick up the configuration changes. Simply reloading the DBus server configuration is not sufficient. For further info see this bug.

2.2 Run dbus monitor

Now run dbus-monitor as root. You should be able to see all signals, method calls, and method replies.

~# export DBUS_SESSION_BUS_ADDRESS=unix:path=/var/run/dbus/system_bus_socket
~# dbus-monitor --system

You will get the method call ,signal like this:

method call sender=:1.11 -> dest=org.chromium.CrosDisks serial=157 path=/org/chromium/CrosDisks; interface=org.chromium.CrosDisks; member=Format
   string "/sys/devices/pci0000:00/0000:00:12.2/usb1/1-4/1-4:1.0/host0/target0:0:0/0:0:0:0/block/sdb/sdb1"
   string "vfat"
   array [
   ]
method return sender=:1.14 -> dest=:1.11 reply_serial=157

 

If there is just too much information on the bus, pass a match rule like so to filter all the noise:

dbus-monitor "type=signal,sender='org.chromium.CrosDisks',interface='org.chromium.CrosDisks'"

Multiple rules can be specified. If a message matches any of the rules, the message will be printed. Like so: 

dbus-monitor "type=error" "sender=org.chromium.CrosDisks"
dbus-monitor "type=method_call" "type=method_return" "type=error"

When done debugging, it is wise to remove the policy snippet: 

sudo rm /etc/dbus-1/system-local.conf

Reference

1.

阅读(1430) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~