Newbie trying to get things to work...
Daniel Silverstone
dsilvers@digital-scurf.org
Thu, 26 Feb 2004 13:00:18 +0000
--=-J4MYtdL+JjN1r4cIMLej
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Thu, 2004-02-26 at 12:49, Tako Schotanus wrote:
> I would have expected at least some kind of reaction from either the
> monitor or the send command or am I missing something important here. Of
> course there is no service foo/bar, but like I said I would have
> expected at least some kind of message.
IME, the dbus-monitor code is fairly useless without a simple patch to
get it to be able to listen out for events.
The Debian packages of 0.20 carry that patch and I have attached it here
for you.
I don't know if it'll apply to CVS though, so good luck.
D.
--
Daniel Silverstone http://www.digital-scurf.org/
Hostmaster, Webmaster, and Chief Code Wibbler: Digital-Scurf Unlimited
GPG Public key available from keyring.debian.org KeyId: 20687895
--=-J4MYtdL+JjN1r4cIMLej
Content-Disposition: attachment; filename=dbus-monitor.patch
Content-Type: text/x-patch; name=dbus-monitor.patch; charset=iso-8859-15
Content-Transfer-Encoding: 7bit
--- dbus-0.20/tools/dbus-monitor.1.old 2004-01-08 22:41:13.000000000 +0000
+++ dbus-0.20/tools/dbus-monitor.1 2004-01-08 22:40:34.000000000 +0000
@@ -9,6 +9,7 @@
.PP
.B dbus-monitor
[\-\-system | \-\-session]
+[watch expressions]
.SH DESCRIPTION
@@ -25,6 +26,11 @@
monitor the system or session buses respectively. If neither is
specified, \fIdbus-monitor\fP monitors the session bus.
+.PP
+In order to get \fIdbus-monitor\fP to see the messages you are interested
+in, you should specify a set of watch expressions as you would expect to
+be passed to the \fIdbus_bus_add_watch\fP function.
+
.PP
The message bus configuration may keep \fIdbus-monitor\fP from seeing
all messages, especially if you run the monitor as a non-root user.
@@ -37,6 +43,15 @@
.I "--session"
Monitor the session message bus. (This is the default.)
+.SH EXAMPLE
+Here is an example of using dbus-monitor to watch for the gnome typing
+monitor to say things
+.nf
+
+ dbus-monitor "type='signal',sender='org.gnome.TypingMonitor',interface='org.gnome.TypingMonitor'"
+
+.fi
+
.SH AUTHOR
dbus-monitor was written by Philip Blundell.
--- dbus-0.20/tools/dbus-monitor.c.old 2004-01-08 22:41:42.000000000 +0000
+++ dbus-0.20/tools/dbus-monitor.c 2004-01-08 22:35:56.000000000 +0000
@@ -47,7 +47,7 @@
static void
usage (char *name, int ecode)
{
- fprintf (stderr, "Usage: %s [--system | --session]\n", name);
+ fprintf (stderr, "Usage: %s [--system | --session] [watch expressions]\n", name);
exit (ecode);
}
@@ -74,11 +74,10 @@
break;
else if (arg[0] == '-')
usage (argv[0], 1);
+ else
+ break;
}
- if (argc > 2)
- usage (argv[0], 1);
-
loop = g_main_loop_new (NULL, FALSE);
dbus_error_init (&error);
@@ -94,6 +93,18 @@
dbus_connection_setup_with_g_main (connection, NULL);
+ while (i < argc)
+ {
+ dbus_bus_add_match (connection, argv[i++], &error);
+ if (dbus_error_is_set (&error))
+ {
+ fprintf (stderr, "Failed to set up match \"%s\": %s\n",
+ argv[i-1], error.message);
+ dbus_error_free (&error);
+ exit (1);
+ }
+ }
+
dbus_connection_add_filter (connection, filter_func, NULL, NULL);
g_main_loop_run (loop);
--=-J4MYtdL+JjN1r4cIMLej--