Annotation of /trunk/cdparanoia/patches/cdparanoia-3.9.8-sgio-louder.patch
Parent Directory | Revision Log
Revision 144 -
(hide annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 2281 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 2281 byte(s)
-import
1 | niro | 144 | --- cdparanoia-III-alpha9.8/interface/scsi_interface.c.louder 2004-04-23 12:18:20.561275440 -0400 |
2 | +++ cdparanoia-III-alpha9.8/interface/scsi_interface.c 2004-04-23 12:24:37.853918240 -0400 | ||
3 | @@ -197,16 +197,41 @@ | ||
4 | memset(hdr->dxferp, sgi->bytefill, sgi->dxferp_buffer_len); | ||
5 | memcpy(hdr->cmdp, cmdp, cmd_len); | ||
6 | |||
7 | - hdr->cmd_len = cmd_len; | ||
8 | + sgi->cmd_len = hdr->cmd_len = cmd_len; | ||
9 | |||
10 | sgi->in_size = in_size; | ||
11 | sgi->out_size = out_size; | ||
12 | } | ||
13 | |||
14 | +void print_cmd_error(cdrom_drive *d, char *direction, char *cmdp, int cmdlen) { | ||
15 | + unsigned char ebuf[1024], tmp[2]; | ||
16 | + int x=0; | ||
17 | + | ||
18 | + sprintf(ebuf, "\nError %s command: ", direction); | ||
19 | + cdmessage(d, ebuf); | ||
20 | + tmp[1] = 0; | ||
21 | + while (x < cmdlen) { | ||
22 | + if (x % 8 == 0) | ||
23 | + cdmessage(d, " "); | ||
24 | + if (x % 16 == 0) { | ||
25 | + cdmessage(d, "\n"); | ||
26 | + if (x+1 < cmdlen) | ||
27 | + cdmessage(d, "\t"); | ||
28 | + } | ||
29 | + tmp[0] = cmdp[x]; | ||
30 | + sprintf(ebuf, "%02x ", tmp[0]); | ||
31 | + cdmessage(d, ebuf); | ||
32 | + x++; | ||
33 | + } | ||
34 | + if (!(x % 16 == 0)) | ||
35 | + cdmessage(d, "\n"); | ||
36 | +} | ||
37 | + | ||
38 | static int sgio_handle_scsi_cmd(cdrom_drive *d) { | ||
39 | int status = 0; | ||
40 | struct sg_info *sgi = (struct sg_info *)d->sg; | ||
41 | struct sg_io_hdr *hdr = sgi->hdr; | ||
42 | + char ebuf[256]; | ||
43 | |||
44 | if (sgi->in_size) { | ||
45 | hdr->dxfer_len = sgi->in_size; | ||
46 | @@ -217,8 +242,10 @@ | ||
47 | if (status >= 0) | ||
48 | if (hdr->status) | ||
49 | status = check_sbp_error(hdr->sbp); | ||
50 | - if (status < 0) | ||
51 | + if (status < 0) { | ||
52 | + print_cmd_error(d, "writing", sgi->cmdp, sgi->cmd_len); | ||
53 | return TR_EWRITE; | ||
54 | + } | ||
55 | } | ||
56 | if (!sgi->in_size | sgi->out_size) { | ||
57 | hdr->dxfer_len = sgi->out_size; | ||
58 | @@ -226,14 +253,18 @@ | ||
59 | |||
60 | errno = 0; | ||
61 | status = ioctl(d->cdda_fd, SG_IO, hdr); | ||
62 | - if (status < 0) | ||
63 | + if (status < 0) { | ||
64 | + print_cmd_error(d, "reading", hdr->cmdp, hdr->cmd_len); | ||
65 | return TR_EREAD; | ||
66 | + } | ||
67 | if (status >= 0) | ||
68 | if (hdr->status) | ||
69 | status = check_sbp_error(hdr->sbp); | ||
70 | } | ||
71 | - if (status) | ||
72 | + if (status) { | ||
73 | + print_cmd_error(d, "reading", hdr->cmdp, hdr->cmd_len); | ||
74 | return status; | ||
75 | + } | ||
76 | |||
77 | errno = 0; | ||
78 | return 0; | ||
79 | @@ -352,6 +383,7 @@ | ||
80 | struct sg_header *hdr = (struct sg_header *)sgi->hdr; | ||
81 | |||
82 | sgi->cmdp = (char *)hdr + sizeof (struct sg_header); | ||
83 | + sgi->cmd_len = cmd_len; | ||
84 | memcpy(sgi->cmdp, cmdp, cmd_len); | ||
85 | |||
86 | sgi->dxferp = sgi->cmdp + cmd_len; |