--------------28472C677566
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
(D'oh! Forgot to attach the diff...)
Unfortunately I didn't get the updated code to David soon enough...
Attached is a unified diff that will patch the SGI SCSI support to
work correctly on all systems (and prevents spurious error messages).
Also, I bumped the maximum SCSI transfer size (for IRIX) to 8MB. You
can make this larger, but the default maximum transfer size is 256MB
to 1GB (depending on the system).
Finally, for those of you that might be having trouble with SCSI
scanners and IRIX, you probably need to disable disconnects for that
particular device. This can be done by tweeking the SCSI config files
in /var/sysgen/master.d/wd93, wd95, or adp78.
Solaris support is next! :)
-- ________________________________________________________________________ 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
--------------28472C677566 Content-Type: text/plain; charset=us-ascii; name="sanei_scsi.diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sanei_scsi.diffs"
--- sanei_scsi.c.orig Tue Sep 23 05:51:15 1997 +++ sanei_scsi.c Tue Sep 23 05:51:19 1997 @@ -133,6 +133,8 @@ #else # ifdef __FreeBSD__ int sanei_scsi_max_request_size = 32 * 1024; /* FreeBSD is limited to this */ +# elif defined(__sgi) +int sanei_scsi_max_request_size = 8 * 1024 * 1024; /* Actually, the limit varies from 256MB to 1GB :) */ # else int sanei_scsi_max_request_size = 120 * 1024; /* works at least for OpenStep */ # endif @@ -846,62 +848,69 @@ #if USE == IRIX_INTERFACE SANE_Status -sanei_scsi_cmd(int fd, const void *src, size_t src_size, - void *dst, size_t *dst_size) +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 */ + size_t cdb_size; /* Size of SCSI command */ - cdb_size = CDB_SIZE (*(u_char *)src); - memset (&scsi_req, 0, sizeof (scsi_req)); + cdb_size = CDB_SIZE(*(u_char *)src); + memset(&scsi_req, 0, sizeof(scsi_req)); + if (dst != NULL) - { - /* - * SCSI command returning/reading data... - */ - scsi_req.ds_flags = DSRQ_READ | DSRQ_SENSE; - 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)dst; - scsi_req.ds_datalen = *dst_size; - scsi_req.ds_sensebuf = (caddr_t)sensebuf; - scsi_req.ds_senselen = sizeof(sensebuf); - } + { + /* + * SCSI command returning/reading data... + */ + + scsi_req.ds_flags = DSRQ_READ | DSRQ_SENSE; + 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)dst; + scsi_req.ds_datalen = *dst_size; + scsi_req.ds_sensebuf = (caddr_t)sensebuf; + scsi_req.ds_senselen = sizeof(sensebuf); + } else - { - /* - * SCSI command sending/writing data... - */ - scsi_req.ds_flags = DSRQ_WRITE | DSRQ_SENSE; - 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_datalen = src_size - cdb_size; - scsi_req.ds_sensebuf = (caddr_t)sensebuf; - scsi_req.ds_senselen = sizeof(sensebuf); - } - - if (ioctl(fd, DS_ENTER, &scsi_req) < 0 || scsi_req.ds_status != 0) - { - DBG(1, "sanei_scsi_cmd: SCSI command failed: %s\n", strerror(errno)); - - if (scsi_req.ds_status == STA_BUSY) - return SANE_STATUS_DEVICE_BUSY; - else if ((sensebuf[0] & 0x80) && fd_info[fd].sense_handler) - return (*fd_info[fd].sense_handler)(fd, sensebuf); - else - return SANE_STATUS_IO_ERROR; - } + { + /* + * SCSI command sending/writing data... + */ + + scsi_req.ds_flags = DSRQ_WRITE | DSRQ_SENSE; + 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_datalen = src_size - cdb_size; + scsi_req.ds_sensebuf = (caddr_t)sensebuf; + scsi_req.ds_senselen = sizeof(sensebuf); + } + + if (ioctl(fd, DS_ENTER, &scsi_req) < 0) + return (SANE_STATUS_IO_ERROR); if (dst_size != NULL) *dst_size = scsi_req.ds_datasent; - return SANE_STATUS_GOOD; + if (scsi_req.ds_status != 0) + { + if (scsi_req.ds_status == STA_BUSY) + return (SANE_STATUS_DEVICE_BUSY); + else if ((sensebuf[0] & 0x80) && fd_info[fd].sense_handler) + return (*fd_info[fd].sense_handler)(fd, sensebuf); + else + return (SANE_STATUS_IO_ERROR); + }; + + return (SANE_STATUS_GOOD); } #endif /* USE == IRIX_INTERFACE */
--------------28472C677566--
-- Source code, list archive, and docs: http://www.azstarnet.com/~axplinux/sane/ To unsubscribe: mail -s unsubscribe sane-devel-request@listserv.azstarnet.com