3 .\" Author: [see the "AUTHOR" section]
4 .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
6 .\" Manual: User Commands
7 .\" Source: User Commands
10 .TH "GDBUS" "1" "03/05/2012" "User Commands" "User Commands"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 gdbus \- Tool for working with D\-Bus objects
33 .HP \w'\fBgdbus\fR\ 'u
34 \fBgdbus\fR introspect [\-\-system | \-\-session | \-\-address\ \fIaddress\fR] \-\-dest\ \fIbus_name\fR \-\-object\-path\ \fI/path/to/object\fR [\-\-xml] [\-\-recurse] [\-\-only\-properties]
35 .HP \w'\fBgdbus\fR\ 'u
36 \fBgdbus\fR monitor [\-\-system | \-\-session | \-\-address\ \fIaddress\fR] \-\-dest\ \fIbus_name\fR [\-\-object\-path\ \fI/path/to/object\fR]
37 .HP \w'\fBgdbus\fR\ 'u
38 \fBgdbus\fR call [\-\-system | \-\-session | \-\-address\ \fIaddress\fR] \-\-dest\ \fIbus_name\fR \-\-object\-path\ \fI/path/to/object\fR \-\-method\ \fIorg\&.project\&.InterfaceName\&.MethodName\fR [\-\-timeout\ \fIseconds\fR] ARG1 ARG2...
39 .HP \w'\fBgdbus\fR\ 'u
40 \fBgdbus\fR emit [\-\-system | \-\-session | \-\-address\ \fIaddress\fR] \-\-object\-path\ \fI/path/to/object\fR \-\-signal\ \fIorg\&.project\&.InterfaceName\&.SignalName\fR [\-\-dest\ \fIunique_bus_name\fR] ARG1 ARG2...
41 .HP \w'\fBgdbus\fR\ 'u
47 is a simple tool for working with D\-Bus objects\&.
52 Prints out interfaces and property values for a remote object\&. For this to work, the owner of the object needs to implement the
53 org\&.freedesktop\&.DBus\&.Introspectable
56 option is used, the returned introspection XML is printed, otherwise a parsed pretty representation is printed\&. The
58 option can be used to introspect children (and their children and so on) and the
59 \fB\-\-only\-properties\fR
60 option can be used to only print the interfaces with properties\&.
65 Monitors one or all objects owned by the owner of
71 Invokes a method on a remote object\&. Each argument to pass to the method must be specified as a serialized
73 except that strings do not need explicit quotes\&. The return values are printed out as serialized
80 Emits a signal\&. Each argument to include in the signal must be specified as a serialized
82 except that strings do not need explicit quotes\&.
87 Prints help and exit\&.
93 ships with a bash completion script to complete commands, destinations, bus names, object paths and interface/method names\&.
96 This shows how to introspect an object \- note that the value of each
97 property is displayed:
103 $ gdbus introspect \-\-system \e
104 \-\-dest org\&.freedesktop\&.NetworkManager \e
105 \-\-object\-path /org/freedesktop/NetworkManager/Devices/0
106 node /org/freedesktop/NetworkManager/Devices/0 {
107 interface org\&.freedesktop\&.DBus\&.Introspectable {
109 Introspect(out s data);
111 interface org\&.freedesktop\&.DBus\&.Properties {
119 GetAll(in s interface,
122 interface org\&.freedesktop\&.NetworkManager\&.Device\&.Wired {
124 PropertiesChanged(a{sv} arg_0);
126 readonly b Carrier = false;
127 readonly u Speed = 0;
128 readonly s HwAddress = \*(Aq00:1D:72:88:BE:97\*(Aq;
130 interface org\&.freedesktop\&.NetworkManager\&.Device {
134 StateChanged(u arg_0,
138 readonly u DeviceType = 1;
139 readonly b Managed = true;
140 readwrite o Ip6Config = \*(Aq/\*(Aq;
141 readwrite o Dhcp4Config = \*(Aq/\*(Aq;
142 readwrite o Ip4Config = \*(Aq/\*(Aq;
143 readonly u State = 2;
144 readwrite u Ip4Address = 0;
145 readonly u Capabilities = 3;
146 readonly s Driver = \*(Aqe1000e\*(Aq;
147 readwrite s Interface = \*(Aqeth0\*(Aq;
148 readonly s Udi = \*(Aq/sys/devices/pci0000:00/0000:00:19\&.0/net/eth0\*(Aq;
159 \fB\-\-only\-properties\fR
160 options can be useful when wanting to inspect all objects owned by a particular process:
166 $ gdbus introspect \-\-system \-\-dest org\&.freedesktop\&.UPower \-\-object\-path / \-\-recurse \-\-only\-properties
169 node /org/freedesktop {
170 node /org/freedesktop/UPower {
171 interface org\&.freedesktop\&.UPower {
173 readonly b IsDocked = true;
174 readonly b LidForceSleep = false;
175 readonly b LidIsPresent = false;
176 readonly b LidIsClosed = false;
177 readonly b OnLowBattery = false;
178 readonly b OnBattery = false;
179 readonly b CanHibernate = true;
180 readonly b CanSuspend = true;
181 readonly s DaemonVersion = \*(Aq0\&.9\&.10\*(Aq;
183 node /org/freedesktop/UPower/Policy {
185 node /org/freedesktop/UPower/Wakeups {
186 interface org\&.freedesktop\&.UPower\&.Wakeups {
188 readonly b HasCapability = true;
200 In a similar fashion, the
202 command can be used to learn details about the
211 interface org\&.freedesktop\&.Notifications {
213 GetServerInformation(out s return_name,
215 out s return_version,
216 out s return_spec_version);
217 GetCapabilities(out as return_caps);
218 CloseNotification(in u id);
219 Notify(in s app_name,
235 With this information, it\*(Aqs easy to use the
237 command to display a notification
243 $ gdbus call \-\-session \e
244 \-\-dest org\&.freedesktop\&.Notifications \e
245 \-\-object\-path /org/freedesktop/Notifications \e
246 \-\-method org\&.freedesktop\&.Notifications\&.Notify \e
251 "Here\*(Aqs the body of the notification" \e
261 Monitoring all objects on a service:
267 $ gdbus monitor \-\-system \-\-dest org\&.freedesktop\&.ConsoleKit
268 Monitoring signals from all objects owned by org\&.freedesktop\&.ConsoleKit
269 The name org\&.freedesktop\&.ConsoleKit is owned by :1\&.15
270 /org/freedesktop/ConsoleKit/Session2: org\&.freedesktop\&.ConsoleKit\&.Session\&.ActiveChanged (false,)
271 /org/freedesktop/ConsoleKit/Seat1: org\&.freedesktop\&.ConsoleKit\&.Seat\&.ActiveSessionChanged (\*(Aq\*(Aq,)
272 /org/freedesktop/ConsoleKit/Session2: org\&.freedesktop\&.ConsoleKit\&.Session\&.ActiveChanged (true,)
273 /org/freedesktop/ConsoleKit/Seat1: org\&.freedesktop\&.ConsoleKit\&.Seat\&.ActiveSessionChanged (\*(Aq/org/freedesktop/ConsoleKit/Session2\*(Aq,)
279 Monitoring a single object on a service:
285 $ gdbus monitor \-\-system \-\-dest org\&.freedesktop\&.NetworkManager \-\-object\-path /org/freedesktop/NetworkManager/AccessPoint/4141
286 Monitoring signals on object /org/freedesktop/NetworkManager/AccessPoint/4141 owned by org\&.freedesktop\&.NetworkManager
287 The name org\&.freedesktop\&.NetworkManager is owned by :1\&.5
288 /org/freedesktop/NetworkManager/AccessPoint/4141: org\&.freedesktop\&.NetworkManager\&.AccessPoint\&.PropertiesChanged ({\*(AqStrength\*(Aq: <byte 0x5c>},)
289 /org/freedesktop/NetworkManager/AccessPoint/4141: org\&.freedesktop\&.NetworkManager\&.AccessPoint\&.PropertiesChanged ({\*(AqStrength\*(Aq: <byte 0x64>},)
290 /org/freedesktop/NetworkManager/AccessPoint/4141: org\&.freedesktop\&.NetworkManager\&.AccessPoint\&.PropertiesChanged ({\*(AqStrength\*(Aq: <byte 0x5e>},)
291 /org/freedesktop/NetworkManager/AccessPoint/4141: org\&.freedesktop\&.NetworkManager\&.AccessPoint\&.PropertiesChanged ({\*(AqStrength\*(Aq: <byte 0x64>},)
303 $ gdbus emit \-\-session \-\-object\-path /foo \-\-signal org\&.bar\&.Foo "[\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz\*(Aq]"
309 Emitting a signal to a specific process:
315 $ gdbus emit \-\-session \-\-object\-path /bar \-\-signal org\&.bar\&.Bar someString \-\-dest :1\&.42
322 Written by David Zeuthen
324 with a lot of help from many others\&.
327 Please send bug reports to either the distribution bug tracker or the upstream bug tracker at
328 \m[blue]\fB\%https://bugzilla.gnome.org/enter_bug.cgi?product=glib\fR\m[]\&.