Re: Microtek Sane Backend

David Mosberger-Tang (
Tue, 18 Mar 1997 22:08:43 -0700

>>>>> On Tue, 18 Mar 1997 21:09:45 -0600 (CST), Nem W Schlecht <> said:

Nem> Just to let everybody on the list know.. I've gotten Jan S.'s
Nem> mtekscan command line program working and will soon start
Nem> working on a SANE backend. I've already started and am half
Nem> done with a port of the scsi stuff to my machine. One problem,
Nem> though. It appears that the Linux stuff is pretty low-level.
Nem> My stuff is actually pretty similar, but with one major
Nem> difference. There is a structure that is used for SCSI
Nem> communications, but it requires setting either a READ or WRITE
Nem> flag.

I just added generic SCSI support for HP-UX today (completely untested
though). I'm guessing it is similar to what SGI uses. Take a look at
what's below and see how close that is.


sanei_scsi_cmd (int fd, const void * src, size_t src_size,
		void * dst, size_t * dst_size)
  struct sctl_io hdr;

memset (&hdr, 0, sizeof (hdr)); memcpy (hdr.cdb, src, src_size); hdr.flags = (dst_size > 0) ? SCTL_READ : 0; hdr.cdb_length = src_size; = dst; hdr.data_length = *dst_size; hdr.max_msecs = 60000; /* 1 minute timeout */ if (ioctl (fd, SIOC_IO, &hdr) < 0) { DBG(1, "sanei_scsi_cmd: ioctl(SIOC_IO) failed: %s\n", strerror (errno)); return SANE_STATUS_IO_ERROR; } if (hdr.cdb_status) DBG(1, "sanei_scsi_cmd: SCSI completed with cdb_status=%d\n", hdr.cdb_status); *dst_size = hdr.data_xfer; return SANE_STATUS_GOOD; }

Source code, list archive, and docs:
To unsubscribe: mail -s unsubscribe