how to use conditions through dbus?

John (J5) Palmieri johnp at redhat.com
Thu May 29 08:13:28 PDT 2008


On Wed, 2008-05-28 at 07:52 +0000, Dmitry Baryshev wrote:
> Hi.
> 
> I'm quite new in HAL and trying to write a simple client. Everything
> works fine, except recieving conditions, like VolumeMount or
> VolumeUnmout. I use Qt. For example:
> 
> cHAL::cHAL()
> {
>    QDBusConnection sys = QDBusConnection::systemBus();
> 
>    sys.connect("org.freedesktop.Hal",
>                 "/org/freedesktop/Hal/Manager",
>                 "org.freedesktop.Hal.Device",
>                 "Condition",
>                 this,
>                 SLOT(slotCond(const char *, const char *, const
> QDBusMessage&)));
> }
> 
> void cHAL::slotCond(const char *udi, const char *cond, const QDBusMessage &det)
> {
>     printf("CONDITION %s %s %d\n", udi, cond, det.arguments().size());
> }
> 
> -------------
> 
> But when I mount or unmount any device with "/bin/mount", no condition
> is recieved.  How to recieve conditions through dbus?
> 
> Thanks in advance.

The object path /org/freedesktop/Hal/Manager does not have that signal
nor does it implement the org.freedesktop.Hal.Device interface.  You
need to attach to specific devices and listen for the Condition signal
on the org.freedesktop.Hal.Device interface.  You can also listen for
all Condition signals coming from a org.freedesktop.Hal.Device interface
regardless of object paths but that is inefficient and I'm not sure how
Qt implements that.
  
-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the hal mailing list