OK, here is a unified diff patch that will fix the SCSI errors some
users were experiencing.
The problem was with the data directly following the SCSI command codes.
Depending on the command this data could be misaligned. The updated
code copies the command data (up to 64k worth) to a local buffer and
uses the copy.
-- ________________________________________________________________________ Mike Sweet Software for SGI and Sun Easy Software Products (301) 373-9603 Workstations 44145 Airport View Drive mike@easysw.com http://www.easysw.com Hollywood, Maryland 20636SUPPORT THE ANTI-SPAM AMENDMENT! - http://www.cauce.org --------------EB8B42D07B2F8F951CAE31A3 Content-Type: text/plain; charset=us-ascii; name="sanei_scsi.c.diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sanei_scsi.c.diffs"
--- sanei_scsi.c.orig Fri Oct 17 10:48:17 1997 +++ sanei_scsi.c Fri Oct 17 10:54:09 1997 @@ -1068,10 +1068,12 @@ sanei_scsi_cmd (int fd, const void *src, size_t src_size, void *dst, size_t *dst_size) { - dsreq_t scsi_req; /* SCSI request */ - u_char sensebuf[1024]; /* Request sense buffer */ - size_t cdb_size; /* Size of SCSI command */ + dsreq_t scsi_req; /* SCSI request */ + u_char sensebuf[1024], /* Request sense buffer */ + databuf[65536]; /* Command data buffer */ + size_t cdb_size; /* Size of SCSI command */ + cdb_size = CDB_SIZE(*(u_char *)src); memset(&scsi_req, 0, sizeof(scsi_req)); @@ -1099,10 +1101,16 @@ scsi_req.ds_time = 120 * 1000; scsi_req.ds_cmdbuf = (caddr_t)src; scsi_req.ds_cmdlen = cdb_size; - scsi_req.ds_databuf = (caddr_t)src + cdb_size; + scsi_req.ds_databuf = (caddr_t)databuf; scsi_req.ds_datalen = src_size - cdb_size; scsi_req.ds_sensebuf = (caddr_t)sensebuf; scsi_req.ds_senselen = sizeof (sensebuf); + + /* + * Copy data portion to local buffer to ensure 32-bit alignment... + */ + + memcpy(databuf, ((u_char)src) + cdb_size, src_size - cdb_size); } if (ioctl (fd, DS_ENTER, &scsi_req) < 0) return SANE_STATUS_IO_ERROR;
--------------EB8B42D07B2F8F951CAE31A3--
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com