mounted cd and tray locking

Andriy Gapon avg at
Wed Dec 12 10:18:15 PST 2007

on 12/12/2007 18:58 Andriy Gapon said the following:
> on 12/12/2007 15:55 Nikos Vassiliadis said the following:
>> On Wednesday 12 December 2007 13:13:48 Andriy Gapon wrote:
>>> I recently noticed that FreeBSD doesn't prevent tray opening (via a
>>> button on CD/DVD drive) even if I mount a CD with ISO 9660 filesystem on
>>> it. This at least happens with ATAPI CD drive (acd driver/device).
>>> Maybe my memory is failing me but I seem to remember times when mounting
>>> a CD locked a tray. Shouldn't this be a more reasonable behavior ?
>> Yes, could file a PR?
>> I see the mentioned behavior for my recent 6-STABLE.
> Hmm. Looked at the code and it should be as expected. Played with
> various stuff and here's what I think: it seems that having atapicam and
> hald and maybe something in KDE that polls for CD change is to blame.
> My theory: after I mount some media on acd0, hald wants to "taste" it
> through cd0, on opening cd0 device 'prevent' command is sent, on closing
> cd0 'allow' is sent, so in the end drive's tray is in unlocked state.
> I don't see any easy resolution for this, but it definitely would be
> good to come up with one.

Investigated more and it seems that hald is a main culprit here. Without
it everything works reasonably well as long as I don't mix acd and cd
That is, if I mount through acd, then trough cd, then unmount the cd
mount, then tray gets unlocked. In a perfect world I would like to fix
even this, but in real world this is OK.
But if mount only through one device then tray is locked.

So, hald is doing something "wrong" here. I am not sure if it is by
design (to make the behavior mswindows-like) or if it is a bug or a
side-effect of something.

Andriy Gapon

More information about the freebsd-questions mailing list