c88503add2
cdparanoia-alpha9.8-22.src.rpm
87 lines
2.2 KiB
Diff
87 lines
2.2 KiB
Diff
--- cdparanoia-III-alpha9.8/interface/scsi_interface.c.louder 2004-04-23 12:18:20.561275440 -0400
|
|
+++ cdparanoia-III-alpha9.8/interface/scsi_interface.c 2004-04-23 12:24:37.853918240 -0400
|
|
@@ -197,16 +197,41 @@
|
|
memset(hdr->dxferp, sgi->bytefill, sgi->dxferp_buffer_len);
|
|
memcpy(hdr->cmdp, cmdp, cmd_len);
|
|
|
|
- hdr->cmd_len = cmd_len;
|
|
+ sgi->cmd_len = hdr->cmd_len = cmd_len;
|
|
|
|
sgi->in_size = in_size;
|
|
sgi->out_size = out_size;
|
|
}
|
|
|
|
+void print_cmd_error(cdrom_drive *d, char *direction, char *cmdp, int cmdlen) {
|
|
+ unsigned char ebuf[1024], tmp[2];
|
|
+ int x=0;
|
|
+
|
|
+ sprintf(ebuf, "\nError %s command: ", direction);
|
|
+ cdmessage(d, ebuf);
|
|
+ tmp[1] = 0;
|
|
+ while (x < cmdlen) {
|
|
+ if (x % 8 == 0)
|
|
+ cdmessage(d, " ");
|
|
+ if (x % 16 == 0) {
|
|
+ cdmessage(d, "\n");
|
|
+ if (x+1 < cmdlen)
|
|
+ cdmessage(d, "\t");
|
|
+ }
|
|
+ tmp[0] = cmdp[x];
|
|
+ sprintf(ebuf, "%02x ", tmp[0]);
|
|
+ cdmessage(d, ebuf);
|
|
+ x++;
|
|
+ }
|
|
+ if (!(x % 16 == 0))
|
|
+ cdmessage(d, "\n");
|
|
+}
|
|
+
|
|
static int sgio_handle_scsi_cmd(cdrom_drive *d) {
|
|
int status = 0;
|
|
struct sg_info *sgi = (struct sg_info *)d->sg;
|
|
struct sg_io_hdr *hdr = sgi->hdr;
|
|
+ char ebuf[256];
|
|
|
|
if (sgi->in_size) {
|
|
hdr->dxfer_len = sgi->in_size;
|
|
@@ -217,8 +242,10 @@
|
|
if (status >= 0)
|
|
if (hdr->status)
|
|
status = check_sbp_error(hdr->sbp);
|
|
- if (status < 0)
|
|
+ if (status < 0) {
|
|
+ print_cmd_error(d, "writing", sgi->cmdp, sgi->cmd_len);
|
|
return TR_EWRITE;
|
|
+ }
|
|
}
|
|
if (!sgi->in_size | sgi->out_size) {
|
|
hdr->dxfer_len = sgi->out_size;
|
|
@@ -226,14 +253,18 @@
|
|
|
|
errno = 0;
|
|
status = ioctl(d->cdda_fd, SG_IO, hdr);
|
|
- if (status < 0)
|
|
+ if (status < 0) {
|
|
+ print_cmd_error(d, "reading", hdr->cmdp, hdr->cmd_len);
|
|
return TR_EREAD;
|
|
+ }
|
|
if (status >= 0)
|
|
if (hdr->status)
|
|
status = check_sbp_error(hdr->sbp);
|
|
}
|
|
- if (status)
|
|
+ if (status) {
|
|
+ print_cmd_error(d, "reading", hdr->cmdp, hdr->cmd_len);
|
|
return status;
|
|
+ }
|
|
|
|
errno = 0;
|
|
return 0;
|
|
@@ -352,6 +383,7 @@
|
|
struct sg_header *hdr = (struct sg_header *)sgi->hdr;
|
|
|
|
sgi->cmdp = (char *)hdr + sizeof (struct sg_header);
|
|
+ sgi->cmd_len = cmd_len;
|
|
memcpy(sgi->cmdp, cmdp, cmd_len);
|
|
|
|
sgi->dxferp = sgi->cmdp + cmd_len;
|