API to inject (close tray) on a CD-ROM

API to inject (close tray) on a CD-ROM

Post by J Bowe » Mon, 30 Jul 2001 00:44:05

I'm writing an application that controls a number of other
applications.  One of the early steps in my application asks the user
to insert a blank CD-R.  I'm trapping that apple event sucessfully.
After a few minutes of processing, my application starts another app
and it needs the blank CD-R.  Instead of looking in the drive, it
ejects my disc and asks the user to insert a blank.

My question is, can I send the CD driver an "inject" (opposite of
eject or close tray) command, and how would I do this?  Or if nobody
has experience with this, where should I look to research this?  I've
been looking at the Device Manager and the Technote TN DV22 on CD
calls, but nothing addresses this function specifically.

I know it's possible to close the tray, since the MacOS does it at
shutdown and startup.



API to inject (close tray) on a CD-ROM

Post by Brendan Ha » Mon, 30 Jul 2001 09:00:39

[ Note: followups set to c.s.m.help ]

>My question is, can I send the CD driver an "inject" (opposite of
>eject or close tray) command, and how would I do this?

I think there's a standard SCSI operation for this -- CDs are not my thing,
so I don't have the appropriate documents on hand, but I've looked through
most of the SCSI-2 and 3 stuff at one time or another and I think the basic
eject/inject concept is pretty well-supported.  Given that you've checked
out the driver docs and they offer nothing approriate, you'll have to get
down a bit lower and deal with things at this level.

Plenty of CD devices today are not SCSI, of course -- we've got ATAPI,
FireWire, even USB -- but the SCSI model and command set is pretty widely
emulated, and ATA and FW devices offer quite similar low-level interfaces
(USB I know nothing about, though).  Performing a simple, synchronous
operation like eject/inject is easy, although if you check out, for
example, the SCSI Manager docs it might seem a little hairy -- there's a
huge amount of detail and optional material that isn't really relevant to
something as basic as an inject command.  I'd recommend going to the online
docs and surveying the stuff for SCSI Manager (4.3, the contemporary
model), then ATA Manager, then FireWire -- you'll get a feel for the basic
pattern.  Then start searching out command set information for the devices
you're interested in.


1. need help installing cw10 tools cd from apple 8x cd-rom drive

i bought performa 6400 and want to learn programing, so i got cw but tools
cd does not install from 8x drive. metrowerks says it is apple's fault,
and you can imagine what apple says to that. does anyone have any creative
i want to install enough so that i can do lab projects in the introductory
programming texts.
btw, mw recommends fwb cd-rom toolkit but i cant justify spending another
$60, so i can install a program, i suppose, i could buy a 4x drive, then
return it, but that seems dumb, well, i think the whole thing is stupid,
certainly puts a damper on my enthusiasm about my new shiny mac and cool
things it can do:(

2. SCSI CD Reader (burning)

3. New Macintosh CD-ROM Periodical

4. RFQ

5. FAILURE: CW10 & 8x CD-ROM ???

6. native XML database

7. Autorun on Codewarrior CD-ROM

8. Sun Software Liquadation

9. Inside Mac CD-ROM

10. CD-ROM Media Info?

11. Do I need a CD-ROM drive to run CW 7 (vs. install)