General questions about HAL

Dik Takken D.H.J.Takken at phys.uu.nl
Sun Feb 26 03:26:38 PST 2006


On Sun, 26 Feb 2006, Niki Kovacs wrote:

> I've seen some implementations of HAL on distros like Aurox, Suse or Freerock
> GSB, but they're all quite buggy. If the perfect distro shipping HAL existed, I
> would gladly use it. (I must add that the desktop I use is a personal mixture of
> XFCE 4.2.3.2 with a minimal set of GNOME-libs... modern yet working on old
> hardware)

I am just an ordinary Linux user trying to customize how HAL interacts 
with the desktop (KDE in my case). I also think that the existing HAL 
integration in the current Linux desktop is not good enough (and not 
really customizable), so I write my own event handling scripts. I guess 
there are many Linux users who would like to play with this, but it is not 
easy to get the information that you need.

Fortunatly, I managed to get HAL to do *exactly* what I want it to do.

This is what I did:

* Create some custom fdi files that call BASH scripts when new hardware is 
added or removed
* Have these BASH scripts gather information about the device 
(mountpoint, entry in /dev, type of device, etc ) using 
hal-get-property and write it to a file on disk
* Create another BASH script that is run (in the Autostart directory of 
KDE) by the user. This script watches for device information files to 
appear. When such a file appears, it displays an informative message on 
the users desktop like

"Found a Canon Powershot digital PTP camera"

and then it just does the thing you want it to do, like copy photographs 
to the DigiKam photo album, launch a DVD player, or automount a USB key 
and display its contents in a Konqueror window.

The tricky part is creating the fdi files that launch your custom BASH 
scripts. The rest is just a matter of knowing which device info exists, 
which you can find out by running 'lshal'. I can post an example if 
you want to see it.

Cheers,

Dik


More information about the hal mailing list