Unmounting and 'eject' press

David Zeuthen david at fubar.dk
Sun May 30 13:51:24 PDT 2004


On Sun, 2004-05-30 at 21:53, Ikke wrote:
> Hija,
>  

Hi,

> I've written an automount daemon using HAL, inspired by GVM. Some
> people tried it, but one guy said he doesnt like it because it does
> not unmount and ejects when het presses the eject key of his cdrom
> reader, something which super/submount can do apareantly (I dont know,
> never used them myself). Some other guys tough told me it *does*
> umount and eject, as well as GVM does. This troubles me a lot.
> I didn't write any unmounting code myself, can't find any in GVM
> either, so I tought maybe it's HAL related. Searched the sources,
> nothing found there either.
>  
> So my question is: is it possible my daemon or gvm do unmount? When I
> asked those guys (where it worked) to stop hald, my daemon and/or gvm,
> the umounting did not work anymore.
>  
> If this is not true (which I think it is), is it possible to achieve
> this, using HAL only? I mean, getting a DBUS/Hal message when the user
> presses the eject button of his cdrom player? Or to implement this
> behaviour in some other way? I came up with some possibilities, but
> they're not too good I think. Unless I get into kernelspace, which is
> something I want to avoid at all cost. My daemon should just be a
> userland replacement for (kernelspace) super/submount...

It is correct that when using g-v-m and HAL, the disc isn't ejected when
the user presses the eject button, sorry.

As you point out it would indeed be nice if HAL could intercept the fact
that the user pressed the eject button and relay this to e.g. gnome-vfs
through a HAL DeviceCondition on the HalDevice representing the disc.
The right thing in GNOME would be for gnome-vfs to catch this and emit a
preunmount signal (it can do this today AFAIK), applications would close
their files and acknowledge, and finally gnome-vfs would issue the
umount(1), eject(1) and the right thing would happen. Oh, layers upon
layers, but that is the way it is :-)

But I haven't found a way to get HAL to detect that the eject button is
pressed. I'm not sure it's even possible to poll for this. Of course the
right thing would be to have the kernel events layer Robert have been
talking about to broadcast this on the system message bus. Does anyone
know if it's possible today? Kernel people?

Cheers,
David



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



More information about the Hal mailing list