Lines 2-11
Link Here
|
2 |
=================================================================== |
2 |
=================================================================== |
3 |
RCS file: /home/cvs/cdparanoia/interface/scsi_interface.c,v |
3 |
RCS file: /home/cvs/cdparanoia/interface/scsi_interface.c,v |
4 |
retrieving revision 1.1.1.1 |
4 |
retrieving revision 1.1.1.1 |
5 |
retrieving revision 1.6 |
5 |
retrieving revision 1.7 |
6 |
diff -u -r1.1.1.1 -r1.6 |
6 |
diff -u -r1.1.1.1 -r1.7 |
7 |
--- interface/scsi_interface.c 2003/01/05 09:46:26 1.1.1.1 |
7 |
--- interface/scsi_interface.c 2003/01/05 09:46:26 1.1.1.1 |
8 |
+++ interface/scsi_interface.c 2003/01/07 00:49:01 1.6 |
8 |
+++ interface/scsi_interface.c 2003/01/18 15:42:15 1.7 |
9 |
@@ -3,6 +3,8 @@ |
9 |
@@ -3,6 +3,8 @@ |
10 |
* Original interface.c Copyright (C) 1994-1997 |
10 |
* Original interface.c Copyright (C) 1994-1997 |
11 |
* Eissfeldt heiko@colossus.escape.de |
11 |
* Eissfeldt heiko@colossus.escape.de |
Lines 83-89
Link Here
|
83 |
static int handle_scsi_cmd(cdrom_drive *d, |
83 |
static int handle_scsi_cmd(cdrom_drive *d, |
84 |
unsigned int cmd_len, |
84 |
unsigned int cmd_len, |
85 |
unsigned int in_size, |
85 |
unsigned int in_size, |
86 |
@@ -284,6 +322,83 @@ |
86 |
@@ -284,6 +322,84 @@ |
87 |
return(0); |
87 |
return(0); |
88 |
} |
88 |
} |
89 |
|
89 |
|
Lines 92-98
Link Here
|
92 |
+ unsigned int cmd_len, |
92 |
+ unsigned int cmd_len, |
93 |
+ unsigned int out_size, |
93 |
+ unsigned int out_size, |
94 |
+ unsigned int in_size, |
94 |
+ unsigned int in_size, |
95 |
+ |
|
|
96 |
+ unsigned char bytefill, |
95 |
+ unsigned char bytefill, |
97 |
+ int bytecheck) { |
96 |
+ int bytecheck) { |
98 |
+ int result; |
97 |
+ int result; |
Lines 100-110
Link Here
|
100 |
+ bzero(&d->ccb->csio, sizeof(d->ccb->csio)); |
99 |
+ bzero(&d->ccb->csio, sizeof(d->ccb->csio)); |
101 |
+ |
100 |
+ |
102 |
+ memcpy(d->ccb->csio.cdb_io.cdb_bytes, d->sg_buffer, cmd_len); |
101 |
+ memcpy(d->ccb->csio.cdb_io.cdb_bytes, d->sg_buffer, cmd_len); |
|
|
102 |
+ |
103 |
+ if (bytecheck && out_size == 0) |
104 |
+ memset(d->sg_buffer, bytefill, in_size); |
105 |
+ |
103 |
+ cam_fill_csio(&d->ccb->csio, |
106 |
+ cam_fill_csio(&d->ccb->csio, |
104 |
+ /* retries */ 3, /* XXX */ |
107 |
+ /* retries */ 0, |
105 |
+ /* cbfcnp */ NULL, |
108 |
+ /* cbfcnp */ NULL, |
106 |
+ /* flags */ CAM_PASS_ERR_RECOVER | CAM_DEV_QFRZDIS | |
109 |
+ /* flags */ CAM_DEV_QFRZDIS | (out_size ? CAM_DIR_OUT : CAM_DIR_IN), |
107 |
+ (out_size ? CAM_DIR_OUT : CAM_DIR_IN), |
|
|
108 |
+ /* tag_action */ MSG_SIMPLE_Q_TAG, |
110 |
+ /* tag_action */ MSG_SIMPLE_Q_TAG, |
109 |
+ /* data_ptr */ out_size ? d->sg_buffer + cmd_len : d->sg_buffer, |
111 |
+ /* data_ptr */ out_size ? d->sg_buffer + cmd_len : d->sg_buffer, |
110 |
+ /* dxfer_len */ out_size ? out_size : in_size, |
112 |
+ /* dxfer_len */ out_size ? out_size : in_size, |
Lines 112-126
Link Here
|
112 |
+ /* cdb_len */ cmd_len, |
114 |
+ /* cdb_len */ cmd_len, |
113 |
+ /* timeout */ 60000); /* XXX */ |
115 |
+ /* timeout */ 60000); /* XXX */ |
114 |
+ |
116 |
+ |
115 |
+ if ((result = cam_send_ccb(d->dev, d->ccb)) < 0) |
117 |
+ if ((result = cam_send_ccb(d->dev, d->ccb)) < 0 || |
|
|
118 |
+ (d->ccb->ccb_h.status & CAM_STATUS_MASK) == 0 /* hack? */) |
116 |
+ return TR_EREAD; |
119 |
+ return TR_EREAD; |
117 |
+ |
120 |
+ |
118 |
+ if ((d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { |
121 |
+ if ((d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP && |
119 |
+ fprintf (stderr, "error returned from SCSI command:\n"); |
122 |
+ (d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR) { |
120 |
+ if ((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR) |
123 |
+ fprintf (stderr, "\t\terror returned from SCSI command:\n" |
121 |
+ scsi_sense_print (d->dev, &d->ccb->csio, stderr); |
124 |
+ "\t\tccb->ccb_h.status == %d\n", d->ccb->ccb_h.status); |
122 |
+ else |
|
|
123 |
+ fprintf (stderr, "ccb->ccb_h.status == %d\n", d->ccb->ccb_h.status); |
124 |
+ errno = EIO; |
125 |
+ errno = EIO; |
125 |
+ return TR_UNKNOWN; |
126 |
+ return TR_UNKNOWN; |
126 |
+ } |
127 |
+ } |
Lines 167-173
Link Here
|
167 |
/* Group 1 (10b) command */ |
168 |
/* Group 1 (10b) command */ |
168 |
|
169 |
|
169 |
static int mode_sense_atapi(cdrom_drive *d,int size,int page){ |
170 |
static int mode_sense_atapi(cdrom_drive *d,int size,int page){ |
170 |
@@ -833,30 +948,33 @@ |
171 |
@@ -833,30 +949,33 @@ |
171 |
while(1) { |
172 |
while(1) { |
172 |
if((err=map(d,(p?buffer:NULL),begin,sectors))){ |
173 |
if((err=map(d,(p?buffer:NULL),begin,sectors))){ |
173 |
if(d->report_all){ |
174 |
if(d->report_all){ |
Lines 210-216
Link Here
|
210 |
} |
211 |
} |
211 |
|
212 |
|
212 |
if(!d->error_retry)return(-7); |
213 |
if(!d->error_retry)return(-7); |
213 |
@@ -1307,6 +1425,7 @@ |
214 |
@@ -1307,6 +1426,7 @@ |
214 |
return; |
215 |
return; |
215 |
} |
216 |
} |
216 |
|
217 |
|
Lines 218-224
Link Here
|
218 |
static int check_atapi(cdrom_drive *d){ |
219 |
static int check_atapi(cdrom_drive *d){ |
219 |
int atapiret=-1; |
220 |
int atapiret=-1; |
220 |
int fd = d->cdda_fd; /* this is the correct fd (not ioctl_fd), as the |
221 |
int fd = d->cdda_fd; /* this is the correct fd (not ioctl_fd), as the |
221 |
@@ -1333,6 +1452,47 @@ |
222 |
@@ -1333,6 +1453,47 @@ |
222 |
} |
223 |
} |
223 |
} |
224 |
} |
224 |
|
225 |
|
Lines 266-272
Link Here
|
266 |
static int check_mmc(cdrom_drive *d){ |
267 |
static int check_mmc(cdrom_drive *d){ |
267 |
char *b; |
268 |
char *b; |
268 |
cdmessage(d,"\nChecking for MMC style command set...\n"); |
269 |
cdmessage(d,"\nChecking for MMC style command set...\n"); |
269 |
@@ -1379,6 +1539,7 @@ |
270 |
@@ -1379,6 +1540,7 @@ |
270 |
} |
271 |
} |
271 |
} |
272 |
} |
272 |
|
273 |
|
Lines 274-280
Link Here
|
274 |
/* request vendor brand and model */ |
275 |
/* request vendor brand and model */ |
275 |
unsigned char *scsi_inquiry(cdrom_drive *d){ |
276 |
unsigned char *scsi_inquiry(cdrom_drive *d){ |
276 |
memcpy(d->sg_buffer,(char[]){ 0x12,0,0,0,56,0},6); |
277 |
memcpy(d->sg_buffer,(char[]){ 0x12,0,0,0,56,0},6); |
277 |
@@ -1389,6 +1550,7 @@ |
278 |
@@ -1389,6 +1551,7 @@ |
278 |
} |
279 |
} |
279 |
return (d->sg_buffer); |
280 |
return (d->sg_buffer); |
280 |
} |
281 |
} |
Lines 282-288
Link Here
|
282 |
|
283 |
|
283 |
|
284 |
|
284 |
int scsi_init_drive(cdrom_drive *d){ |
285 |
int scsi_init_drive(cdrom_drive *d){ |
285 |
@@ -1458,8 +1620,12 @@ |
286 |
@@ -1458,8 +1621,12 @@ |
286 |
check_fua_bit(d); |
287 |
check_fua_bit(d); |
287 |
|
288 |
|
288 |
d->error_retry=1; |
289 |
d->error_retry=1; |