Improved reaction on failure of SEND CUE SHEET

This commit is contained in:
Thomas Schmitt 2011-12-28 15:23:24 +00:00
parent 7b5040af17
commit 8f725bab11
5 changed files with 28 additions and 13 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.12.28.104536" #define Cdrskin_timestamP "2011.12.28.152153"

View File

@ -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 buffer *buf = NULL;
struct command *c; struct command *c;
@ -310,7 +310,7 @@ void mmc_send_cue_sheet(struct burn_drive *d, struct cue_sheet *s)
c = &(d->casual_command); c = &(d->casual_command);
mmc_start_if_needed(d, 0); mmc_start_if_needed(d, 0);
if (mmc_function_spy(d, "mmc_send_cue_sheet") <= 0) if (mmc_function_spy(d, "mmc_send_cue_sheet") <= 0)
return; return 0;
BURN_ALLOC_MEM_VOID(buf, struct buffer, 1); BURN_ALLOC_MEM_VOID(buf, struct buffer, 1);
scsi_init_command(c, MMC_SEND_CUE_SHEET, sizeof(MMC_SEND_CUE_SHEET)); scsi_init_command(c, MMC_SEND_CUE_SHEET, sizeof(MMC_SEND_CUE_SHEET));
c->retry = 1; 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); d->issue_command(d, c);
ex:; ex:;
BURN_FREE_MEM(buf); BURN_FREE_MEM(buf);
if (c->error) {
d->cancel = 1;
scsi_notify_error(d, c, c->sense, 18, 2);
}
return !c->error;
} }

View File

@ -48,7 +48,8 @@ void mmc_get_configuration(struct burn_drive *);
@return 1=nwa is valid , 0=nwa is not valid , -1=error */ @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); 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 */ /* ts A61023 : get size and free space of drive buffer */
int mmc_read_buffer_capacity(struct burn_drive *d); int mmc_read_buffer_capacity(struct burn_drive *d);

View File

@ -383,7 +383,7 @@ struct burn_drive
void (*send_write_parameters) (struct burn_drive *, void (*send_write_parameters) (struct burn_drive *,
struct burn_session *, int tno, struct burn_session *, int tno,
const struct burn_write_opts *); 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. */ /* ts A70205 : Announce size of a DVD-R[W] DAO session. */
int (*reserve_track) (struct burn_drive *d, off_t size); int (*reserve_track) (struct burn_drive *d, off_t size);

View File

@ -1023,7 +1023,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
{ ret = 0; goto ex; } { ret = 0; goto ex; }
} else { } else {
o->control = t->entry->control; o->control = t->entry->control;
d->send_write_parameters(d, o); d->send_write_parameters(d, s, tnum + 1, o);
/* ts A61103 */ /* ts A61103 */
ret = d->get_nwa(d, -1, &lba, &nwa); 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; off_t size;
BURN_ALLOC_MEM(msg, char, 160); 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); ret = d->get_nwa(d, -1, &lba, &nwa);
sprintf(msg, sprintf(msg,
"DVD pre-track %2.2d : get_nwa(%d), ret= %d , d->nwa= %d", "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 5.4.14 finally states that profile 0013h includes feature
002Ch rather than 0026h. 002Ch rather than 0026h.
d->send_write_parameters(d, o); d->send_write_parameters(d, NULL, 0, o);
*/ */
d->busy = BURN_DRIVE_FORMATTING; 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 cue_sheet *sheet;
struct burn_drive *d = o->drive; struct burn_drive *d = o->drive;
struct buffer *buffer_mem = o->drive->buffer; struct buffer *buffer_mem = o->drive->buffer;
struct burn_session *s;
struct burn_track *lt, *t; struct burn_track *lt, *t;
int first = 1, i, ret, lba, nwa = 0, multi_mem; int first = 1, i, ret, lba, nwa = 0, multi_mem;
off_t default_size; 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) { if (o->write_type == BURN_WRITE_TAO) {
nwa = 0; /* get_nwa() will be called in burn_track() */ nwa = 0; /* get_nwa() will be called in burn_track() */
} else { } 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); ret = d->get_nwa(d, -1, &lba, &nwa);
sprintf(msg, sprintf(msg,
@ -2811,7 +2816,7 @@ return crap. so we send the command, then ignore the result.
/* ts A61009 */ /* ts A61009 */
if (sheet == NULL) if (sheet == NULL)
goto fail; goto fail_wo_sync;
#ifdef Libburn_write_with_function_print_cuE #ifdef Libburn_write_with_function_print_cuE
print_cue(sheet); 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 */ #endif /* Libburn_write_with_function_print_cuE */
if (o->write_type == BURN_WRITE_SAO) if (o->write_type == BURN_WRITE_SAO)
d->send_cue_sheet(d, sheet); ret = d->send_cue_sheet(d, sheet);
if (sheet->data != NULL) if (sheet->data != NULL)
free(sheet->data); free(sheet->data);
free(sheet); free(sheet);
if (ret <= 0)
goto fail_wo_sync;
/* --- From here on, final sync is needed. --- */
if (o->write_type == BURN_WRITE_RAW) { if (o->write_type == BURN_WRITE_RAW) {
if (!burn_write_leadin(o, disc->session[i], first)) 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 */ o->write_type = BURN_WRITE_TAO; /* no action without TAO */
/* Send mode page 5 */; /* Send mode page 5 */;
d->send_write_parameters(d, o); d->send_write_parameters(d, NULL, 0, o);
ret = burn_write_close_session(o); ret = burn_write_close_session(o);
if (ret <= 0) 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 */ o->write_type = BURN_WRITE_TAO; /* no action without TAO */
/* Send mode page 5 */; /* 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); ret = burn_disc_close_track_dvd_minus_r(o, 0);
if (ret <= 0) if (ret <= 0)