Locking or not locking (CD drives)?
David Zeuthen
david at fubar.dk
Wed May 31 11:26:39 PDT 2006
On Wed, 2006-05-31 at 10:33 -0700, Artem Kachitchkine wrote:
> David,
>
> > The meaning of "locking" a drive is to prevent other apps from using
>
> In my reading of the question, they meant SCSI door locking aka PREVENT
> ALLOW MEDIUM REMOVAL command.
Oh, that's probably a more accurate reading of the question, sorry, I
didn't have my coffee until late today :-).
We could provide API to lock/unlock the door on drives that support it,
that would be fine with me. The interface should probably be named
o.fd.Hal.Device.LockableDrive in this case and we'd provide methods
LockDoor() and UnlockDoor() and IsDoorLocked(). Or something like that.
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.
The request "I would like totem to lock the cd drive so i can only open
it when i press the stop button. [...] its consistent, when you mount a
data cd you have to unmount it before you can eject it to prevent
applications that run on or from the cd from crashing" (as stated in
GNOME #339754) is totally bogus. Most, or some at least, drives today
actually does report when the eject button is pushed and g-v-m does
handle this just fine. And if apps are crashing we should fix this
instead of papering around this issue with this non sense.
So even if Totem indeed does a LockDoor() (using this new and yet
non-existing API) then g-v-m will catch the EjectPressed signal and
invoke Eject() on HAL which will eventually eject the disc. Of course,
here Totem can use the Lock() method on org.fd.Hal.Device to hint to
g-v-m that it shouldn't do Eject() on EjectPressed. Then Totem would
catch EjectPressed itself and shut down it's pipeline and then do the
Eject() itself when it feels like it. But I'd much rather see Totem
gracefully handle when the media goes away, even if I am to use eject(1)
from the commandline. Bastien, is that how it works today?
David
More information about the hal
mailing list