--------------2781446B794B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
OK, attached is a unified DIFF of the changes to sanei_scsi.c for the
0.62 release of SANE. These changes provide SCSI support for SGI IRIX
and seem to work with my MUSTEK MFS-6000CX.
I'd appreciate some feedback from other users with SGIs to see if they
experience any problems with the other scanner drivers.
Enjoy!
-- ________________________________________________________________________ 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
--------------2781446B794B Content-Type: text/plain; charset=us-ascii; name="irix.diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="irix.diffs"
--- sanei/sanei_scsi.c.orig Sat Jul 19 12:51:35 1997 +++ sanei/sanei_scsi.c Thu Jul 31 15:13:13 1997 @@ -60,8 +60,13 @@ #define HPUX_INTERFACE 3 #define OPENSTEP_INTERFACE 4 #define DECUNIX_INTERFACE 5 +#define IRIX_INTERFACE 6 +#define SOLARIS_INTERFACE 7 -#ifdef HAVE_SCSI_SG_H +#ifdef __sgi +# define USE IRIX_INTERFACE +# include <sys/dsreq.h> +#elif defined(HAVE_SCSI_SG_H) # define USE LINUX_INTERFACE # include <scsi/sg.h> #else @@ -288,6 +293,74 @@ } +#if USE == IRIX_INTERFACE +SANE_Status +sanei_scsi_cmd(int fd, + const void *src, + size_t src_size, + void *dst, + size_t *dst_size) +{ + dsreq_t scsi_req; /* SCSI request */ + unsigned 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)); + + 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); + } + 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); + }; + + if (dst_size != NULL) + *dst_size = scsi_req.ds_datasent; + + return (SANE_STATUS_GOOD); +} +#endif /* USE == IRIX_INTERFACE */ + #if USE == LINUX_INTERFACE #include <signal.h> @@ -424,6 +497,8 @@ *idp = req; return SANE_STATUS_GOOD; } + + SANE_Status sanei_scsi_req_wait (void *id)
--------------2781446B794B--
-- Source code, list archive, and docs: http://www.azstarnet.com/~axplinux/sane/ To unsubscribe: mail -s unsubscribe sane-devel-request@listserv.azstarnet.com