Re: Notification to user-space upon CD eject button being pressed?

Brian Rogers (brogers@why.net)
Tue, 24 Mar 1998 23:27:57 -0600 (CST)


On Tue, 24 Mar 1998, James Mastros wrote:

> On Wed, 25 Mar 1998, David Woodhouse wrote:
> > Is it possible for a user-space program to receive notification when the eject
> > button is pressed on a CD drive?
> >
> > It would be useful for automountd to automatically unmount and eject CDs when
> > the eject button is pressed.
> With IDE CDs, anyway, it isn't possible for us to do this -- the drive
> doesn't tell us. We can have the drive be locked or unlocked, but in
> unlocked position, it ejects before telling us anything, and in locked
> position, it doesn't tell us when the button is pressed.

Maybe the kernel could lock the drive whenever any inodes are in use, but
unlock it as soon as none are in use anymore. Then it wouldn't matter
that IDE CD-ROM drives only notify you after the disk has been ejected,
because you'll be able to cleanly unmount the filesystem regardless.

Of course, in the case of Zip disks (or any other read-write media),
this could get really messy if they don't notify before ejection and give
the kernel the ability to unmount then eject for real. With read-write
media, maybe the CD-ROM idea would have to be expanded to include the
possibility that there are writes pending. Then it might work.

/* Brian Rogers, professional geek, coffee achiever */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu