[Gllug] Dbus/Hal - doing useful things

Daniel P. Berrange dan at berrange.com
Thu Oct 20 12:37:12 UTC 2005


On Thu, Oct 20, 2005 at 12:52:48PM +0100, Huw Lynes wrote:
> If I plug a USB-storage device in Hal picks it up and messages get
> broadcast across Dbus. If I use dbus-monitor --system I can see the
> messages and even pick out the ID of the device.
> 
> What I want to do is run a program when a particular device gets
> attached. I could write a python app (the dbus python bindings don't
> look that hard) and get Gnome to autostart it. Then it can listen to
> Dbus and do it's stuff when it sees the device get attached.
> 
> However this seems like the wrong way to do it. Hal and Dbus are already
> watching for these events. So is there a way to get Hal or Dbus to
> launch a script on a particular event?

Take a look at the files in /usr/share/hal/fdi/policy. The device
mapping rules look as if they have some correspondance to scripts
HAL has in /usr/libexec, suggesting you ought to be able to write
some new rules to run stuff.

Dan.
-- 
|=-            GPG key: http://www.berrange.com/~dan/gpgkey.txt       -=|
|=-       Perl modules: http://search.cpan.org/~danberr/              -=|
|=-           Projects: http://freshmeat.net/~danielpb/               -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20051020/5b41dc00/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list