See the following files:
/usr/src/linux/include/linux/cdrom.h /usr/src/linux/drivers/cdrom/cdrom.c [revision history section] /usr/src/linux/Documentation/cdrom/cdrom-standard.tex
Some of the following ioctls are described in cdrom-standard.tex :
CDROMCLOSETRAY CDROM_SET_OPTIONS CDROM_CLEAR_OPTIONS CDROM_SELECT_SPEED CDROM_SELECT_DISC CDROM_MEDIA_CHANGED CDROM_DRIVE_STATUS CDROM_CHANGER_NSLOTS CDROM_LOCKDOOR CDROM_DEBUG CDROM_GET_CAPABILITY DVD_READ_STRUCT DVD_WRITE_STRUCT DVD_AUTH CDROM_SEND_PACKET CDROM_NEXT_WRITABLE CDROM_LAST_WRITTEN
The O_NONBLOCK flag on the open() of scd devices is important. Without it the open() will wait until there is media in the device before returning.
open() O_NONBLOCK close() read() write() ioctl()