Coordinated scsi_notify_error() and scsi_error()
This commit is contained in:
parent
314027631a
commit
26fa325ee4
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2006.11.20.132717"
|
#define Cdrskin_timestamP "2006.11.22.122228"
|
||||||
|
@ -525,86 +525,103 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A61115 moved from sg-*.c */
|
/* ts A61122 */
|
||||||
enum response scsi_error(struct burn_drive *d, unsigned char *sense,
|
enum response scsi_error_msg(struct burn_drive *d, unsigned char *sense,
|
||||||
int senselen)
|
int senselen, char msg[161],
|
||||||
|
int *key, int *asc, int *ascq)
|
||||||
{
|
{
|
||||||
int key, asc, ascq;
|
*key= *asc= *ascq= -1;
|
||||||
|
|
||||||
senselen = senselen;
|
if (senselen<=0 || senselen>2)
|
||||||
key = sense[2];
|
*key = sense[2];
|
||||||
asc = sense[12];
|
if (senselen<=0 || senselen>12)
|
||||||
ascq = sense[13];
|
*asc = sense[12];
|
||||||
|
if (senselen<=0 || senselen>13)
|
||||||
|
*ascq = sense[13];
|
||||||
|
|
||||||
burn_print(12, "CONDITION: 0x%x 0x%x 0x%x on %s %s\n",
|
burn_print(12, "CONDITION: 0x%x 0x%x 0x%x on %s %s\n",
|
||||||
key, asc, ascq, d->idata->vendor, d->idata->product);
|
*key, *asc, *ascq, d->idata->vendor, d->idata->product);
|
||||||
|
|
||||||
switch (asc) {
|
switch (*asc) {
|
||||||
case 0:
|
case 0:
|
||||||
burn_print(12, "NO ERROR!\n");
|
sprintf(msg, "(no error reported by SCSI transaction)");
|
||||||
return RETRY;
|
return RETRY;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
burn_print(1, "not ready\n");
|
sprintf(msg, "not ready");
|
||||||
return RETRY;
|
return RETRY;
|
||||||
case 4:
|
case 4:
|
||||||
burn_print(1,
|
sprintf(msg,
|
||||||
"logical unit is in the process of becoming ready\n");
|
"logical unit is in the process of becoming ready");
|
||||||
return RETRY;
|
return RETRY;
|
||||||
case 0x20:
|
case 0x20:
|
||||||
if (key == 5)
|
if (*key == 5)
|
||||||
burn_print(1, "bad opcode\n");
|
sprintf(msg, "bad opcode");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
case 0x21:
|
case 0x21:
|
||||||
burn_print(1, "invalid address or something\n");
|
sprintf(msg, "invalid address");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
case 0x24:
|
case 0x24:
|
||||||
if (key == 5)
|
if (*key == 5)
|
||||||
burn_print(1, "invalid field in cdb\n");
|
sprintf(msg, "invalid field in cdb");
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
case 0x26:
|
case 0x26:
|
||||||
if ( key == 5 )
|
if (*key == 5 )
|
||||||
burn_print( 1, "invalid field in parameter list\n" );
|
sprintf(msg, "invalid field in parameter list" );
|
||||||
return FAIL;
|
return FAIL;
|
||||||
case 0x28:
|
case 0x28:
|
||||||
if (key == 6)
|
if (*key == 6)
|
||||||
burn_print(1,
|
sprintf(msg, "Medium may have changed");
|
||||||
"Not ready to ready change, medium may have changed\n");
|
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
return RETRY;
|
return RETRY;
|
||||||
case 0x3A:
|
case 0x3A:
|
||||||
burn_print(12, "Medium not present in %s %s\n",
|
sprintf(msg, "Medium not present");
|
||||||
d->idata->vendor, d->idata->product);
|
|
||||||
|
|
||||||
d->status = BURN_DISC_EMPTY;
|
d->status = BURN_DISC_EMPTY;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
burn_print(1, "unknown failure\n");
|
sprintf(msg,
|
||||||
burn_print(1, "key:0x%x, asc:0x%x, ascq:0x%x\n", key, asc, ascq);
|
"Failure. See mmc3r10g.pdf: Sense Key %X ASC %2.2X ASCQ %2.2X",
|
||||||
|
*key, *asc, *ascq);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ts A61115 moved from sg-*.c */
|
||||||
|
/* ts A61122 made it frontend to scsi_error_msg() */
|
||||||
|
enum response scsi_error(struct burn_drive *d, unsigned char *sense,
|
||||||
|
int senselen)
|
||||||
|
{
|
||||||
|
int key, asc, ascq;
|
||||||
|
char msg[160];
|
||||||
|
enum response resp;
|
||||||
|
|
||||||
|
resp = scsi_error_msg(d, sense, senselen, msg, &key, &asc, &ascq);
|
||||||
|
if (asc == 0 || asc == 0x3A)
|
||||||
|
burn_print(12, "%s\n", msg);
|
||||||
|
else
|
||||||
|
burn_print(1, "%s\n", msg);
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A61030 - A61115 */
|
/* ts A61030 - A61115 */
|
||||||
/* @param flag bit0=do report conditions which are considered not an error */
|
/* @param flag bit0=do report conditions which are considered not an error */
|
||||||
int scsi_notify_error(struct burn_drive *d, struct command *c,
|
int scsi_notify_error(struct burn_drive *d, struct command *c,
|
||||||
unsigned char *sense, int senselen, int flag)
|
unsigned char *sense, int senselen, int flag)
|
||||||
{
|
{
|
||||||
int key= -1, asc= -1, ascq= -1, ret;
|
int key= -1, asc= -1, ascq= -1, ret;
|
||||||
char msg[160];
|
char msg[320],scsi_msg[160];
|
||||||
|
|
||||||
if (d->silent_on_scsi_error)
|
if (d->silent_on_scsi_error)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (senselen > 2)
|
strcpy(scsi_msg, " \"");
|
||||||
key = sense[2];
|
scsi_error_msg(d, sense, senselen, scsi_msg + strlen(scsi_msg),
|
||||||
if (senselen > 13) {
|
&key, &asc, &ascq);
|
||||||
asc = sense[12];
|
strcat(scsi_msg, "\"");
|
||||||
ascq = sense[13];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!(flag & 1)) {
|
if(!(flag & 1)) {
|
||||||
/* SPC : TEST UNIT READY command */
|
/* SPC : TEST UNIT READY command */
|
||||||
@ -626,6 +643,11 @@ int scsi_notify_error(struct burn_drive *d, struct command *c,
|
|||||||
sprintf(msg+strlen(msg), " ascq=%2.2Xh", ascq);
|
sprintf(msg+strlen(msg), " ascq=%2.2Xh", ascq);
|
||||||
ret = libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010f,
|
ret = libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010f,
|
||||||
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH, msg,0,0);
|
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH, msg,0,0);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
ret = libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010f,
|
||||||
|
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
|
scsi_msg,0,0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,11 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no,
|
|||||||
enum response { RETRY, FAIL };
|
enum response { RETRY, FAIL };
|
||||||
enum response scsi_error(struct burn_drive *, unsigned char *, int);
|
enum response scsi_error(struct burn_drive *, unsigned char *, int);
|
||||||
|
|
||||||
|
/* ts A61122 */
|
||||||
|
enum response scsi_error_msg(struct burn_drive *d, unsigned char *sense,
|
||||||
|
int senselen, char msg[161],
|
||||||
|
int *key, int *asc, int *ascq);
|
||||||
|
|
||||||
/* ts A61030 */
|
/* ts A61030 */
|
||||||
/* @param flag bit0=do report conditions which are considered not an error */
|
/* @param flag bit0=do report conditions which are considered not an error */
|
||||||
int scsi_notify_error(struct burn_drive *, struct command *c,
|
int scsi_notify_error(struct burn_drive *, struct command *c,
|
||||||
|
Loading…
Reference in New Issue
Block a user