Messages in this thread | | | Date | Sun, 10 Oct 1999 19:41:45 +0200 | From | Jens Axboe <> | Subject | Re: Questions on CDROM support |
| |
On Sat, Oct 09 1999, Anthony Barbachan wrote: > This is what I'd like to do. I'd like to modify the EIDE and/or SCSI > CDROM driver(s) to automatically mount a CD when it is inserted and unmount > and eject it when the eject button is pressed (with possibly a flag to > indicate unmount/eject only if no files are open on the CDROM or to delay > the umount/eject until after all files close on the CDROM). Unfortunately > the current need to mount/unmount the CDROM (floppy to, but I think little > that can be done about that one) is nowhere near user freindly. The > automounter doesn't really seam to suit this purpose for a few reasons. If > some process happens to be in the CD's mount directory or any decending > directories the CD is unejectable due to it being considered to be in use. > The delay before unmounting the CD thus allowing it ejection raises the very > real possibility of some quickly frustrated user(s) starting to rapidly > press the eject button, bang on it, if not worse; people are used to the > CDROM's behavior under DOS/Windows. Besides which I think mounting once on > insertion and unmounting/ejecting when the eject button is pressed is a more > efficient and elegant solution. I don't think mounting a CD, at most > almost, on insertion should be a problem since at a minimum that could be > done by polling though I think polling is ugly. But the eject button may be > a different story. So I basically have two questions mostly related to > SCSI/EIDE CDROMs though knowing about the others would be useful as well:
For far most drives you have to resort to polling, as the drive cannot report event like that asynchronously (spec says that SCSI drives can do this, but I haven't seen any that does). So basically this could be done inside the drive or from a user space utility and inform automount of when to mount the drive. Polling from inside the driver is just not going to happen, for just the reasons you state - ugly.
> Do SCSI or EIDE CDROMs notify the host enviroment in any way that a CD was > inserted or that its status has changed either directly or indirectly?
There are several ways to do it. The newest (as per MMC and Mt Fuji) is to use GET_EVENT_STATUS with either synch or async notification. The former requires polling for events while the latter can inform the driver when a certain event has taken place - not just media events, but things like power management, etc. This ties in with what I wrote above - asynch status _is_ possible, but since no drives implement it...
> Do SCSI or EIDE CDROMs notify the host enviroment in any way that the eject > button has been pressed or that its status has changed either directly or > indirectly? If not, could the pressing of the eject button be monitored > through some sort of polling?
Same as above. Your best choice is probably to poll with CDROM_MEDIA_CHANGED and use that information, although that can't tell you about eject attempts.
-- * Jens Axboe <axboe@image.dk> * Linux CD-ROM Maintainer * http://www.kernel.dk
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |