Locking or not locking (CD drives)?

David Zeuthen david at fubar.dk
Wed May 31 11:58:50 PDT 2006


On Wed, 2006-05-31 at 11:44 -0700, Artem Kachitchkine wrote:
> > Btw, I'm not sure it's desirable for Totem to lock the door. After all
> > we try to give the experience that the can press the "eject" button on
> > the drive to eject the disc by emitting the EjectPressed signal and then
> > eventually end up having g-v-m calling gnome-eject that does Eject() on
> > HAL that eventually ends up with an eject(1) on Linux. 
> 
> Well, I think if you don't lock the door, then pressing the eject button 
> (on the drive) will immediately eject the media and software won't have 
> a chance to react: by the time EjectPressed handlers are invoked, the 
> drive will already report media as ejected (even though mechanically it 
> might take a couple of seconds).
> 
> If you do lock the door, but also subscribe to EjectPressed, then 
> nothing will happen when the eject button (on the drive) is pressed, but 
> the software gets notified on the user's intention, it can react 
> accordingly, i.e. release the resources (unmount, etc) and send the 
> eject command to the drive.

But, at least on Linux, the door is already locked when media is mounted
and we get to handle EjectPressed if the drive supports it. If it
doesn't the user get's to unmount/eject the media via the command line
or some UI gizmo. 

Of course all this is not true for Audio CD's (and some DVD playback
software) which I believe the inquiry was about.

(Also, you can configure the Linux kernel to not lock the door when
mounting things but few distributions do so out of the box.)

> The disadvantage of the latter approach is that not all drives support 
> EjectPressed. We need some data here, is it only the older drives that 
> don't have support? does the situation improve over time? If two years 
> from now all drives will support EjectPressed, we can start relying on it.

I don't think we can rely on it at all; for example Apple laptops don't
have an eject key at all. What they do have is a special key on the
keyboard with an eject symbol and everything is thus handled in software
just as if the EjectPressed signal was emitted. 

So we need fallbacks either way. 

In the Totem example, Totem would unlock the door as soon as you pause
or stop playback of e.g. an Audio CD. Also, Eject() on HAL specifically
and eject(1) in general would blatantly ignore if the door is locked or
not so you'd always be in a position to eject the disc from your file
manager.

    David




More information about the hal mailing list