1.1 --- a/src/gdrom/linux.c Wed Jan 31 10:58:42 2007 +0000
1.2 +++ b/src/gdrom/linux.c Wed Sep 19 12:09:33 2007 +0000
1.5 - * $Id: linux.c,v 1.3 2007-01-31 10:58:42 nkeynes Exp $
1.6 + * $Id: linux.c,v 1.4 2007-02-11 10:11:05 nkeynes Exp $
1.8 * Linux cd-rom device driver.
1.11 int mode, char *buf, uint32_t *length );
1.12 static gdrom_error_t linux_send_command( int fd, char *cmd, char *buffer, size_t *buflen,
1.15 +static int linux_drive_status( gdrom_disc_t disc );
1.17 struct gdrom_image_class linux_device_class = { "Linux", NULL,
1.18 linux_image_is_valid, linux_open_device };
1.19 @@ -101,10 +101,25 @@
1.22 disc->read_sector = linux_read_sector;
1.23 + disc->drive_status = linux_drive_status;
1.24 ((gdrom_image_t)disc)->disc_type = IDE_DISC_CDROM;
1.28 +static int linux_drive_status( gdrom_disc_t disc )
1.30 + int fd = fileno(((gdrom_image_t)disc)->file);
1.31 + int status = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
1.32 + if( status == CDS_DISC_OK ) {
1.33 + status = ioctl(fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT);
1.34 + if( status != 0 ) {
1.35 + linux_read_disc_toc(disc);
1.37 + return ((gdrom_image_t)disc)->disc_type | IDE_DISC_READY;
1.39 + return IDE_DISC_NONE;
1.43 * Read the full table of contents into the disc from the device.