Re: ejecting CD in a program....
On Sat, Jun 10, 2006 at 10:02:17AM +0200, Philippe De Ryck wrote:
> On Fri, 2006-06-09 at 23:17 +0100, Digby Tarvin wrote:
> > Anyone know the reason for this mysterious behaviour?:
> > I am writing a little application which has to wait for a CD to be
> > loaded into the drive, obtain some data from the CD, and then eject
> > it ready for the next one....
> > What I have found is that if there is initially no CD in the drive,
> > the program waits successfully, but fails to eject. If there is an
> > initial CD in the drive it does not need to wait, and the eject
> > succeeds..
> > With a little trial and error, I have found that closing and re-opening
> > the device before the eject can solve the problem, but ONLY with a
> > sleep between close and open.
> > If I leave the device open, then no amount of sleeping before the
> > eject will help...
> > ...
> No solution here, but maybe you could check out the source of the
> command "eject"? This works pretty good, so maybe you find some clues in
Thanks for the suggestion, but the subset of things that eject does also
seem to work fine in my code, so I don't think it will shed any light on
what is happening.
To reproduce the conditions that cause the problem I am seeing, eject
would need to have a mode where it could be told to wait for a CD to
be inserted into a currently empty drive, and then eject it.
Digby R. S. Tarvin digbyt(at)digbyt.com