From 54651df146dffd7a47ce4099dc094fcf1a8f23ea Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 8 Aug 2010 09:13:04 +0000 Subject: [PATCH] New SCSI comand response "GO_ON" --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/sg-freebsd.c | 31 +++++++++++++++++++++++++++++++ libburn/sg-libcdio.c | 7 +++++++ libburn/sg-linux.c | 5 +++++ libburn/sg-solaris.c | 7 +++++++ libburn/spc.c | 4 +++- libburn/spc.h | 2 +- 7 files changed, 55 insertions(+), 3 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 5e4642e..8e69cd4 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2010.08.03.091119" +#define Cdrskin_timestamP "2010.08.08.091224" diff --git a/libburn/sg-freebsd.c b/libburn/sg-freebsd.c index c18ea43..dc217ed 100644 --- a/libburn/sg-freebsd.c +++ b/libburn/sg-freebsd.c @@ -974,6 +974,14 @@ int sg_issue_command(struct burn_drive *d, struct command *c) done = 1; c->error = 1; break; + case GO_ON: + if (burn_sg_log_scsi & 3) + /* >>> Need own duration time + measurement. Then remove bit1 */ + scsi_log_err(c, fp, c->sense, + sense_len > 0 ? sense_len : 18, + 0, 1 | 2); + {ret = 1; goto ex;} } } else { done = 1; @@ -1003,6 +1011,10 @@ int burn_os_is_2k_seekrw(char *path, int flag) struct stat stbuf; char *spt; int i, e; +#ifdef Libburn_DIOCGMEDIASIZE_ISBLK + int fd; + off_t add_size; +#endif if (stat(path, &stbuf) == -1) return 0; @@ -1010,6 +1022,22 @@ int burn_os_is_2k_seekrw(char *path, int flag) return 1; if (!S_ISCHR(stbuf.st_mode)) return 0; + +#ifdef Libburn_DIOCGMEDIASIZE_ISBLK + + /* If it throws no error with DIOCGMEDIASIZE then it is a + 'block device' + */ + fd = open(path, O_RDONLY); + if (fd == -1) + return 0; + ret = ioctl(fd, DIOCGMEDIASIZE, &add_size); + close(fd); + + return 1; + +#else /* Libburn_DIOCGMEDIASIZE_ISBLK */ + spt = strrchr(path, '/'); if (spt == NULL) spt = path; @@ -1032,6 +1060,9 @@ int burn_os_is_2k_seekrw(char *path, int flag) if (strncmp(spt, "fla", e) == 0) /* Flash drive */ return 1; return 0; + +#endif /* ! Libburn_DIOCGMEDIASIZE_ISBLK */ + } diff --git a/libburn/sg-libcdio.c b/libburn/sg-libcdio.c index 133ef19..aef211f 100644 --- a/libburn/sg-libcdio.c +++ b/libburn/sg-libcdio.c @@ -705,6 +705,13 @@ int sg_issue_command(struct burn_drive *d, struct command *c) case FAIL: c->error = 1; goto ex; + case GO_ON: + if (burn_sg_log_scsi & 3) + /* >>> Need own duration time + measurement. Then remove bit1 */ + scsi_log_err(c, fp, c->sense, 18, 0, + 1 | 2); + goto ex; } /* Calming down retries and breaking up endless cycle diff --git a/libburn/sg-linux.c b/libburn/sg-linux.c index cce9b89..6e6d4aa 100644 --- a/libburn/sg-linux.c +++ b/libburn/sg-linux.c @@ -1930,6 +1930,11 @@ if(0){ done = 1; c->error = 1; break; + case GO_ON: + if (burn_sg_log_scsi & 3) + scsi_log_err(c, fp, s.sbp, s.sb_len_wr, + s.duration, 1); + goto ex; } /* ts A90921 : diff --git a/libburn/sg-solaris.c b/libburn/sg-solaris.c index a725b49..1867ca3 100644 --- a/libburn/sg-solaris.c +++ b/libburn/sg-solaris.c @@ -660,6 +660,13 @@ int sg_issue_command(struct burn_drive *d, struct command *c) case FAIL: c->error = 1; goto ex; + case GO_ON: + if (burn_sg_log_scsi & 3) + /* >>> Need own duration time + measurement. Then remove bit1 */ + scsi_log_err(c, fp, c->sense, 18, 0, + 1 | 2); + goto ex; } /* Calming down retries and breaking up endless cycle diff --git a/libburn/spc.c b/libburn/spc.c index 92f8cae..3d306de 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -1017,8 +1017,10 @@ enum response scsi_error_msg(struct burn_drive *d, unsigned char *sense, switch (*asc) { case 0x00: + if (*key > 0 || *ascq > 0) + break; /* Fall through to unknown error */ sprintf(msg, "(No error reported by SCSI transaction)"); - return RETRY; + return GO_ON; case 0x02: sprintf(msg, "Not ready"); diff --git a/libburn/spc.h b/libburn/spc.h index c3f8b22..bf07ed1 100644 --- a/libburn/spc.h +++ b/libburn/spc.h @@ -49,7 +49,7 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no, int channel_no, int target_no, int lun_no, int flag); /* ts A61115 moved from sg-*.h */ -enum response { RETRY, FAIL }; +enum response { RETRY, FAIL, GO_ON }; enum response scsi_error(struct burn_drive *, unsigned char *, int); /* ts A61122 */