Search
lxdream.org :: lxdream/src/drivers/cd_linux.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/cd_linux.c
changeset 644:ccae4bfa5f82
prev561:533f6b478071
next678:35eb00945316
author nkeynes
date Sun Mar 02 11:38:08 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Bug #59: Add provisional support for all CD read modes (not validated)
file annotate diff log raw
1.1 --- a/src/drivers/cd_linux.c Tue Jan 01 05:08:38 2008 +0000
1.2 +++ b/src/drivers/cd_linux.c Sun Mar 02 11:38:08 2008 +0000
1.3 @@ -127,7 +127,6 @@
1.4 }
1.5 disc->read_sector = linux_read_sector;
1.6 disc->drive_status = linux_drive_status;
1.7 - ((gdrom_image_t)disc)->disc_type = IDE_DISC_CDROM;
1.8 return disc;
1.9 }
1.10
1.11 @@ -167,7 +166,7 @@
1.12 int last_track = -1;
1.13 int leadout = -1;
1.14 int len = (buf[0] << 8) | buf[1];
1.15 - int session_type = GDROM_MODE1;
1.16 + int session_type = -1;
1.17 int i;
1.18 for( i = 4; i<len; i+=11 ) {
1.19 int session = buf[i];
1.20 @@ -195,10 +194,12 @@
1.21 } else switch( (adr << 8) | point ) {
1.22 case 0x1A0: /* session info */
1.23 if( buf[i+9] == 0x20 ) {
1.24 - session_type = GDROM_MODE2;
1.25 + session_type = IDE_DISC_CDROMXA;
1.26 } else {
1.27 - session_type = GDROM_MODE1;
1.28 + session_type = IDE_DISC_CDROM;
1.29 }
1.30 + disc->disc_type = session_type;
1.31 + break;
1.32 case 0x1A2: /* leadout */
1.33 leadout = MSFTOLBA(buf[i+8], buf[i+9], buf[i+10]);
1.34 break;
1.35 @@ -256,7 +257,20 @@
1.36 cmd[6] = 0;
1.37 cmd[7] = 0;
1.38 cmd[8] = 1;
1.39 - cmd[9] = 0x10;
1.40 +
1.41 + if( READ_CD_RAW(mode) ) {
1.42 + cmd[9] = 0xF0;
1.43 + } else {
1.44 + if( READ_CD_HEADER(mode) ) {
1.45 + cmd[9] = 0xA0;
1.46 + }
1.47 + if( READ_CD_SUBHEAD(mode) ) {
1.48 + cmd[9] |= 0x40;
1.49 + }
1.50 + if( READ_CD_DATA(mode) ) {
1.51 + cmd[9] |= 0x10;
1.52 + }
1.53 + }
1.54
1.55 gdrom_error_t status = linux_send_command( fd, cmd, buf, &sector_size, CGC_DATA_READ );
1.56 if( status != 0 ) {
1.57 @@ -285,7 +299,7 @@
1.58 cgc.sense = &sense;
1.59 cgc.data_direction = direction;
1.60
1.61 - if( ioctl(fd, CDROM_SEND_PACKET, &cgc) == -1 ) {
1.62 + if( ioctl(fd, CDROM_SEND_PACKET, &cgc) < 0 ) {
1.63 if( sense.sense_key == 0 ) {
1.64 return -1;
1.65 } else {
.