CDopen(3dm) CDopen(3dm)
CDopen - opens a CD-ROM drive for audio use
#include <sys/types.h>
#include <dmedia/cdaudio.h>
CDPLAYER* CDopen(char* dev, char* direction)
dev The name of the devscsi file associated with the CD-ROM
device. E.g. /dev/scsi/sc0d4l0. If dev is NULL, then
CDopen(3dm) will consult the hardware inventory table to
locate a CD-ROM drive.
direction A pointer to one of "r", "w", or "rw" indicating the
direction of the I/O desired.
Upon successful completion, CDopen(3dm) returns a pointer to a CDPLAYER,
an opaque type defined in cdaudio.h. Otherwise a value of null (0) is
returned and errno is set to indicate the error.
CDopen(3dm) opens the devscsi device associated with the CD-ROM and
determines if the device is a recognized type of CD-ROM drive.
Recognized devices are Sony and Toshiba. If it is successful it allocates
and initializes a CDPLAYER structure for the device and returns a pointer
to it. You use this structure in all function calls that access the CDROM.
The device is opened for reading, writing, or reading and writing
according to the direction argument. Currently only reading is
supported. This argument provides a path forward toward writable CD's.
CDopen(3dm) also attempts to select the CD-ROM mode that enables transfer
of audio data from audio CD's across the SCSI bus. Only the Toshiba CDROM
supports this feature. The scsi_audio flag is set in the CDSTATUS
structure [see CDgetstatus(3dm)] to indicate whether the mode was
successfully selected. The opened CD-ROM can be used as a player
regardless of the success or failure of this operation.
CDopen(3dm) will fail and no CDPLAYER structure will be created if one or
more of the following are true:
[ENODEV] No CD-ROM device could be found.
[ENODEV] The device didn't respond to an inquiry request.
[ENODEV] The CD-ROM was of an unrecognized type.
Page 1
CDopen(3dm) CDopen(3dm)
[ENOMEM] The malloc(3) call to acquire memory for the CDPLAYER
structure failed.
[EBUSY] The CD-ROM device was busy.
CDintro(3dm), CDclose(3dm), CDgetstatus(3dm), CDgettrackinfo(3dm),
CDeject(3dm), CDreadda(3dm), CDseek(3dm), CDstop(3dm),
CDtogglepause(3dm), CDallowremoval(3dm), CDpreventremoval(3dm),
CDseek(3dm), CDseektrack(3dm), CDseekblock(3dm), CDplay(3dm),
CDplayabs(3dm), CDplaytrack(3dm), CDplaytrackabs(3dm),
Roger Chickering, Mark Callow
PPPPaaaaggggeeee 2222 [ Back ]
|