Re: CD-ROM support question.

Erik Andersen (
Mon, 17 Nov 1997 00:54:39 -0700

On Mon, Nov 17, 1997 at 02:41:04AM -0500, Joe Pranevich wrote:
> Isaac Connor wrote:
> >
> > This seems like it should be simple to do...let's see, when do we need to
> > mount the CD? Only when someone tries to access it...which means we need
> > something to detect when someone takes a look at the mount point...
> >
> > Now, all we need to do is trap when someone presses the eject
> > button...does doing so send any sort of signal? Can it be looked for?
> > If it can, when you press the button, we unmount the CD.. So we need two
> > things:
> >
> > 1. Something to detect a mount point access
> > 2. Something to detect the Eject button press...

The "Something to detect a mount point access" is called autofs, the
kernel based automounter. It does just this, with the help of a user
space daemon.

> Not to express my desire for such a feature (I rather like the current
> setup) but it would be far easier to detect the CD-ROM insertion than it
> would be to monitor the mount point access. Although you would not
> *need* the cdrom to be mounted at all times, it certainly wouldn't harm
> things. And since the 'eject' button can already be blocked when a
> CD-ROM is mounted, I'd assume that you can set up an alternate handler
> for the 'eject' press to unmount (or not, if it's in use) the drive.

The eject button being blocked is done by sending a packet to the
drive telling it not to open. Sorry to disappoint, but there is no
way to set up an alternate handler for this. The hardware has one
hardware flag that tells it to either open or not open when the button
is pushed.

> Of course, this may be all an internal part of the ATAPI driver and not
> available for prodding and poking.

This is indeed the case.

> But someone (?) if I recall has been
> working on updating all the cdrom drivers into a nice, neat set with
> identical features (or at least, interface)... that might be the person
> to consult for this type of addition.

That would be me. My latest set of patches against 2.1.64 can be
found at I am going to need
some help to finish the driver ports to the Uniform CD-ROm driver if I
am going to get this finished in time for 2.2.x.

> I'd just also like to mention that a BSD clone I was using for the Power
> Mac a while back had this. It was called 'mountd' and was run as a
> daemon process. (Obviously) In addition to CD-ROMs, it handled all
> 'ejectable' mediums (which, on the Mac, included all the floppy drives)
> and worked with the fstab (I think) Don't know if it can be handled this
> way in Linux, I'm not an expert in this functionality nor do I have the
> time to check, unfortunately. But, maybe... just maybe, in the long run
> it would be good to have this sort of thing be doable, somehow, for the
> non-UNIX savvy that may grace our humble OS.

Again, check out autofs. You will be pleasently surprised.

> Joe Pranevich, who is up far too late
> > Isaac
> >


Erik B. Andersen   Web: 
--This message was written using 73% post-consumer electrons--