Hal and Mono

Aaron Bockover abockover at novell.com
Mon Jun 19 07:28:18 PDT 2006


I wrote a "new" hal-sharp last year and am using it in Banshee. It's
currently in Mono subversion [1], and is fully usable. I had talked with
David about moving it to HAL/FDO CVS in March, but ended up getting
swamped with work. I'd like to bring this back up soon.

>From a Mono/binding perspective, I vote for P/Invoke into libhal vs.
DBus for two main reasons:

a) dbus-sharp is unmaintained and desperately needs a rewrite/redesign,
and at the very least, a dedicated maintainer

b) libhal is going to be faster; the overhead of DBus and dbus-sharp
(System.Runtime.Emit/dynamic IL and reflection) is also fairly large for
something like HAL

Cheers,
Aaron

[1] http://svn.myrealbox.com/viewcvs/trunk/hal-sharp/


On Mon, 2006-06-19 at 15:46 +0200, Nil Gradisnik wrote:
> I'm interested in using Hal with my Mono code i.e. C#
> 
> My main interest is to extract information about computer hardware, I
> can see a lot of information in hal-device-manager, so I want to
> access this info from my C# code.
> 
> I belive I can "comunicate" with Hal using DBus(dbus-sharp). I found
> some info in mono/REDME and mono/example/ files found in DBus souce
> package. I don't quite understand how to use it with Hal.
> 
> This is what I have so far:
> 
> [CODE]
> using DBus;
> ...
> Connection connection = Bus.GetSessionBus();
> Service service = new Service(connection, "org.feedesktop.Hal");
> 
> service.GetObject(???, "/org/freedesktop/Hal/Manager");
> ...
> [/CODE]
> 
> It's not much as you can see. I don't know what to use as System.Type
> there. I was looking at the python example found on redhat site:
> http://www.redhat.com/magazine/003jan05/features/hal/#notifdesktop
> But I didn't managed to translate it to my C# project.
> 
> I searched Google a lot about this, I just want to see some example
> code or something. Searching through Banshee,Beagle,... code is really
> hard.
> 
> So how would I get a simple information like harddisk model name or
> capacity from Hal using C# code ? I just need some pointers on this
> please.
> 
> Thanks
> _______________________________________________
> hal mailing list
> hal at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/hal



More information about the hal mailing list