Cared for some SCSI error conditions which were ignored up to now

This commit is contained in:
Thomas Schmitt 2006-11-06 19:58:24 +00:00
parent 1c61d511c0
commit 890eb41cbe
6 changed files with 42 additions and 14 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2006.11.06.155237"
#define Cdrskin_timestamP "2006.11.06.195743"

View File

@ -115,6 +115,14 @@ int mmc_get_nwa(struct burn_drive *d)
c.dir = FROM_DRIVE;
d->issue_command(d, &c);
data = c.page->data;
/* ts A61106 : >>> MMC-1 Table 142 : NWA_V = NWA Valid Flag
What to do if this is not 1 ? */
if (!(data[7]&1))
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
"mmc_get_nwa: Track Info Block: NWA_V == 0", 0, 0);
return (data[12] << 24) + (data[13] << 16)
+ (data[14] << 8) + data[15];
}
@ -656,8 +664,12 @@ void mmc_read_sectors(struct burn_drive *d,
len >>= 8;
c.opcode[6] = len & 0xFF;
req = 0xF8;
/* ts A61106 : LG GSA-4082B dislikes this. key=5h asc=24h ascq=00h
if (d->busy == BURN_DRIVE_GRABBING || o->report_recovered_errors)
req |= 2;
*/
c.opcode[10] = 0;
/* always read the subcode, throw it away later, since we don't know

View File

@ -727,6 +727,8 @@ int scsi_notify_error(struct burn_drive *d, struct command *c,
int key, asc, ascq, ret;
char msg[160];
if (d->silent_on_scsi_error)
return 1;
if (c->opcode[0] == 0) /* SPC : TEST UNIT READY command */
if(!(flag & 1))
return 1;
@ -735,12 +737,12 @@ int scsi_notify_error(struct burn_drive *d, struct command *c,
sprintf(msg,"SCSI error condition on command %2.2Xh :", c->opcode[0]);
if (senselen > 2) {
key = sense[2];
sprintf(msg+strlen(msg), " key=%xh", key);
sprintf(msg+strlen(msg), " key=%Xh", key);
}
if (senselen > 13) {
asc = sense[12];
ascq = sense[13];
sprintf(msg+strlen(msg), " asc=%xh ascq=%xh", asc, ascq);
sprintf(msg+strlen(msg), " asc=%2.2Xh ascq=%2.2Xh", asc, ascq);
}
ret = libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010f,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH, msg,0,0);

View File

@ -382,7 +382,10 @@ void spc_probe_write_modes(struct burn_drive *d)
c.page->data[12] = try_block_type;
c.page->data[23] = 150;
c.dir = TO_DRIVE;
d->silent_on_scsi_error = 1;
d->issue_command(d, &c);
d->silent_on_scsi_error = 0;
key = c.sense[2];
asc = c.sense[12];
@ -491,6 +494,10 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no,
d->channel = channel_no;
d->lun = lun_no;
/* ts A61106 */
d->silent_on_scsi_error = 0;
d->idata = malloc(sizeof(struct burn_scsi_inquiry_data));
d->idata->valid = 0;
d->mdata = malloc(sizeof(struct scsi_mode_data));

View File

@ -129,6 +129,10 @@ struct burn_drive
enum burn_disc_status status;
int erasable;
volatile int released;
/* ts A61106 */
int silent_on_scsi_error;
int nwa; /* next writeable address */
int alba; /* absolute lba */
int rlba; /* relative lba in section */

View File

@ -598,7 +598,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
} else {
o->control = t->entry->control;
d->send_write_parameters(d, o);
/* ts A61103 */
nwa = d->get_nwa(d);
sprintf(msg, "pre-track %2.2d : get_nwa()= %d , d->nwa= %d\n",
@ -758,21 +758,24 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc)
/* Apparently some drives require this command to be sent, and a few drives
return crap. so we send the command, then ignore the result.
*/
nwa = d->get_nwa(d);
/* >>> ts A61031 : one should not ignore the "crap" but find out
when and why it occurs. Multi-session will hardly
work on base of flat guessing.
*/
sprintf(msg, "Inquired nwa: %d", nwa);
libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msg,0,0);
/* ts A61107 : moved up send_write_parameters because LG GSA-4082B
seems to dislike get_nwa() in advance */
d->alba = d->start_lba;
d->nwa = d->alba;
if (o->write_type == BURN_WRITE_TAO) {
nwa = 0; /* get_nwa() will be called in burn_track() */
} else {
if (o->write_type != BURN_WRITE_TAO)
d->send_write_parameters(d, o);
nwa = d->get_nwa(d);
sprintf(msg, "Inquired nwa: %d", nwa);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
msg,0,0);
}
/* init progress before showing the state */
d->progress.session = 0;
d->progress.sessions = disc->sessions;