From b0a4b7c15c2bc8633cc97e59efc1541b27a80238 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 31 Jul 2011 08:03:51 +0000 Subject: [PATCH] Bug fix: Some drives returned wrong CD sizes after having burnt DVD-R --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 30 ++++++++++++++++++++++++++++++ libburn/drive.h | 4 ++++ libburn/mmc.c | 2 ++ libburn/spc.c | 1 + libburn/transport.h | 4 ++++ 6 files changed, 42 insertions(+), 1 deletion(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index ee0e99c..589706d 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2011.07.28.191536" +#define Cdrskin_timestamP "2011.07.31.080152" diff --git a/libburn/drive.c b/libburn/drive.c index 4373148..6532e43 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -318,6 +318,34 @@ int burn_drive_inquire_media(struct burn_drive *d) 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) { @@ -381,6 +409,8 @@ int burn_drive_grab(struct burn_drive *d, int le) d->silent_on_scsi_error = 1; /* ts A61125 : outsourced media state inquiry aspects */ ret = burn_drive_inquire_media(d); + + burn_drive_send_default_page_05(d, 0); d->silent_on_scsi_error = sose; d->busy = BURN_DRIVE_IDLE; return ret; diff --git a/libburn/drive.h b/libburn/drive.h index 2f2646d..e443702 100644 --- a/libburn/drive.h +++ b/libburn/drive.h @@ -151,4 +151,8 @@ int burn_abort_5(int patience, int (*pacifier_func)(void *handle, int patience, int elapsed), 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 */ diff --git a/libburn/mmc.c b/libburn/mmc.c index c851bae..042c6b7 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -1759,6 +1759,8 @@ static int mmc_read_disc_info_al(struct burn_drive *d, int *alloc_len) d->erasable = 0; d->last_track_no = 1; + /* ts B10730 */ + d->sent_default_page_05 = 0; /* ts A70212 - A70215 */ d->media_capacity_remaining = 0; d->media_lba_limit = 0; diff --git a/libburn/spc.c b/libburn/spc.c index 310837d..23bae11 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -678,6 +678,7 @@ void spc_sense_write_params(struct burn_drive *d) d->read_format_capacities(d, -1); else if (d->status == BURN_DISC_BLANK || (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); } /* others are hopefully up to date from mmc_read_disc_info() */ diff --git a/libburn/transport.h b/libburn/transport.h index b83b5c1..cfe8b9c 100644 --- a/libburn/transport.h +++ b/libburn/transport.h @@ -279,6 +279,10 @@ struct burn_drive /* ts A70129 : from 51h READ DISC INFORMATION Last Track Number in Last Session */ 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) With CD this might change after particular write parameters have been set and nwa has been inquired.