summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/dbus-send.118
-rw-r--r--tools/dbus-send.c22
2 files changed, 24 insertions, 16 deletions
diff --git a/tools/dbus-send.1 b/tools/dbus-send.1
index 978ee2e7..725507c0 100644
--- a/tools/dbus-send.1
+++ b/tools/dbus-send.1
@@ -8,7 +8,8 @@ dbus-send \- Send a message to a message bus
.SH SYNOPSIS
.PP
.B dbus-send
-[\-\-system | \-\-session] [\-\-dest=SERVICE] [\-\-print-reply] [\-\-type=TYPE] <message name> [contents ...]
+[\-\-system | \-\-session] [\-\-dest=SERVICE] [\-\-print-reply]
+[\-\-type=TYPE] <destination object path> <message name> [contents ...]
.SH DESCRIPTION
@@ -28,21 +29,22 @@ specified, \fIdbus-send\fP sends to the session bus.
Nearly all uses of \fIdbus-send\fP must provide the \-\-dest argument
which is the name of a service on the bus to send the message to. If
\-\-dest is omitted, a default service name of
-"org.freedesktop.DBus.Broadcast" is used.
+"org.freedesktop.Broadcast" is used.
.PP
-The name of the message to send must always be specified. Following
-arguments, if any, are the message contents (message arguments).
-These are given as a type name, a colon, and then the value of the
-argument. The possible type names are: string, int32, uint32, double,
-byte, boolean. (D-BUS supports more types than these, but
-\fIdbus-send\fP currently does not.)
+The object path and the name of the message to send must always be
+specified. Following arguments, if any, are the message contents
+(message arguments). These are given as a type name, a colon, and
+then the value of the argument. The possible type names are: string,
+int32, uint32, double, byte, boolean. (D-BUS supports more types than
+these, but \fIdbus-send\fP currently does not.)
.PP
Here is an example invocation:
.nf
dbus-send \-\-dest='org.freedesktop.ExampleService' \\
+ /org/freedesktop/sample/object/name \\
org.freedesktop.ExampleInterface.ExampleMethod \\
int32:47 string:'hello world' double:65.32
diff --git a/tools/dbus-send.c b/tools/dbus-send.c
index 7ea49aac..67abe066 100644
--- a/tools/dbus-send.c
+++ b/tools/dbus-send.c
@@ -30,7 +30,7 @@
static void
usage (char *name, int ecode)
{
- fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=SERVICE] [--type=TYPE] [--print-reply] <message name> [contents ...]\n", name);
+ fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=SERVICE] [--type=TYPE] [--print-reply] <destination object path> <message name> [contents ...]\n", name);
exit (ecode);
}
@@ -45,11 +45,12 @@ main (int argc, char *argv[])
int i;
DBusBusType type = DBUS_BUS_SESSION;
const char *dest = DBUS_SERVICE_ORG_FREEDESKTOP_BROADCAST;
- char *name = NULL;
+ const char *name = NULL;
+ const char *path = NULL;
int message_type = DBUS_MESSAGE_TYPE_SIGNAL;
const char *type_str = NULL;
- if (argc < 2)
+ if (argc < 3)
usage (argv[0], 1);
print_reply = FALSE;
@@ -72,8 +73,12 @@ main (int argc, char *argv[])
usage (argv[0], 0);
else if (arg[0] == '-')
usage (argv[0], 1);
+ else if (path == NULL)
+ path = arg;
+ else if (name == NULL)
+ name = arg;
else
- name = arg;
+ usage (argv[0], 1);
}
if (name == NULL)
@@ -117,9 +122,10 @@ main (int argc, char *argv[])
}
*last_dot = '\0';
- message = dbus_message_new_method_call (name,
- last_dot + 1,
- NULL);
+ message = dbus_message_new_method_call (NULL,
+ path,
+ name,
+ last_dot + 1);
}
else if (message_type == DBUS_MESSAGE_TYPE_SIGNAL)
{
@@ -134,7 +140,7 @@ main (int argc, char *argv[])
}
*last_dot = '\0';
- message = dbus_message_new_signal (name, last_dot + 1);
+ message = dbus_message_new_signal (path, name, last_dot + 1);
}
else
{