From 4c74cbf7b3a15aa1b37a14bd5c74428f05aaa0e1 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 25 Oct 2012 12:39:50 +0000 Subject: [PATCH] New flag bit4 of burn_read_data() for better handling of TAO end blocks --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/libburn.h | 7 +++++++ libburn/mmc.c | 9 +++++++-- libburn/read.c | 11 +++++++++-- libburn/spc.c | 3 +++ libburn/transport.h | 12 +++++++++++- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index cd77967..701e7a0 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2012.10.24.095725" +#define Cdrskin_timestamP "2012.10.25.123837" diff --git a/libburn/libburn.h b/libburn/libburn.h index 74f6749..8c8394e 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -3767,6 +3767,13 @@ int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag); bit3= return -2 on permission denied error rather than issueing a warning message. @since 1.0.6 + bit4= return -3 on SCSI error + 5 64 00 ILLEGAL MODE FOR THIS TRACK + and prevent this error from being reported as + event message. Do not retry reading in this case. + (Useful to try the last two blocks of a CD + track which might be non-data because of TAO.) + @since 1.2.6 @return 1=sucessful , <=0 an error occured with bit3: -2= permission denied error @since 0.4.0 diff --git a/libburn/mmc.c b/libburn/mmc.c index 8517921..34b9b3c 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -4193,7 +4193,7 @@ int mmc_read_10(struct burn_drive *d, int start,int amount, struct buffer *buf) { struct command *c; char *msg = NULL; - int key, asc, ascq; + int key, asc, ascq, silent; c = &(d->casual_command); mmc_start_if_needed(d, 0); @@ -4221,7 +4221,12 @@ int mmc_read_10(struct burn_drive *d, int start,int amount, struct buffer *buf) "SCSI error on read_10(%d,%d): ", start, amount); scsi_error_msg(d, c->sense, 14, msg + strlen(msg), &key, &asc, &ascq); - if(!d->silent_on_scsi_error) + silent = (d->silent_on_scsi_error == 1); + if (key == 5 && asc == 0x64 && ascq == 0x0) { + d->had_particular_error |= 1; + silent = 1; + } + if(!silent) libdax_msgs_submit(libdax_messenger, d->global_index, 0x00020144, diff --git a/libburn/read.c b/libburn/read.c index 425c150..57027ea 100644 --- a/libburn/read.c +++ b/libburn/read.c @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2011 Thomas Schmitt + Copyright (c) 2006 - 2012 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -472,6 +472,11 @@ int burn_read_data(struct burn_drive *d, off_t byte_address, cpy_size = data_size - *data_count; if (flag & 2) d->silent_on_scsi_error = 1; + if (flag & 16) { + d->had_particular_error &= ~1; + if (!d->silent_on_scsi_error) + d->silent_on_scsi_error = 2; + } if (d->drive_role == 1) { err = d->read_10(d, start, chunksize, d->buffer); } else { @@ -481,9 +486,11 @@ int burn_read_data(struct burn_drive *d, off_t byte_address, if (ret <= 0) err = BE_CANCELLED; } - if (flag & 2) + if (flag & (2 | 16)) d->silent_on_scsi_error = sose_mem; if (err == BE_CANCELLED) { + if ((flag & 16) && (d->had_particular_error & 1)) + ret = -3; goto ex; /* Try to read a smaller part of the chunk */ if(!(flag & 4)) for (i = 0; i < chunksize - 1; i++) { diff --git a/libburn/spc.c b/libburn/spc.c index d82d3a1..c0645b5 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -1003,6 +1003,9 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no, /* ts A61106 */ d->silent_on_scsi_error = 0; + /* ts B21023 */ + d->had_particular_error = 0; + d->idata = calloc(1, sizeof(struct burn_scsi_inquiry_data)); d->mdata = calloc(1, sizeof(struct scsi_mode_data)); diff --git a/libburn/transport.h b/libburn/transport.h index af54e7e..bcf22d3 100644 --- a/libburn/transport.h +++ b/libburn/transport.h @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2011 Thomas Schmitt + Copyright (c) 2006 - 2012 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -261,8 +261,18 @@ struct burn_drive volatile int released; /* ts A61106 */ + /* 0= report errors + 1= do not report errors + 2= do not report errors which the libburn function indicates in + member .had_particular_error + */ int silent_on_scsi_error; + /* ts B21023 */ + /* bit0= 5 64 00 occured with READ10 in mmc_read_10() + */ + int had_particular_error; + int stdio_fd; int nwa; /* next writeable address */