From d2abe23c2513f958644a7ebe2a280534ec515955 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 28 Dec 2011 15:23:24 +0000 Subject: [PATCH] Improved reaction on failure of SEND CUE SHEET --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/mmc.c | 9 ++++++-- libburn/trunk/libburn/mmc.h | 3 ++- libburn/trunk/libburn/transport.h | 2 +- libburn/trunk/libburn/write.c | 25 +++++++++++++++-------- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 06f6200c..62242d06 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2011.12.28.104536" +#define Cdrskin_timestamP "2011.12.28.152153" diff --git a/libburn/trunk/libburn/mmc.c b/libburn/trunk/libburn/mmc.c index 8beb3b4a..b4550ecd 100644 --- a/libburn/trunk/libburn/mmc.c +++ b/libburn/trunk/libburn/mmc.c @@ -302,7 +302,7 @@ int mmc_start_if_needed(struct burn_drive *d, int flag) } -void mmc_send_cue_sheet(struct burn_drive *d, struct cue_sheet *s) +int mmc_send_cue_sheet(struct burn_drive *d, struct cue_sheet *s) { struct buffer *buf = NULL; struct command *c; @@ -310,7 +310,7 @@ void mmc_send_cue_sheet(struct burn_drive *d, struct cue_sheet *s) c = &(d->casual_command); mmc_start_if_needed(d, 0); if (mmc_function_spy(d, "mmc_send_cue_sheet") <= 0) - return; + return 0; BURN_ALLOC_MEM_VOID(buf, struct buffer, 1); scsi_init_command(c, MMC_SEND_CUE_SHEET, sizeof(MMC_SEND_CUE_SHEET)); c->retry = 1; @@ -325,6 +325,11 @@ void mmc_send_cue_sheet(struct burn_drive *d, struct cue_sheet *s) d->issue_command(d, c); ex:; BURN_FREE_MEM(buf); + if (c->error) { + d->cancel = 1; + scsi_notify_error(d, c, c->sense, 18, 2); + } + return !c->error; } diff --git a/libburn/trunk/libburn/mmc.h b/libburn/trunk/libburn/mmc.h index 4b9c7447..b01cd3ef 100644 --- a/libburn/trunk/libburn/mmc.h +++ b/libburn/trunk/libburn/mmc.h @@ -48,7 +48,8 @@ void mmc_get_configuration(struct burn_drive *); @return 1=nwa is valid , 0=nwa is not valid , -1=error */ int mmc_get_nwa(struct burn_drive *d, int trackno, int *lba, int *nwa); -void mmc_send_cue_sheet(struct burn_drive *, struct cue_sheet *); +/* ts B11228 : changed from void to int */ +int mmc_send_cue_sheet(struct burn_drive *, struct cue_sheet *); /* ts A61023 : get size and free space of drive buffer */ int mmc_read_buffer_capacity(struct burn_drive *d); diff --git a/libburn/trunk/libburn/transport.h b/libburn/trunk/libburn/transport.h index 3c79ea43..af54e7e2 100644 --- a/libburn/trunk/libburn/transport.h +++ b/libburn/trunk/libburn/transport.h @@ -383,7 +383,7 @@ struct burn_drive void (*send_write_parameters) (struct burn_drive *, struct burn_session *, int tno, const struct burn_write_opts *); - void (*send_cue_sheet) (struct burn_drive *, struct cue_sheet *); + int (*send_cue_sheet) (struct burn_drive *, struct cue_sheet *); /* ts A70205 : Announce size of a DVD-R[W] DAO session. */ int (*reserve_track) (struct burn_drive *d, off_t size); diff --git a/libburn/trunk/libburn/write.c b/libburn/trunk/libburn/write.c index c303fc6f..02db517d 100644 --- a/libburn/trunk/libburn/write.c +++ b/libburn/trunk/libburn/write.c @@ -1023,7 +1023,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s, { ret = 0; goto ex; } } else { o->control = t->entry->control; - d->send_write_parameters(d, o); + d->send_write_parameters(d, s, tnum + 1, o); /* ts A61103 */ ret = d->get_nwa(d, -1, &lba, &nwa); @@ -1364,7 +1364,7 @@ int burn_disc_open_track_dvd_minus_r(struct burn_write_opts *o, off_t size; BURN_ALLOC_MEM(msg, char, 160); - d->send_write_parameters(d, o); + d->send_write_parameters(d, NULL, 0, o); ret = d->get_nwa(d, -1, &lba, &nwa); sprintf(msg, "DVD pre-track %2.2d : get_nwa(%d), ret= %d , d->nwa= %d", @@ -2035,7 +2035,7 @@ int burn_disc_setup_dvd_minus_rw(struct burn_write_opts *o, 5.4.14 finally states that profile 0013h includes feature 002Ch rather than 0026h. - d->send_write_parameters(d, o); + d->send_write_parameters(d, NULL, 0, o); */ d->busy = BURN_DRIVE_FORMATTING; @@ -2674,6 +2674,7 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc) struct cue_sheet *sheet; struct burn_drive *d = o->drive; struct buffer *buffer_mem = o->drive->buffer; + struct burn_session *s; struct burn_track *lt, *t; int first = 1, i, ret, lba, nwa = 0, multi_mem; off_t default_size; @@ -2786,7 +2787,11 @@ return crap. so we send the command, then ignore the result. if (o->write_type == BURN_WRITE_TAO) { nwa = 0; /* get_nwa() will be called in burn_track() */ } else { - d->send_write_parameters(d, o); + if (disc->sessions > 0) + s = disc->session[0]; + else + s = NULL; + d->send_write_parameters(d, s, 0, o); ret = d->get_nwa(d, -1, &lba, &nwa); sprintf(msg, @@ -2811,7 +2816,7 @@ return crap. so we send the command, then ignore the result. /* ts A61009 */ if (sheet == NULL) - goto fail; + goto fail_wo_sync; #ifdef Libburn_write_with_function_print_cuE print_cue(sheet); @@ -2819,10 +2824,14 @@ return crap. so we send the command, then ignore the result. #endif /* Libburn_write_with_function_print_cuE */ if (o->write_type == BURN_WRITE_SAO) - d->send_cue_sheet(d, sheet); + ret = d->send_cue_sheet(d, sheet); if (sheet->data != NULL) free(sheet->data); free(sheet); + if (ret <= 0) + goto fail_wo_sync; + + /* --- From here on, final sync is needed. --- */ if (o->write_type == BURN_WRITE_RAW) { if (!burn_write_leadin(o, disc->session[i], first)) @@ -3103,7 +3112,7 @@ int burn_disc_close_damaged(struct burn_write_opts *o, int flag) o->write_type = BURN_WRITE_TAO; /* no action without TAO */ /* Send mode page 5 */; - d->send_write_parameters(d, o); + d->send_write_parameters(d, NULL, 0, o); ret = burn_write_close_session(o); if (ret <= 0) @@ -3114,7 +3123,7 @@ int burn_disc_close_damaged(struct burn_write_opts *o, int flag) o->write_type = BURN_WRITE_TAO; /* no action without TAO */ /* Send mode page 5 */; - d->send_write_parameters(d, o); + d->send_write_parameters(d, NULL, 0, o); ret = burn_disc_close_track_dvd_minus_r(o, 0); if (ret <= 0)