kopia lustrzana https://gitlab.com/sane-project/website
204 wiersze
6.9 KiB
HTML
204 wiersze
6.9 KiB
HTML
<!-- received="Sun Jun 15 16:39:53 1997 MST" -->
|
|
<!-- sent="Sun, 15 Jun 1997 16:33:29 -0700" -->
|
|
<!-- name="David Mosberger-Tang" -->
|
|
<!-- email="davidm@azstarnet.com" -->
|
|
<!-- subject="Re: Sane on NeXT/OpenStep - a plea for help" -->
|
|
<!-- id="199706152333.QAA22598@panda.mosberger" -->
|
|
<!-- inreplyto="86wwnwzecp.fsf@localhost.profitpress.com" -->
|
|
<title>sane-devel: Re: Sane on NeXT/OpenStep - a plea for help</title>
|
|
<h1>Re: Sane on NeXT/OpenStep - a plea for help</h1>
|
|
<b>David Mosberger-Tang</b> (<a href="mailto:davidm@azstarnet.com"><i>davidm@azstarnet.com</i></a>)<br>
|
|
<i>Sun, 15 Jun 1997 16:33:29 -0700</i>
|
|
<p>
|
|
<ul>
|
|
<li> <b>Messages sorted by:</b> <a href="date.html#97">[ date ]</a><a href="index.html#97">[ thread ]</a><a href="subject.html#97">[ subject ]</a><a href="author.html#97">[ author ]</a>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0098.html">Raymond A. Ingles: "Re: Sane on NeXT/OpenStep - a plea for help"</a>
|
|
<li> <b>Previous message:</b> <a href="0096.html">Gordon Matzigkeit: "Re: Sane on NeXT/OpenStep - a plea for help"</a>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
</ul>
|
|
<!-- body="start" -->
|
|
<i>>>>>> On 15 Jun 1997 17:12:59 -0600, Gordon Matzigkeit <<a href="mailto:gord@m-tech.ab.ca">gord@m-tech.ab.ca</a>> said:</i><br>
|
|
<p>
|
|
Gord> If you want to give me access to your OpenStep box, which you<br>
|
|
Gord> offered, then I would be more than happy to help port SANE to<br>
|
|
Gord> OpenStep. If you're interested, I like accounts named<br>
|
|
Gord> `gord'. ;)<br>
|
|
<p>
|
|
I already offered the same to Neville, but wouldn't mind if you'd take<br>
|
|
over. Here are the patches I have come up with based on the OpenStep<br>
|
|
version of pnmscan. They probably won't compile, but should be really<br>
|
|
close to what's needed.<br>
|
|
<p>
|
|
Happy hacking,<br>
|
|
<p>
|
|
--david<br>
|
|
<pre>
|
|
--
|
|
diff -urN sane-0.6/configure.in sane-0.61/configure.in
|
|
--- sane-0.6/configure.in Fri Jun 13 18:28:34 1997
|
|
+++ sane-0.61/configure.in Sun Jun 15 10:08:42 1997
|
|
@@ -31,7 +31,8 @@
|
|
dnl Checks for header files.
|
|
AC_HEADER_STDC
|
|
AC_CHECK_HEADERS(fcntl.h unistd.h libintl.h sys/scanio.h \
|
|
- scsi.h sys/scsi.h sys/scsiio.h scsi/sg.h /usr/src/linux/include/scsi/sg.h)
|
|
+ scsi.h sys/scsi.h sys/scsiio.h bsd/dev/scsireg.h \
|
|
+ scsi/sg.h /usr/src/linux/include/scsi/sg.h)
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
AC_C_CONST
|
|
diff -urN sane-0.6/include/sane/config.h.in sane-0.61/include/sane/config.h.in
|
|
--- sane-0.6/include/sane/config.h.in Fri Jun 13 18:51:05 1997
|
|
+++ sane-0.61/include/sane/config.h.in Sun Jun 15 10:09:39 1997
|
|
@@ -199,6 +199,9 @@
|
|
/* Define if you have the <sys/scanio.h> header file. */
|
|
#undef HAVE_SYS_SCANIO_H
|
|
|
|
+/* Define if you have the <bsd/dev/scsireg.h> header file. */
|
|
+#undef HAVE_BSD_DEV_SCSIREG_H
|
|
+
|
|
/* Define if you have the <unistd.h> header file. */
|
|
#undef HAVE_UNISTD_H
|
|
|
|
diff -urN sane-0.6/sanei/sanei_scsi.c sane-0.61/sanei/sanei_scsi.c
|
|
--- sane-0.6/sanei/sanei_scsi.c Sat Jun 14 14:33:48 1997
|
|
+++ sane-0.61/sanei/sanei_scsi.c Sun Jun 15 10:19:11 1997
|
|
@@ -44,6 +44,7 @@
|
|
|
|
#include <lalloca.h> /* MUST come first for AIX! */
|
|
|
|
+#include <assert.h>
|
|
#include <errno.h>
|
|
#include <fcntl.h>
|
|
#include <stdlib.h>
|
|
@@ -67,6 +68,9 @@
|
|
# ifdef HAVE_SCSI_H
|
|
# include <scsi.h>
|
|
# define scsireq_t struct scsireq_t
|
|
+# ifdef HAVE_BSD_DEV_SCSIREG_H
|
|
+# include <bsd/dev/scsireg.h>
|
|
+# endif
|
|
# endif
|
|
# endif
|
|
# endif
|
|
@@ -90,6 +94,8 @@
|
|
static int num_handlers_alloced = 0;
|
|
static SANEI_SCSI_Sense_Handler *sense_handler = 0;
|
|
|
|
+static u_char cdb_size[8] = {6, 10, 10, 12, 12, 12, 10, 10};
|
|
+#define CDB_SIZE(opcode) (((opcode) >> 5) & 7)
|
|
|
|
SANE_Status
|
|
sanei_scsi_open (const char * dev, int * fdp, SANEI_SCSI_Sense_Handler handler)
|
|
@@ -222,32 +228,30 @@
|
|
sanei_scsi_cmd (int fd, const void * src, size_t src_size,
|
|
void * dst, size_t * dst_size)
|
|
{
|
|
+ size_t cdb_size;
|
|
scsireq_t hdr;
|
|
- size_t cmd_len;
|
|
|
|
- cmd_len = ((u_char *) src)[0] == 0x55 ? 10 : 6;
|
|
+ cdb_size = CDB_SIZE (*(u_char *) src);
|
|
|
|
memset (&hdr, 0, sizeof (hdr));
|
|
- memcpy (hdr.cmd, src, cmd_len);
|
|
- src_size -= cmd_len;
|
|
- src = (char *) src + cmd_len;
|
|
-
|
|
if (*dst_size)
|
|
{
|
|
+ assert (cdb_size == src_size);
|
|
hdr.flags = SCCMD_READ;
|
|
hdr.databuf = dst;
|
|
}
|
|
else
|
|
{
|
|
+ assert (cdb_size <= src_size);
|
|
hdr.flags = SCCMD_WRITE;
|
|
- hdr.databuf = src;
|
|
+ hdr.databuf = (char *) src + cdb_size;
|
|
}
|
|
+ memcpy (hdr.cmd, src, cdb_size);
|
|
hdr.timeout = 60000; /* 1 minute timeout */
|
|
|
|
if (scsireq_enter (fd, &hdr) < 0)
|
|
{
|
|
- DBG(1, "sanei_scsi_cmd: scsi_reqenter() failed: %s\n",
|
|
- strerror (errno));
|
|
+ DBG(1, "sanei_scsi_cmd: scsi_reqenter() failed: %s\n", strerror (errno));
|
|
return SANE_STATUS_IO_ERROR;
|
|
}
|
|
|
|
@@ -301,6 +305,53 @@
|
|
return SANE_STATUS_UNSUPPORTED;
|
|
}
|
|
|
|
+# ifdef /* HAVE_BSD_DEV_SCSIREG_H */
|
|
+
|
|
+/* This is for NeXtStep/OpenStep and possibility other Mach 2.5 based
|
|
+ systems. */
|
|
+
|
|
+SANE_Status
|
|
+sanei_scsi_cmd (int fd, const void * src, size_t src_size,
|
|
+ void * dst, size_t * dst_size)
|
|
+{
|
|
+ struct scsi_req hdr;
|
|
+ size_t cdb_size;
|
|
+
|
|
+ cdb_size = CDB_SIZE (*(u_char *) src);
|
|
+
|
|
+ memset (&hdr, 0, sizeof (sr));
|
|
+ if (*dst_size)
|
|
+ {
|
|
+ assert (cdb_size == src_size);
|
|
+ hdr.sr_dma_dir = SR_DMA_RD;
|
|
+ hdr.sr_addr = dst;
|
|
+ hdr.sr_dma_max = dst_size;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ assert (cdb_size <= src_size);
|
|
+ hdr.sr_dma_dir = SR_DMA_WR;
|
|
+ hdr.sr_addr = (char *) src + cdb_size;
|
|
+ hdr.sr_dma_max = src_size - cdb_size;
|
|
+ }
|
|
+ memcpy (&hdr.sr_cdb, src, cdb_size);
|
|
+ hdr.sr_ioto = 60; /* I/O timeout in seconds */
|
|
+
|
|
+ if (ioctl (fd, SGIOCREQ, &hdr) == -1)
|
|
+ {
|
|
+ DBG(1, "sanei_scsi_cmd: ioctl(SGIOCREQ) failed: %s\n", strerror (errno));
|
|
+ return SANE_STATUS_IO_ERROR;
|
|
+ }
|
|
+ if (hdr.sr_io_status)
|
|
+ DBG(1, "sanei_scsi_cmd: SGIOCREQ completed with sr_io_status=%d\n",
|
|
+ hdr.sr_io_status);
|
|
+ if ((hdr.sr_sense[0] & 0x80)
|
|
+ && (fd < num_handlers_alloced) && sense_handler[fd])
|
|
+ return (*sense_handler[fd]) (fd, hdr.sense);
|
|
+ return SANE_STATUS_GOOD;
|
|
+}
|
|
+
|
|
+# endif /* !HAVE_BSD_DEV_SCSIREG_H */
|
|
# endif /* !HAVE_SYS_SCSI_H */
|
|
# endif /* !HAVE_SYS_SCSIIO_H */
|
|
#endif /* !HAVE_SCSI_SG_H */
|
|
<p>
|
|
<pre>
|
|
--
|
|
Source code, list archive, and docs: <a href="http://www.azstarnet.com/~axplinux/sane/">http://www.azstarnet.com/~axplinux/sane/</a>
|
|
To unsubscribe: mail -s unsubscribe <a href="mailto:sane-devel-request@listserv.azstarnet.com">sane-devel-request@listserv.azstarnet.com</a>
|
|
</pre>
|
|
<!-- body="end" -->
|
|
<p>
|
|
<ul>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0098.html">Raymond A. Ingles: "Re: Sane on NeXT/OpenStep - a plea for help"</a>
|
|
<li> <b>Previous message:</b> <a href="0096.html">Gordon Matzigkeit: "Re: Sane on NeXT/OpenStep - a plea for help"</a>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
</ul>
|