HAL and CD monitoring

Bastien Nocera hadess at hadess.net
Tue Dec 9 19:57:35 EET 2003

Heya David,

On Tue, 2003-12-09 at 17:38, David Zeuthen wrote:
> On Tue, 2003-12-09 at 17:49, Bastien Nocera wrote:
> > Hello David, and all,
> > 
> > As Owen was overly busy already, and I was hacking a tidbit on magicdev,
> > I'm now the new maintainer for it.
> > 
> > And I was looking at the current monitoring code in HAL, and it looks
> > very much like the functionality it implements is something that I was
> > looking into for the future of magicdev (see my dead "magicplug" code,
> > and things like that ;)
> > 
> > 2 questions:
> > - Are there any plans to implement the monitoring code for 2.4 kernels?
> Hi,
> It's certainly *possible* to support 2.4 as one of the ideas of HAL is
> to be able to support many operating systems and indeed 2.4 was the
> first target. 
> However, I quickly got turned off by the difficulties in 2.4 in reliably
> obtaining e.g. the /dev/sda1 node for e.g. usb-storage and started using
> 2.6 and udev. Having said that, it should be possible to write 2.4 code
> for HAL as well. It may difficult to do and it may be distro-specific
> though. I'm not sure... 
> My 2.6 code does not appear to be distro-specific at all; I've got good
> feedback from people using other distros than myself (And as soon as I
> got 2.6 working on my Powerbook I will test on debian as well).
> > - Would changes to implement disc-change monitoring be accepted (once
> > written and reviewed) in HAL itself?
> > 
> Disc-change monitoring is clearly something that should just work! 
> I see it closely related to mounting removable storage, e.g. a volume
> manager as Carlos suggested in September on this list.

Hehe, you mean like the patches I made to updfstab (kudzu) and magicdev?

> With the new (almost 100% rewritten) HAL it should be possible to write
> such a volume manager. I actually wrote a small python example for doing
> most of this here
> http://freedesktop.org/cgi-bin/viewcvs.cgi/hal/examples/volumed/volumed.py?rev=1.1&cvsroot=hal&content-type=text/vnd.viewcvs-markup


> It's quite simple, yes? If you look at
> http://freedesktop.org/~david/hal-cdrom.png

We have that for GNOME in "libbacon" (which we wrote with Alex Larsson),
also works for *BSD. It would certainly be good to be using HAL instead
of our own home-brewn stuff.

The code is quite ugly indeed (except the *BSD one).

> you can see that HAL also detects optical and floppy drives; optical
> drives got the capability removableMedia.cdrom; this is all derived from
> /sys and /proc in the 2.6 kernel (there are still issues with handling
> SCSI hardware devices as I've got none, but this can be resolved once
> someone tests this on a system with SCSI hardware).
> So, yeah, it's indeed possible for a volume manager to find these
> devices using HAL and do the disc-change monitoring on them. When a disc
> is detected this volume manager should create and maintain one or more
> (multi-session discs may have several volumes) Volume device objects as
> seen here for usb-storage
> http://freedesktop.org/~david/hal-usb-mounted.png
> Now, desktop file managers can simply just listen for hal device objects
> with the capability volume. 
> (it should be noted that hal can interoperate with existing volume
> managers / automounters since the hal monitor parts looks for changes in
> /etc/mtab).
> > If so, then we might be looking at the future for magicdev in HAL :)
> > 
> Yeah, that would be great! magicdev is also a more catchy name than
> volume manager :-)

Haha, that's because you don't know the reputation that magicdev has ;)

> I must admit that I need to update the hal spec to mention all this and
> make the 0.2 release; I promise to do this real soon now when I've
> shuffled internals around enough. Until then, it's still in CVS.

It would certainly clear up a few things. I like to have tarballs
So I'm very interested in moving magicdev to just be a "I'll mount that
for you" program, eventually adding a few little featurettes from HAL
(ethernet connection/disconnection events are nice as well). I'll be
waiting for your tarball to start and hack.


Bastien Nocera <hadess at hadess.net> 
The little boat gently drifted across the pond exactly the way a bowling
ball wouldn't. 

More information about the xdg mailing list