Bug fix: Some drives returned wrong CD sizes after having burnt DVD-R

This commit is contained in:
Thomas Schmitt 2011-07-31 08:03:51 +00:00
parent ecc8bbc71f
commit b0a4b7c15c
6 changed files with 42 additions and 1 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.07.28.191536" #define Cdrskin_timestamP "2011.07.31.080152"

View File

@ -318,6 +318,34 @@ int burn_drive_inquire_media(struct burn_drive *d)
return 1; return 1;
} }
/* ts B10730 */
/* Send a default mode page 05 to CD and DVD-R-oids */
int burn_drive_send_default_page_05(struct burn_drive *d, int flag)
{
struct burn_write_opts *opts;
if (d->sent_default_page_05)
return 0;
if (!((d->status == BURN_DISC_APPENDABLE ||
d->status == BURN_DISC_BLANK) &&
(d->current_is_cd_profile || d->current_profile == 0x11 ||
d->current_profile == 0x14 || d->current_profile == 0x15)))
return 0;
opts = burn_write_opts_new(d);
if (opts == NULL)
return -1;
if (d->status == BURN_DISC_APPENDABLE)
burn_write_opts_set_write_type(opts,
BURN_WRITE_TAO, BURN_BLOCK_MODE1);
else
burn_write_opts_set_write_type(opts,
BURN_WRITE_SAO, BURN_BLOCK_SAO);
d->send_write_parameters(d, opts);
burn_write_opts_free(opts);
d->sent_default_page_05 = 1;
return 1;
}
int burn_drive_grab(struct burn_drive *d, int le) int burn_drive_grab(struct burn_drive *d, int le)
{ {
@ -381,6 +409,8 @@ int burn_drive_grab(struct burn_drive *d, int le)
d->silent_on_scsi_error = 1; d->silent_on_scsi_error = 1;
/* ts A61125 : outsourced media state inquiry aspects */ /* ts A61125 : outsourced media state inquiry aspects */
ret = burn_drive_inquire_media(d); ret = burn_drive_inquire_media(d);
burn_drive_send_default_page_05(d, 0);
d->silent_on_scsi_error = sose; d->silent_on_scsi_error = sose;
d->busy = BURN_DRIVE_IDLE; d->busy = BURN_DRIVE_IDLE;
return ret; return ret;

View File

@ -151,4 +151,8 @@ int burn_abort_5(int patience,
int (*pacifier_func)(void *handle, int patience, int elapsed), int (*pacifier_func)(void *handle, int patience, int elapsed),
void *handle, int elapsed, int flag); void *handle, int elapsed, int flag);
/* ts B10730 */
/* Send a default mode page 05 to CD and DVD-R-oids */
int burn_drive_send_default_page_05(struct burn_drive *d, int flag);
#endif /* __DRIVE */ #endif /* __DRIVE */

View File

@ -1759,6 +1759,8 @@ static int mmc_read_disc_info_al(struct burn_drive *d, int *alloc_len)
d->erasable = 0; d->erasable = 0;
d->last_track_no = 1; d->last_track_no = 1;
/* ts B10730 */
d->sent_default_page_05 = 0;
/* ts A70212 - A70215 */ /* ts A70212 - A70215 */
d->media_capacity_remaining = 0; d->media_capacity_remaining = 0;
d->media_lba_limit = 0; d->media_lba_limit = 0;

View File

@ -678,6 +678,7 @@ void spc_sense_write_params(struct burn_drive *d)
d->read_format_capacities(d, -1); d->read_format_capacities(d, -1);
else if (d->status == BURN_DISC_BLANK || else if (d->status == BURN_DISC_BLANK ||
(d->current_is_cd_profile && d->status == BURN_DISC_APPENDABLE)) { (d->current_is_cd_profile && d->status == BURN_DISC_APPENDABLE)) {
burn_drive_send_default_page_05(d, 0);
d->get_nwa(d, -1, &dummy, &dummy); d->get_nwa(d, -1, &dummy, &dummy);
} }
/* others are hopefully up to date from mmc_read_disc_info() */ /* others are hopefully up to date from mmc_read_disc_info() */

View File

@ -279,6 +279,10 @@ struct burn_drive
/* ts A70129 : /* ts A70129 :
from 51h READ DISC INFORMATION Last Track Number in Last Session */ from 51h READ DISC INFORMATION Last Track Number in Last Session */
int last_track_no; int last_track_no;
/* ts B10730 : whether a default mode page 05 was already sent.
*/
int sent_default_page_05;
/* ts A70212 : from various sources : free space on media (in bytes) /* ts A70212 : from various sources : free space on media (in bytes)
With CD this might change after particular write With CD this might change after particular write
parameters have been set and nwa has been inquired. parameters have been set and nwa has been inquired.