hal_initialize() overrides other filter/object/fallback
functions on separate connection
Kay Sievers
kay.sievers at vrfy.org
Mon Aug 9 11:47:30 PDT 2004
On Mon, 2004-08-09 at 17:42 +0200, David Zeuthen wrote:
> On Sun, 2004-08-08 at 22:35 -0400, Havoc Pennington wrote:
> > On Sun, 2004-08-08 at 13:35, David Zeuthen wrote:
> > > On Sun, 2004-08-08 at 19:26 +0200, Olivier Andrieu wrote:
> > > > David Zeuthen [Sun, 08 Aug 2004]:
> > > > > > > libhal uses this global filter mechanism to dispatch the signals to
> > > > > > > the registered HAL user functions. Can't libhal (or other libraries
> > > > > > > too) just use dbus_connection_register_object_path() to get called
> > > > > > > at incoming messages for the objects paths it is intersted in?
> > > > > >
> > > > > > Absolutely.
> > > > > >
> > > > >
> > > > > I beg to differ :-). Sometimes you want to listen to all signals
> > > > > regardless of the object path and this is currently only possible
> > > > > with _add_filter() if I'm not mistaken.
> > > >
> > > > You can register a fallback handler for "/". That should catch signals
> > > > from any object.
> > > >
> > >
> > > OK, thanks, I didn't think of that, my bad. I'll change my code to use
> > > these functions instead of _add_filter(). The documentation for
> > > _add_filter() should state that non D-BUS code shouldn't use it though.
> >
> > Wait, I think the fact that signals *from* /foo/bar go to the object at
> > /foo/bar is completely accidental ;-) Does that even make sense?
> >
>
> Not really, because how would you specify what service and interface you
> want signals from? I suppose that it would be good to state in the docs
> that dbus_connection_register_object_path() is only to be used for
> handling methods on the callers own objects.
Hmm, I get _all_ signals from the objects I subscribe to. I've added a
register_object to the python bindings and get all signals sent from
/org/freedesktop/Hal/Manager. This works for me:
dbus.py:class Bus
def add_object_match(self, handler_function, path):
match_rule = "type='signal',path='%s'" % (path)
dbus_bindings.bus_add_match(self._connection, match_rule)
self._connection.register_object_path(path, None,handler_function)
DeviceManager.py:__init__
self.bus.add_object_match(self.gdl_changed,
"/org/freedesktop/Hal/Manager")
Thanks,
Kay
More information about the dbus
mailing list