Enhanced optional SCSI command logging

This commit is contained in:
Thomas Schmitt 2006-11-15 09:11:57 +00:00
parent c1b3d3341e
commit 17d1d2e8a6

View File

@ -591,6 +591,9 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
int done = 0, no_c_page = 0; int done = 0, no_c_page = 0;
int err; int err;
sg_io_hdr_t s; sg_io_hdr_t s;
/*
#define Libburn_log_sg_commandS 1
*/
#ifdef Libburn_log_sg_commandS #ifdef Libburn_log_sg_commandS
/* <<< ts A61030 */ /* <<< ts A61030 */
@ -612,10 +615,12 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
fp= fopen("/tmp/libburn_sg_command_log","a"); fp= fopen("/tmp/libburn_sg_command_log","a");
fprintf(fp,"\n-----------------------------------------\n"); fprintf(fp,"\n-----------------------------------------\n");
} }
if(fp!=NULL) {
for(i=0;i<10;i++) for(i=0;i<10;i++)
fprintf(fp,"%2.2x ", c->opcode[i]); fprintf(fp,"%2.2x ", c->opcode[i]);
fprintf(fp,"\n"); fprintf(fp,"\n");
fpcount++; fpcount++;
}
#endif /* Libburn_log_sg_commandS */ #endif /* Libburn_log_sg_commandS */
@ -714,6 +719,15 @@ ex:;
if (c->error) { if (c->error) {
/* >>> to become d->notify_error() */ /* >>> to become d->notify_error() */
scsi_notify_error(d, c, s.sbp, s.sb_len_wr, 0); scsi_notify_error(d, c, s.sbp, s.sb_len_wr, 0);
#ifdef Libburn_log_sg_commandS
if(fp!=NULL) {
fprintf(fp,"+++ key=%X asc=%2.2Xh ascq=%2.2Xh\n",
s.sbp[2], s.sbp[12], s.sbp[13]);
fpcount++;
}
#endif /* Libburn_log_sg_commandS */
} }
return 1; return 1;
} }