What is the best way to detect if CD-ROM is ejected?

Hi,

Currently I check if CD-ROM is ejected by checking if I can access the
files on that CD-ROM. This works fine when the CD-ROM is inside the drive.
But it seems that devb-eide driver spends significantly long time in
detecting the CD-ROM after it is ejected, while the LED just keeps flashing.
Sometimes, although very rarely, takes forever.

I am thinking if there is a better way to detect the CD-ROM? Do I have to
mount it?

Any help is appreciated.

Xuedong

This is just a guess, but it might be the case that in order
to see if it can access a disk, the driver first accesses
the drive, and if it fails it must request that the drive
spin the disk up and then a macroscopic amount of time later
check again. This takes a while because the drive itself
doesn’t know if there is a disk in the drive until it spins
up and reads. That is there is no “disk inserted” sensor.
In the case where the drive is open it would be nice if
you could tell immediately, but again there may be no,
“door open” sensor.

So what I’m saying is that you may be sol.


Previously, Xuedong Chen wrote in qdn.public.qnxrtp.os:

Hi,

Currently I check if CD-ROM is ejected by checking if I can access the
files on that CD-ROM. This works fine when the CD-ROM is inside the drive.
But it seems that devb-eide driver spends significantly long time in
detecting the CD-ROM after it is ejected, while the LED just keeps flashing.
Sometimes, although very rarely, takes forever.

I am thinking if there is a better way to detect the CD-ROM? Do I have to
mount it?

Any help is appreciated.

Xuedong
\


Mitchell Schoenbrun --------- maschoen@pobox.com