how to check if hal is ready

Artem Kachitchkine Artem.Kachitchkin at Sun.COM
Fri Mar 3 12:43:27 PST 2006


> I don't know how it works when there are multiple volumes on a usb
> stick. I have an mp3 player which has an mmc/sd card reader, and
> although I don't have one of those cards, once I borrowed one from
> a friend and as far as I can remember, those two volumes appeared
> as if they don't have anything in common (from a 1 km perspective, at
> least).

'volume' devices are also 'block' devices. Volumes belonging to the sate 
storage device will have the same "block.storage_device" property.

> I got curious now and I'm probably gonna try it again, one
> of these days. If two volumes are actually partitions, then
> I suppose they should belong to the same device (ie LibHalDrive).

It's better to think in terms of properties, not in terms of libhal.

> If he needs two volumes to be ready, ie mounted

I think "ready" here means "added to GDL" (global device list). When you 
insert a storage device, HAL probes the storage device as a whole. 
During probing, the device is added to TDL (temporary device list), if 
probing was successful, the device moves to GDL - that's when the 
'DeviceAdded' signal is sent. After that, HAL searches for volumes on 
this storage device - the entire device or inside partitions - following 
the same TDL->probing->GDL routine.

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.

One thing we can be sure about is that when the 'storage' device is 
added to GDL, it's already been probed. The 'hal-probe-storage' addon 
looks at the partition table to set "storage.no_partitions_hint". One 
possibility here would be to add a property that would indicate the 
number of partitions found, but it's hard to predict how many of those 
partitions will later translate into HAL volumes.

It's an interesting problem to think about.

-Artem.


More information about the hal mailing list