how to check if hal is ready

Marko Anastasov marko at
Fri Mar 3 16:54:06 PST 2006

> Thinking further, we have the Rescan() method, which can be invoked on a 
> device. When invoked on a storage device, Rescan() will discover new 
> volume and remove stale volumes (e.g. if a disk was reformatted or media 
> replaced). ... Perhaps we could have something 
> like "info.scan_state" property, with values 'in_progress' and 'done'.

If so, it would be also possible to have a callback, like
libhal_rescan_complete(). The ideal solution would be something
like libhal_device_scan_complete(), but ...

> The problem is, there is no way for HAL clients to know when it is 
> finished the volume search process on a given storage device. I'm not 
> even sure it's solvable in general, because, in theory at least, HAL
> is 
> free to scan or not scan for volumes whenever it feels like, or 
> depending on runtime conditions known only to HAL.

Can you explain to me the last two lines? I mean, why would it be a
problem to eg invoke a signal to a user (ie through LibHal) after the
probing/searching for volumes has finished? I've been looking at the HAL
source for the first time and this is what I figured out so far:

I noticed that in hald/blockdev.c there is the
add_blockdev_probing_helper_done() function that is called after
hald-probe-storage finishes, and in it:

/* set block.storage_device for storage devices since only now we know
the UDI */
if (!is_volume) {
  hal_device_copy_property (d, "info.udi", d, "block.storage_device");
} else {
  /* check for mount point */
  blockdev_refresh_mount_state (d);

I guess this is what you mean. After that, blockdev_callouts_add_done()
is called and the device is removed from the TDL and added to the GDL.

This all happens after hotplug_event_begin_add_blockdev() (an important
function as I see) which is invoked in hotplug_event_begin_sysfs()

So when a volume is added, that's a separate hotplug event? I guess
then HAL can only be passive and wait for hotplug to deliver all
volumes one by one. When does HAL take initiative and search for volumes
as you say?


More information about the hal mailing list