From 24bc0113054a84e8ad99777d61a7fb763025efa8 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 22 May 2007 15:45:57 +0000 Subject: [PATCH] Report eventual sg_io_hdr_t host_status,driver_status as debug messages --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/sg-linux.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index aa1045cc..6086c89e 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.05.21.185644" +#define Cdrskin_timestamP "2007.05.22.154407" diff --git a/libburn/trunk/libburn/sg-linux.c b/libburn/trunk/libburn/sg-linux.c index bbe04ce9..33c46626 100644 --- a/libburn/trunk/libburn/sg-linux.c +++ b/libburn/trunk/libburn/sg-linux.c @@ -72,9 +72,16 @@ Hint: You should also look into sg-freebsd-port.c, which is a younger and #include #include #include -#include #include +#include +/* Values within sg_io_hdr_t indicating success after ioctl(SG_IO) : */ +/* .host_status : from http://tldp.org/HOWTO/SCSI-Generic-HOWTO/x291.html */ +#define Libburn_sg_host_oK 0 +/* .driver_status : from http://tldp.org/HOWTO/SCSI-Generic-HOWTO/x322.html */ +#define Libburn_sg_driver_oK 0 + + /* ts A61211 : to eventually recognize CD devices on /dev/sr* */ #include @@ -1231,6 +1238,19 @@ int sg_issue_command(struct burn_drive *d, struct command *c) ex:; if (c->error) { scsi_notify_error(d, c, s.sbp, s.sb_len_wr, 0); + } else if (s.host_status != Libburn_sg_host_oK || + s.driver_status != Libburn_sg_driver_oK) { + char msg[161]; + + sprintf(msg,"SCSI command indicates host or driver error:"); + sprintf(msg+strlen(msg), + " host_status= %xh , driver_status= %xh", + (unsigned int) s.host_status, + (unsigned int) s.driver_status); + libdax_msgs_submit(libdax_messenger, d->global_index, + 0x0002013b, + LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH, + msg, 0, 0); } #ifdef Libburn_log_sg_commandS