New flag bit5 with burn_read_data() and burn_read_audio()

This commit is contained in:
Thomas Schmitt 2014-09-01 16:13:19 +00:00
parent fd797b3688
commit 25bb7ac7a6
6 changed files with 71 additions and 32 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2014.08.31.121421" #define Cdrskin_timestamP "2014.09.01.161217"

View File

@ -3780,7 +3780,7 @@ typedef int (*burn_abort_handler_t)(void *handle, int signum, int flag);
Depending on mode it may cancel all drive operations, wait for all drives Depending on mode it may cancel all drive operations, wait for all drives
to become idle, exit(1). It may also prepare function to become idle, exit(1). It may also prepare function
burn_drive_get_status() for waiting and performing exit(1). burn_drive_get_status() for waiting and performing exit(1).
If parameter handle may be NULL or a text that shall be used as prefix for Parameter handle may be NULL or a text that shall be used as prefix for
pacifier messages of burn_abort_pacifier(). Other than with an application pacifier messages of burn_abort_pacifier(). Other than with an application
provided handler, the prefix char array does not have to be kept existing provided handler, the prefix char array does not have to be kept existing
until the eventual signal event. until the eventual signal event.
@ -3935,6 +3935,9 @@ int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag);
(Useful to try the last two blocks of a CD (Useful to try the last two blocks of a CD
track which might be non-data because of TAO.) track which might be non-data because of TAO.)
@since 1.2.6 @since 1.2.6
bit5= issue messages with severity DEBUG if they would
be suppressed by bit1.
@since 1.4.0
@return 1=sucessful , <=0 an error occured @return 1=sucessful , <=0 an error occured
with bit3: -2= permission denied error with bit3: -2= permission denied error
@since 0.4.0 @since 0.4.0
@ -3979,6 +3982,9 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
event message. Do not retry reading in this case. event message. Do not retry reading in this case.
(Useful to try the last two blocks of a CD (Useful to try the last two blocks of a CD
track which might be non-audio because of TAO.) track which might be non-audio because of TAO.)
bit5= issue messages with severity DEBUG if they would
be suppressed by bit1.
@since 1.4.0
@return 1=sucessful , <=0 an error occured @return 1=sucessful , <=0 an error occured
with bit3: -2= permission denied error with bit3: -2= permission denied error
@since 1.2.6 @since 1.2.6

View File

@ -2079,7 +2079,8 @@ regard_as_blank:;
if ((d->current_profile != 0 || d->status != BURN_DISC_UNREADY) if ((d->current_profile != 0 || d->status != BURN_DISC_UNREADY)
&& ! d->current_is_supported_profile) { && ! d->current_is_supported_profile) {
if (!d->silent_on_scsi_error) { if (!(d->silent_on_scsi_error == 1 ||
d->silent_on_scsi_error == 2)) {
msg = calloc(1, 160); msg = calloc(1, 160);
if (msg != NULL) { if (msg != NULL) {
sprintf(msg, sprintf(msg,
@ -2087,8 +2088,10 @@ regard_as_blank:;
d->current_profile, d->current_profile_text); d->current_profile, d->current_profile_text);
libdax_msgs_submit(libdax_messenger, libdax_msgs_submit(libdax_messenger,
d->global_index, 0x0002011e, d->global_index, 0x0002011e,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, d->silent_on_scsi_error == 3 ?
msg, 0,0); LIBDAX_MSGS_SEV_DEBUG :
LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH, msg, 0,0);
free(msg); free(msg);
} }
} }
@ -2466,14 +2469,16 @@ int mmc_eval_read_error(struct burn_drive *d, struct command *c, char *what,
silent = (d->silent_on_scsi_error == 1); silent = (d->silent_on_scsi_error == 1);
if (key == 5 && asc == 0x64 && ascq == 0x0) { if (key == 5 && asc == 0x64 && ascq == 0x0) {
d->had_particular_error |= 1; d->had_particular_error |= 1;
if (d->silent_on_scsi_error == 2)
silent = 1; silent = 1;
} }
if(!silent) if(!silent)
libdax_msgs_submit(libdax_messenger, libdax_msgs_submit(libdax_messenger,
d->global_index, d->global_index,
0x00020144, 0x00020144,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, d->silent_on_scsi_error == 3 ?
msg, 0, 0); LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH, msg, 0, 0);
free(msg); free(msg);
} }
return BE_CANCELLED; return BE_CANCELLED;
@ -2807,11 +2812,17 @@ int mmc_set_streaming(struct burn_drive *d,
d->issue_command(d, c); d->issue_command(d, c);
if (c->error) { if (c->error) {
spc_decode_sense(c->sense, 0, &key, &asc, &ascq); spc_decode_sense(c->sense, 0, &key, &asc, &ascq);
if (key != 0 && !d->silent_on_scsi_error) { if (key != 0 && d->silent_on_scsi_error != 1 &&
d->silent_on_scsi_error != 2) {
sprintf(msg, sprintf(msg,
"SCSI error on set_streaming(%d): ", w_speed); "SCSI error on set_streaming(%d): ", w_speed);
scsi_error_msg(d, c->sense, 14, msg + strlen(msg), scsi_error_msg(d, c->sense, 14, msg + strlen(msg),
&key, &asc, &ascq); &key, &asc, &ascq);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020124,
d->silent_on_scsi_error == 3 ?
LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH, msg, 0, 0);
} }
{ret = 0; goto ex;} {ret = 0; goto ex;}
} }
@ -4701,14 +4712,16 @@ int mmc_read_10(struct burn_drive *d, int start,int amount, struct buffer *buf)
silent = (d->silent_on_scsi_error == 1); silent = (d->silent_on_scsi_error == 1);
if (key == 5 && asc == 0x64 && ascq == 0x0) { if (key == 5 && asc == 0x64 && ascq == 0x0) {
d->had_particular_error |= 1; d->had_particular_error |= 1;
if (d->silent_on_scsi_error == 2)
silent = 1; silent = 1;
} }
if(!silent) if(!silent)
libdax_msgs_submit(libdax_messenger, libdax_msgs_submit(libdax_messenger,
d->global_index, d->global_index,
0x00020144, 0x00020144,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, (d->silent_on_scsi_error == 3) ?
msg, 0, 0); LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH, msg, 0, 0);
free(msg); free(msg);
} }
return BE_CANCELLED; return BE_CANCELLED;

View File

@ -310,6 +310,7 @@ static void flipq(unsigned char *sub)
/** @param flag bit1= be silent on failure /** @param flag bit1= be silent on failure
bit5= report failure with severity DEBUG
*/ */
static int burn_stdio_seek(int fd, off_t byte_address, struct burn_drive *d, static int burn_stdio_seek(int fd, off_t byte_address, struct burn_drive *d,
int flag) int flag)
@ -323,15 +324,18 @@ static int burn_stdio_seek(int fd, off_t byte_address, struct burn_drive *d,
(double) byte_address); (double) byte_address);
libdax_msgs_submit(libdax_messenger, libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020147, d->global_index, 0x00020147,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, (flag & 32) ?
msg, errno, 0); LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH, msg, errno, 0);
} }
return 0; return 0;
} }
/* ts A70904 */ /* ts A70904 */
/** @param flag bit0=be silent on data shortage */ /** @param flag bit0= be silent on data shortage
bit5= report data shortage with severity DEBUG
*/
int burn_stdio_read(int fd, char *buf, int bufsize, struct burn_drive *d, int burn_stdio_read(int fd, char *buf, int bufsize, struct burn_drive *d,
int flag) int flag)
{ {
@ -346,7 +350,9 @@ int burn_stdio_read(int fd, char *buf, int bufsize, struct burn_drive *d,
if(todo > 0 && !(flag & 1)) { if(todo > 0 && !(flag & 1)) {
libdax_msgs_submit(libdax_messenger, d->global_index, libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002014a, 0x0002014a,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, (flag & 32) ?
LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH,
"Cannot read desired amount of data", errno, 0); "Cannot read desired amount of data", errno, 0);
} }
if (count < 0) if (count < 0)
@ -378,11 +384,13 @@ static int retry_mmc_read(struct burn_drive *d, int chunksize, int sose_mem,
for (i = 0; todo > 0; i++) { for (i = 0; todo > 0; i++) {
if (flag & 2) if (flag & 2)
d->silent_on_scsi_error = 1; d->silent_on_scsi_error = 1;
else if (flag & 32)
d->silent_on_scsi_error = 3;
retry_at = start + i * retry_size; retry_at = start + i * retry_size;
if (retry_size > todo) if (retry_size > todo)
retry_size = todo; retry_size = todo;
err = d->read_10(d, retry_at, retry_size, d->buffer); err = d->read_10(d, retry_at, retry_size, d->buffer);
if (flag & 2) if (flag & (2 | 32))
d->silent_on_scsi_error = sose_mem; d->silent_on_scsi_error = sose_mem;
if (err == BE_CANCELLED) if (err == BE_CANCELLED)
return 0; return 0;
@ -487,9 +495,9 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
(int) (byte_address / 2048 + !!(byte_address % 2048)), (int) (byte_address / 2048 + !!(byte_address % 2048)),
d->media_read_capacity); d->media_read_capacity);
libdax_msgs_submit(libdax_messenger, d->global_index, libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020172, 0x00020172, (flag & 32) ?
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_SORRY,
msg, 0, 0); LIBDAX_MSGS_PRIO_HIGH, msg, 0, 0);
} }
{ret = 0; goto ex;} {ret = 0; goto ex;}
} }
@ -523,10 +531,13 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_PRIO_HIGH,
"Failed to open device (a pseudo-drive) for reading", "Failed to open device (a pseudo-drive) for reading",
errno, 0); errno, 0);
} else if (errno!= ENOENT || !(flag & 2)) } else if (errno != ENOENT || !(flag & 2))
libdax_msgs_submit(libdax_messenger, libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020005, d->global_index, 0x00020005,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, (flag & 32) && errno == ENOENT ?
LIBDAX_MSGS_SEV_DEBUG :
LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH,
"Failed to open device (a pseudo-drive) for reading", "Failed to open device (a pseudo-drive) for reading",
errno, 0); errno, 0);
ret = 0; ret = 0;
@ -534,7 +545,7 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
ret= -2; ret= -2;
goto ex; goto ex;
} }
ret = burn_stdio_seek(fd, byte_address, d, flag & 2); ret = burn_stdio_seek(fd, byte_address, d, flag & (2 | 32));
if (ret <= 0) if (ret <= 0)
goto ex; goto ex;
} }
@ -556,6 +567,8 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
cpy_size = data_size - *data_count; cpy_size = data_size - *data_count;
if (flag & 2) if (flag & 2)
d->silent_on_scsi_error = 1; d->silent_on_scsi_error = 1;
else if (flag & 32)
d->silent_on_scsi_error = 3;
if (flag & 16) { if (flag & 16) {
d->had_particular_error &= ~1; d->had_particular_error &= ~1;
if (!d->silent_on_scsi_error) if (!d->silent_on_scsi_error)
@ -565,12 +578,13 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
err = d->read_10(d, start, chunksize, d->buffer); err = d->read_10(d, start, chunksize, d->buffer);
} else { } else {
ret = burn_stdio_read(fd, (char *) d->buffer->data, ret = burn_stdio_read(fd, (char *) d->buffer->data,
cpy_size, d, !!(flag & 2)); cpy_size, d,
(flag & 32) | !!(flag & 2));
err = 0; err = 0;
if (ret <= 0) if (ret <= 0)
err = BE_CANCELLED; err = BE_CANCELLED;
} }
if (flag & (2 | 16)) if (flag & (2 | 16 | 32))
d->silent_on_scsi_error = sose_mem; d->silent_on_scsi_error = sose_mem;
if (err == BE_CANCELLED) { if (err == BE_CANCELLED) {
if ((flag & 16) && (d->had_particular_error & 1)) if ((flag & 16) && (d->had_particular_error & 1))
@ -672,6 +686,8 @@ int burn_read_audio(struct burn_drive *d, int sector_no,
cpy_size = chunksize * alignment; cpy_size = chunksize * alignment;
if (flag & 2) if (flag & 2)
d->silent_on_scsi_error = 1; d->silent_on_scsi_error = 1;
else if (flag & 32)
d->silent_on_scsi_error = 3;
if (flag & 16) { if (flag & 16) {
d->had_particular_error &= ~1; d->had_particular_error &= ~1;
if (!d->silent_on_scsi_error) if (!d->silent_on_scsi_error)
@ -679,7 +695,7 @@ int burn_read_audio(struct burn_drive *d, int sector_no,
} }
err = d->read_cd(d, start, chunksize, 1, 0x10, NULL, d->buffer, err = d->read_cd(d, start, chunksize, 1, 0x10, NULL, d->buffer,
(flag & 8) >> 3); (flag & 8) >> 3);
if (flag & (2 | 16)) if (flag & (2 | 16 | 32))
d->silent_on_scsi_error = sose_mem; d->silent_on_scsi_error = sose_mem;
if (err == BE_CANCELLED) { if (err == BE_CANCELLED) {
if ((flag & 16) && (d->had_particular_error & 1)) if ((flag & 16) && (d->had_particular_error & 1))
@ -688,9 +704,11 @@ int burn_read_audio(struct burn_drive *d, int sector_no,
for (i = 0; i < chunksize - 1; i++) { for (i = 0; i < chunksize - 1; i++) {
if (flag & 2) if (flag & 2)
d->silent_on_scsi_error = 1; d->silent_on_scsi_error = 1;
else if (flag & 32)
d->silent_on_scsi_error = 3;
err = d->read_cd(d, start + i, 1, 1, 0x10, err = d->read_cd(d, start + i, 1, 1, 0x10,
NULL, d->buffer, (flag & 8) >> 3); NULL, d->buffer, (flag & 8) >> 3);
if (flag & 2) if (flag & (2 | 32))
d->silent_on_scsi_error = sose_mem; d->silent_on_scsi_error = sose_mem;
if (err == BE_CANCELLED) if (err == BE_CANCELLED)
break; break;

View File

@ -1583,7 +1583,7 @@ int scsi_notify_error(struct burn_drive *d, struct command *c,
int key= -1, asc= -1, ascq= -1, ret; int key= -1, asc= -1, ascq= -1, ret;
char *msg = NULL, *scsi_msg = NULL; char *msg = NULL, *scsi_msg = NULL;
if (d->silent_on_scsi_error) if (d->silent_on_scsi_error == 1 || d->silent_on_scsi_error == 2)
{ret = 1; goto ex;} {ret = 1; goto ex;}
BURN_ALLOC_MEM(msg, char, 320); BURN_ALLOC_MEM(msg, char, 320);
@ -1608,7 +1608,8 @@ int scsi_notify_error(struct burn_drive *d, struct command *c,
scsi_command_name((unsigned int) c->opcode[0], 0)); scsi_command_name((unsigned int) c->opcode[0], 0));
strcat(msg, scsi_msg); strcat(msg, scsi_msg);
ret = libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010f, ret = libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010f,
flag & 2 ? LIBDAX_MSGS_SEV_FAILURE : LIBDAX_MSGS_SEV_DEBUG, (flag & 2) || d->silent_on_scsi_error == 3 ?
LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_FAILURE,
LIBDAX_MSGS_PRIO_HIGH, msg,0,0); LIBDAX_MSGS_PRIO_HIGH, msg,0,0);
ex:; ex:;
BURN_FREE_MEM(msg); BURN_FREE_MEM(msg);

View File

@ -309,6 +309,7 @@ struct burn_drive
1= do not report errors 1= do not report errors
2= do not report errors which the libburn function indicates in 2= do not report errors which the libburn function indicates in
member .had_particular_error member .had_particular_error
3= report errors with severity DEBUG
*/ */
int silent_on_scsi_error; int silent_on_scsi_error;