From 610e213f70022b03d4a2b4ffd9bf15597f3a13ed Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 17 Apr 2019 11:00:03 +0200 Subject: [PATCH] Putting out more info in case of failed Linux SG_IO ioctl --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/sg-linux.c | 22 ++++++++++++++++++++-- libburn/spc.c | 9 ++++++++- libburn/spc.h | 5 ++++- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 43ed6f5..1f2dd2b 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2019.04.13.173610" +#define Cdrskin_timestamP "2019.04.17.085941" diff --git a/libburn/sg-linux.c b/libburn/sg-linux.c index aeca4db..48c29c7 100644 --- a/libburn/sg-linux.c +++ b/libburn/sg-linux.c @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2014 Thomas Schmitt + Copyright (c) 2006 - 2019 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -2042,7 +2042,7 @@ static void react_on_drive_loss(struct burn_drive *d, struct command *c, */ int sg_issue_command(struct burn_drive *d, struct command *c) { - int done = 0, no_c_page = 0, i, ret; + int done = 0, no_c_page = 0, i, j, ret; int err; time_t start_time; sg_io_hdr_t s; @@ -2199,6 +2199,24 @@ int sg_issue_command(struct burn_drive *d, struct command *c) (unsigned int) s.host_status, (unsigned int) s.driver_status); scsi_log_message(d, fp, msg, 0); + + libdax_msgs_submit(libdax_messenger, + d->global_index, 0x0002010c, + LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH, + msg, 0, 0); + sprintf(msg, "Attempted command: %s : ", + spc_command_name( + (unsigned int) c->opcode[0], 0)); + for (j = 0; j <16 && j < c->oplen; j++) + sprintf(msg + strlen(msg), "%2.2x ", + c->opcode[j]); + sprintf(msg + strlen(msg), " : dxfer_len= %d", + s.dxfer_len); + libdax_msgs_submit(libdax_messenger, + d->global_index, 0x0002010c, + LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH, + msg, 0, 0); + react_on_drive_loss(d, c, fp); {ret = -1; goto ex;} } diff --git a/libburn/spc.c b/libburn/spc.c index b19a718..3ab207a 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2016 Thomas Schmitt + Copyright (c) 2006 - 2019 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -1720,6 +1720,13 @@ static char *scsi_command_name(unsigned int c, int flag) } +/* ts B90206: Avoid publishing more inner API functions which begin by scsi_ */ +char *spc_command_name(unsigned int c, int flag) +{ + return(scsi_command_name(c, flag)); +} + + /* ts A61030 - A61115 */ /* @param flag bit0= do report conditions which are considered not an error bit1= report with severity FAILURE rather than DEBUG diff --git a/libburn/spc.h b/libburn/spc.h index 799ffae..57beffa 100644 --- a/libburn/spc.h +++ b/libburn/spc.h @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2014 Thomas Schmitt + Copyright (c) 2006 - 2019 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -114,6 +114,9 @@ int scsi_log_message(struct burn_drive *d, void *fp, char * msg, int flag); int spc_decode_sense(unsigned char *sense, int senselen, int *key, int *asc, int *ascq); +/* ts B90206 */ +char *spc_command_name(unsigned int c, int flag); + /* ts B00808 */ /** Evaluates outcome of a single SCSI command, eventually logs sense data, and issues DEBUG error message in case the command is evaluated as done.