Writing a HAL/DBUS Python program

Ikke eikke at eikke.com
Wed Jan 12 04:21:29 PST 2005


On Wed, 2005-01-12 at 04:13 -0800, Jono Bacon wrote:
> Hi all,
> 
> I am fairly new to Python and I have recently got my
> head around writing GNOME applications with Glade.
> Anyway, I am interested in writing a program to detect
> when a USB stick is plugged in, and to then copy a
> file to the USB stick. This obviously needs some
> HAL/DBUS sprinking into my Python program.
I guess you could do this by extending GVM, or using some callout in
ivman ;-)
> 
> I have hunted around the interweb for documentation
> about this and found relatively little. I am not sure
> where I need to start. Can any of you help with these
> questions:
> 
>  - Firstly, in terms of detecting if the device has
> been plugged in, is this a HAL or DBUS thing?
I guess HAL is most suited for the task: after all it's HAL that creates
the messages on the DBUS system bus.
> 
>  - What kind of code would I need to write to detect
> if a USB device has been plugged in?
You can use libhal (I dont know if there are python bindings for this?),
or listen on the DBUS system bus directly.
> 
> I am more than happy to write some tutorials on how to
> do this if you chaps can help me out with getting
> started.
I don't know about HAL<->python, but if you'd listen directly on the
DBUS system bus, check out Ross' IBM article [1], there's some Python
code in there, and the Python samples in the DBUS sources.
> 
> Many thanks. :)
> 
>   Jono

Greetings,
Ikke						http://www.eikke.com

[1] http://www-106.ibm.com/developerworks/linux/library/l-dbus.html

_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list