CDopen(3dm)CDopen(3dm)NAMECDopen - opens a CD-ROM drive for audio use
SYNOPSIS
#include <sys/types.h>
#include <dmedia/cdaudio.h>
CDPLAYER* CDopen(char* dev, char* direction)
PARAMETER
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.
RETURNED VALUE
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.
DESCRIPTIONCDopen(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 CD-
ROM.
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 CD-
ROM 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.
SEE ALSOCDintro(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),
AUTHOR
Roger Chickering, Mark Callow
Page 2