Some problems with signals
Daniel Machado
cdanielmachado at gmail.com
Thu Jul 12 08:44:33 PDT 2007
Hi.
I'm developing an app that needs notification on usb-disk mounting and
unmounting.
I'm using hal 0.5.8.1 that comes with ubuntu feisty, and dbus-java.
My app starts by listening for DeviceAdded signals. When a device is
added, it checks for the volume capability on the device. If it is a
volume, it prints the mountpoint and registers a listener for the
Condition signal, so that I can receive Mount and Unmount conditions.
The problem is that HAL never sends the Condition signal when I mount
or unmount the volume. Although it works for the PropertyModified
signal.
Is there a reason for this?
I'm also curious about the mountpoint.
When the device is added, and I check that it is a volume, I consult
the volume.mount_point property.
Sometimes it returns the mountpoint, sometimes it doesn't. (It always
does if I sleep some seconds before consulting). I'm guessing that
sometimes the application executes faster than the delay between
attaching and mounting the device.
Is there a "clean" way to avoid this? One that doesn't involve
repeatedly sleeping and checking for the properties until it's ok.
Thanks,
Daniel
More information about the hal
mailing list