Being more rugged towards missing MODE SENSE info

This commit is contained in:
Thomas Schmitt 2014-02-10 21:33:50 +00:00
parent 43e1daab23
commit d40ab32360
4 changed files with 25 additions and 19 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2014.02.07.180650" #define Cdrskin_timestamP "2014.02.10.213159"

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2013 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2014 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -1221,6 +1221,12 @@ static void strip_spaces(char *str)
static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out) static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out)
{ {
struct burn_scsi_inquiry_data *id; struct burn_scsi_inquiry_data *id;
int i;
/* For faking CD recording capability of unavailable mode page 0x2A */
static int writer_profiles[] = {
0x09, 0x0a, 0x11, 0x12, 0x13, 0x14, 0x15, 0x1a, 0x1b, 0x2b,
0x41, 0x42, 0x43, 0x00
};
/* ts A61007 : now prevented in enumerate_common() */ /* ts A61007 : now prevented in enumerate_common() */
#if 0 #if 0
@ -1260,6 +1266,13 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out)
out->read_dvdrom = out->read_cdr = out->read_cdrw = 0; out->read_dvdrom = out->read_cdr = out->read_cdrw = 0;
out->write_dvdram = out->write_dvdr = out->write_cdr = 0; out->write_dvdram = out->write_dvdr = out->write_cdr = 0;
out->write_cdrw = out->write_simulate = out->c2_errors = 0; out->write_cdrw = out->write_simulate = out->c2_errors = 0;
/* If the drive reported a writer profile, attribute CD-R */
for (i = 0; writer_profiles[i] != 0; i++)
if (writer_profiles[i] == d->current_profile) {
out->write_cdr = 1;
break;
}
} }
out->drive = d; out->drive = d;

View File

@ -4637,13 +4637,6 @@ fprintf(stderr, "libburn_EXPERIMENTAL: block_type = %d, pd[4]= %u\n",
memcpy(pd + 33, isrc_text, 12); memcpy(pd + 33, isrc_text, 12);
} }
} }
if (d->mdata->write_page_valid <= 0) {
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
"mmc_compose_mode_page_5: No mode page 05 was read",
0, 0);
return 0;
}
return 1; return 1;
} }

View File

@ -431,9 +431,6 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
if (*alloc_len < 10) if (*alloc_len < 10)
{ret = 0; goto ex;} {ret = 0; goto ex;}
if (!(flag & 1))
mmc_get_configuration(d);
BURN_ALLOC_MEM(msg, char, BURN_DRIVE_ADR_LEN + 160); BURN_ALLOC_MEM(msg, char, BURN_DRIVE_ADR_LEN + 160);
BURN_ALLOC_MEM(buf, struct buffer, 1); BURN_ALLOC_MEM(buf, struct buffer, 1);
BURN_ALLOC_MEM(c, struct command, 1); BURN_ALLOC_MEM(c, struct command, 1);
@ -646,6 +643,8 @@ void spc_sense_caps(struct burn_drive *d)
if (mmc_function_spy(d, "sense_caps") <= 0) if (mmc_function_spy(d, "sense_caps") <= 0)
return; return;
mmc_get_configuration(d);
/* first command execution to learn Allocation Length */ /* first command execution to learn Allocation Length */
alloc_len = start_len; alloc_len = start_len;
ret = spc_sense_caps_al(d, &alloc_len, 1); ret = spc_sense_caps_al(d, &alloc_len, 1);
@ -694,7 +693,6 @@ void spc_sense_error_params(struct burn_drive *d)
c->page->sectors = 0; c->page->sectors = 0;
c->dir = FROM_DRIVE; c->dir = FROM_DRIVE;
d->issue_command(d, c); d->issue_command(d, c);
m = d->mdata; m = d->mdata;
page = c->page->data + 8; page = c->page->data + 8;
d->params.retries = page[3]; d->params.retries = page[3];
@ -781,9 +779,11 @@ void spc_sense_write_params(struct burn_drive *d)
if (!c->error) { if (!c->error) {
page = c->page->data + 8; page = c->page->data + 8;
m->write_page_length = page[1]; m->write_page_length = page[1];
if (m->write_page_length > 0)
m->write_page_valid = 1; m->write_page_valid = 1;
} else else
m->write_page_valid = 0; m->write_page_length = 0x32;
}
mmc_read_disc_info(d); mmc_read_disc_info(d);
/* ts A70212 : try to setup d->media_capacity_remaining */ /* ts A70212 : try to setup d->media_capacity_remaining */
@ -837,8 +837,6 @@ void spc_select_write_params(struct burn_drive *d, struct burn_session *s,
o->block_type,spc_block_type(o->block_type)); o->block_type,spc_block_type(o->block_type));
*/ */
if (d->mdata->write_page_valid <= 0)
d->mdata->write_page_length = 0;
alloc_len = 8 + 2 + d->mdata->write_page_length; alloc_len = 8 + 2 + d->mdata->write_page_length;
memset(&(buf->data), 0, alloc_len); memset(&(buf->data), 0, alloc_len);
@ -1094,6 +1092,8 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no,
d->mdata->max_write_speed = 0; d->mdata->max_write_speed = 0;
d->mdata->cur_write_speed = 0; d->mdata->cur_write_speed = 0;
d->mdata->speed_descriptors = NULL; d->mdata->speed_descriptors = NULL;
d->mdata->write_page_length = 0x32;
d->mdata->write_page_valid = 0;
if (!(flag & 1)) { if (!(flag & 1)) {
ret = spc_setup_drive(d); ret = spc_setup_drive(d);
if (ret<=0) if (ret<=0)
@ -1733,7 +1733,7 @@ int scsi_log_reply(unsigned char *opcode, int data_dir, unsigned char *data,
l = 18; l = 18;
if ((sense[0] & 0x7f) == 0x72 || if ((sense[0] & 0x7f) == 0x72 ||
(sense[0] & 0x7f) == 0x73) (sense[0] & 0x7f) == 0x73)
l = sense[7] + 7 + 1; /* SPC-5 4.5.2. */ l = sense[7] + 7 + 1; /* SPC-3 4.5.2. */
if (l > sense_len) if (l > sense_len)
l = sense_len; l = sense_len;
fprintf(fp, "+++ sense data ="); fprintf(fp, "+++ sense data =");