Unmounting and 'eject' press

David Zeuthen david at fubar.dk
Mon May 31 02:41:18 PDT 2004

On Mon, 2004-05-31 at 05:29, Pat Suwalski wrote:
> David Zeuthen wrote:
> > 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?
> The automounter we use in Xandros seems to 'cheat' a little, with a more 
> or less virtual mount. It's almost as though it mounts on demand, polls 
> if the drive is in use, and if it's not, unmounts it. That's how correct 
> eject button behaviour seems to be achieved.

Oh, you mean like using software like this


Yeah, it's probably more reliable than assuming the drive is MMC-2
compliant and I suppose this would also work on hotpluggable stuff like
USB drives and it would once and for all solve the 'user yanks out
device' problem (well, unless the drive is active, but then it's her own

Supposedly HAL could use stuff like this in a seamless manner. After
all, the only thing components like g-v-m does is a mount(1) on the
device file and this changes the /etc/mtab; HAL intercepts this and
reads the mount point and today we just put it in volume.mount_point.

So what we would have to change is minimal (though I bet it's a lot of
work); we would just start a new or poke the existing volumagic
userspace NFS server, put the volumagic mount point in
volume.mount_point and be done. And for bonus maintain a property
volume.safe_to_remove to hint the desktop that the media is safe to
eject. Then a fading red icon or something could hover over the disk
icon when it's not safe to eject.

But all this does feel like cheating, yeah, don't pass the start line,
don't collect $200. It seems Alan Cox likes the idea though


I'm curious what other people/vendors think though. Maybe I'm just
rambling :-)


hal mailing list
hal at freedesktop.org

More information about the Hal mailing list