503 lines
11 KiB
HTML
503 lines
11 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GDBUS</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GDBUS</H1>
|
|
Section: User Commands (1)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
gdbus - Tool for working with D-Bus objects
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>gdbus</B> introspect [--system | --session | --address <I>address</I>] --dest <I>bus_name</I> --object-path <I>/path/to/object</I> [--xml] [--recurse] [--only-properties]
|
|
<DT id="2">
|
|
<B>gdbus</B> monitor [--system | --session | --address <I>address</I>] --dest <I>bus_name</I> [--object-path <I>/path/to/object</I>]
|
|
<DT id="3">
|
|
<B>gdbus</B> call [--system | --session | --address <I>address</I>] --dest <I>bus_name</I> --object-path <I>/path/to/object</I> --method <I>org.project.InterfaceName.MethodName</I> [--timeout <I>seconds</I>] ARG1 ARG2...
|
|
<DT id="4">
|
|
<B>gdbus</B> emit [--system | --session | --address <I>address</I>] --object-path <I>/path/to/object</I> --signal <I>org.project.InterfaceName.SignalName</I> [--dest <I>unique_bus_name</I>] ARG1 ARG2...
|
|
<DT id="5">
|
|
<B>gdbus</B> wait [--system | --session | --address <I>address</I>] --activate <I>bus_name</I> [--timeout <I>seconds</I>] <I>bus_name</I>
|
|
<DT id="6">
|
|
<B>gdbus</B> help
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<B>gdbus</B>
|
|
<DD>is a simple tool for working with D-Bus objects.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>COMMANDS</H2>
|
|
|
|
<P>
|
|
|
|
<B>introspect</B>
|
|
<DL COMPACT><DT id="7"><DD>
|
|
Prints out interfaces and property values for a remote object. For this to work, the owner of the object needs to implement the
|
|
org.freedesktop.DBus.Introspectable
|
|
interface. If the
|
|
<B>--xml</B>
|
|
option is used, the returned introspection XML is printed, otherwise a parsed pretty representation is printed. The
|
|
<B>--recurse</B>
|
|
option can be used to introspect children (and their children and so on) and the
|
|
<B>--only-properties</B>
|
|
option can be used to only print the interfaces with properties.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>monitor</B>
|
|
<DL COMPACT><DT id="8"><DD>
|
|
Monitors one or all objects owned by the owner of
|
|
<I>bus_name</I>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>call</B>
|
|
<DL COMPACT><DT id="9"><DD>
|
|
Invokes a method on a remote object. Each argument to pass to the method must be specified as a serialized
|
|
<B>GVariant</B>
|
|
except that strings do not need explicit quotes. The return values are printed out as serialized
|
|
<B>GVariant</B>
|
|
values.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>emit</B>
|
|
<DL COMPACT><DT id="10"><DD>
|
|
Emits a signal. Each argument to include in the signal must be specified as a serialized
|
|
<B>GVariant</B>
|
|
except that strings do not need explicit quotes.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>wait</B>
|
|
<DL COMPACT><DT id="11"><DD>
|
|
Waits until
|
|
<I>bus_name</I>
|
|
is owned by some process on the bus. If the
|
|
<B>--activate</B>
|
|
is specified, that bus name will be auto-started first. It may be the same as the bus name being waited for, or different.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>help</B>
|
|
<DL COMPACT><DT id="12"><DD>
|
|
Prints help and exit.
|
|
</DL>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>BASH COMPLETION</H2>
|
|
|
|
<P>
|
|
|
|
<B>gdbus</B>
|
|
ships with a bash completion script to complete commands, destinations, bus names, object paths and interface/method names.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
<BR> This shows how to introspect an object - note that the value of each
|
|
<BR> property is displayed:
|
|
<P>
|
|
<DL COMPACT><DT id="13"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus introspect --system \
|
|
--dest org.freedesktop.NetworkManager \
|
|
--object-path /org/freedesktop/NetworkManager/Devices/0
|
|
node /org/freedesktop/NetworkManager/Devices/0 {
|
|
interface org.freedesktop.DBus.Introspectable {
|
|
methods:
|
|
Introspect(out s data);
|
|
};
|
|
interface org.freedesktop.DBus.Properties {
|
|
methods:
|
|
Get(in s interface,
|
|
in s propname,
|
|
out v value);
|
|
Set(in s interface,
|
|
in s propname,
|
|
in v value);
|
|
GetAll(in s interface,
|
|
out a{sv} props);
|
|
};
|
|
interface org.freedesktop.NetworkManager.Device.Wired {
|
|
signals:
|
|
PropertiesChanged(a{sv} arg_0);
|
|
properties:
|
|
readonly b Carrier = false;
|
|
readonly u Speed = 0;
|
|
readonly s HwAddress = '00:1D:72:88:BE:97';
|
|
};
|
|
interface org.freedesktop.NetworkManager.Device {
|
|
methods:
|
|
Disconnect();
|
|
signals:
|
|
StateChanged(u arg_0,
|
|
u arg_1,
|
|
u arg_2);
|
|
properties:
|
|
readonly u DeviceType = 1;
|
|
readonly b Managed = true;
|
|
readwrite o Ip6Config = '/';
|
|
readwrite o Dhcp4Config = '/';
|
|
readwrite o Ip4Config = '/';
|
|
readonly u State = 2;
|
|
readwrite u Ip4Address = 0;
|
|
readonly u Capabilities = 3;
|
|
readonly s Driver = 'e1000e';
|
|
readwrite s Interface = 'eth0';
|
|
readonly s Udi = '/sys/devices/pci0000:00/0000:00:19.0/net/eth0';
|
|
};
|
|
};
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
The
|
|
<B>--recurse</B>
|
|
and
|
|
<B>--only-properties</B>
|
|
options can be useful when wanting to inspect all objects owned by a particular process:
|
|
<P>
|
|
<DL COMPACT><DT id="14"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus introspect --system --dest org.freedesktop.UPower --object-path / --recurse --only-properties
|
|
node / {
|
|
node /org {
|
|
node /org/freedesktop {
|
|
node /org/freedesktop/UPower {
|
|
interface org.freedesktop.UPower {
|
|
properties:
|
|
readonly b IsDocked = true;
|
|
readonly b LidForceSleep = false;
|
|
readonly b LidIsPresent = false;
|
|
readonly b LidIsClosed = false;
|
|
readonly b OnLowBattery = false;
|
|
readonly b OnBattery = false;
|
|
readonly b CanHibernate = true;
|
|
readonly b CanSuspend = true;
|
|
readonly s DaemonVersion = '0.9.10';
|
|
};
|
|
node /org/freedesktop/UPower/Policy {
|
|
};
|
|
node /org/freedesktop/UPower/Wakeups {
|
|
interface org.freedesktop.UPower.Wakeups {
|
|
properties:
|
|
readonly b HasCapability = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
In a similar fashion, the
|
|
<B>introspect</B>
|
|
command can be used to learn details about the
|
|
Notify
|
|
method:
|
|
<P>
|
|
<DL COMPACT><DT id="15"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
[...]
|
|
interface org.freedesktop.Notifications {
|
|
methods:
|
|
GetServerInformation(out s return_name,
|
|
out s return_vendor,
|
|
out s return_version,
|
|
out s return_spec_version);
|
|
GetCapabilities(out as return_caps);
|
|
CloseNotification(in u id);
|
|
Notify(in s app_name,
|
|
in u id,
|
|
in s icon,
|
|
in s summary,
|
|
in s body,
|
|
in as actions,
|
|
in a{sv} hints,
|
|
in i timeout,
|
|
out u return_id);
|
|
};
|
|
[...]
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
With this information, it's easy to use the
|
|
<B>call</B>
|
|
command to display a notification
|
|
<P>
|
|
<DL COMPACT><DT id="16"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus call --session \
|
|
--dest org.freedesktop.Notifications \
|
|
--object-path /org/freedesktop/Notifications \
|
|
--method org.freedesktop.Notifications.Notify \
|
|
my_app_name \
|
|
42 \
|
|
gtk-dialog-info \
|
|
"The Summary" \
|
|
"Here's the body of the notification" \
|
|
[] \
|
|
{} \
|
|
5000
|
|
(uint32 12,)
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Monitoring all objects on a service:
|
|
<P>
|
|
<DL COMPACT><DT id="17"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus monitor --system --dest org.freedesktop.ConsoleKit
|
|
Monitoring signals from all objects owned by org.freedesktop.ConsoleKit
|
|
The name org.freedesktop.ConsoleKit is owned by :1.15
|
|
/org/freedesktop/ConsoleKit/Session2: org.freedesktop.ConsoleKit.Session.ActiveChanged (false,)
|
|
/org/freedesktop/ConsoleKit/Seat1: org.freedesktop.ConsoleKit.Seat.ActiveSessionChanged ('',)
|
|
/org/freedesktop/ConsoleKit/Session2: org.freedesktop.ConsoleKit.Session.ActiveChanged (true,)
|
|
/org/freedesktop/ConsoleKit/Seat1: org.freedesktop.ConsoleKit.Seat.ActiveSessionChanged ('/org/freedesktop/ConsoleKit/Session2',)
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Monitoring a single object on a service:
|
|
<P>
|
|
<DL COMPACT><DT id="18"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus monitor --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/AccessPoint/4141
|
|
Monitoring signals on object /org/freedesktop/NetworkManager/AccessPoint/4141 owned by org.freedesktop.NetworkManager
|
|
The name org.freedesktop.NetworkManager is owned by :1.5
|
|
/org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x5c>},)
|
|
/org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x64>},)
|
|
/org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x5e>},)
|
|
/org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x64>},)
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Emitting a signal:
|
|
<P>
|
|
<DL COMPACT><DT id="19"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus emit --session --object-path /foo --signal org.bar.Foo "['foo', 'bar', 'baz']"
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Emitting a signal to a specific process:
|
|
<P>
|
|
<DL COMPACT><DT id="20"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus emit --session --object-path /bar --signal org.bar.Bar someString --dest :1.42
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Waiting for a well-known name to be owned on the bus; this will
|
|
<I>not</I>
|
|
auto-start the service:
|
|
<P>
|
|
<DL COMPACT><DT id="21"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus wait --session org.bar.SomeName
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Auto-starting then waiting for a well-known name to be owned on the bus:
|
|
<P>
|
|
<DL COMPACT><DT id="22"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus wait --session --activate org.bar.SomeName
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Auto-starting a different service, then waiting for a well-known name to be owned on the bus. This is useful in situations where
|
|
<I>SomeName</I>
|
|
is not directly activatable:
|
|
<P>
|
|
<DL COMPACT><DT id="23"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus wait --session --activate org.bar.PrerequisiteName org.bar.SomeName
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Waiting for a well-known name and giving up after 30 seconds. By default, the timeout is disabled; or set
|
|
<B>--timeout</B>
|
|
to 0 to disable it:
|
|
<P>
|
|
<DL COMPACT><DT id="24"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ gdbus wait --session --timeout 30 org.bar.SomeName
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
<P>
|
|
|
|
Please send bug reports to either the distribution bug tracker or the upstream bug tracker at
|
|
m[blue]<B><A HREF="https://gitlab.gnome.org/GNOME/glib/issues/new">https://gitlab.gnome.org/GNOME/glib/issues/new</A></B>m[].
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+dbus-send">dbus-send</A></B>(1)
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="25"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="26"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="27"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="28"><A HREF="#lbAE">COMMANDS</A><DD>
|
|
<DT id="29"><A HREF="#lbAF">BASH COMPLETION</A><DD>
|
|
<DT id="30"><A HREF="#lbAG">EXAMPLES</A><DD>
|
|
<DT id="31"><A HREF="#lbAH">BUGS</A><DD>
|
|
<DT id="32"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:13 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|