[sane-devel] Microtek ScanMaker 3800 backend: help?
Thu, 8 Apr 2004 19:04:13 +0200
On Wed, Apr 07, 2004 at 12:47:49PM -0700, Damjan Jovanovic wrote:
> Since there is no documentation provided on how the
> scanner works (commands used, etc), I am trying to
> figure that out. It isn't coming along too well,
> though. USB Snoopy somehow interferes with
> communication between the driver and the scanner to
> the point where nothing works, and Snoopy Pro even
> crashes Windows 98 (which doesn't surprise me :-). So
> I've tried a different approach.
An older version of "sniffusb" may also be worth a try.
> Now the scanner uses USB, and has 1 bulk-in, 1
> bulk-out, and 1 interrupt-in pipe.
All USB devices also have one control endpoint.
> ReadFile() and
> WriteFile() probably simply send data through the
> bulk pipes, right? But for the life of me, I can't
> figure out how DeviceIoControl() works - ie. what the
> different buffers and I/O codes do.
Maybe it uses the control endpoint. E.g. with gt68xx chips, every
command is sent through the control pipe. Only scan (and similar) data
is sent through the bulk pipes.
> 1. Are USB interrupt-in pipes ever used by scanners,
> and if so, for what? The scanner has buttons on the
> front - does the interrupt pipe maybe transfer button
> presses to the driver?
Yes. Some scanners use interrupt endpoints for buttons. I think
interrupt endpoints can also be used for scanners implementing a
SCSI-over-USB protocol as a signal that the command was executed
> 2. The scanner has an unlabelled port on the back that
> looks like this:
> . . . . . . . . (8 holes)
> . . . . . . . (7 holes)
> Is this a SCSI port by any chance?
I don't thinmk so. The cheaper SCSI ports are DB25 (13 + 12 pins).
It may be the connection to an optional transparency unit or automatic
> If so, is it a sure sign that the scanner uses SCSI-over-USB? If so,
> how are SCSI codes encoded into USB, and over which pipe(s) are they
As far as I know there is no fixed scheme. It's possible to just send
the SCSI commands as USB bulk transfers.
> (each letter is 1 byte)
> AA00 BB00 CCCC DD00 EFGx
> and as I best can tell:
> BB = size of byffer CCCC (from 1 to 32 bytes)
> CCCC = pointer to a buffer
> F = 0x40 for "writing" (scanner doesn't send anything
> F = 0xC0 for "reading" (scanner sends something back)
Have a look at the USB spec, especially concerning USB control
messages. 0x40 and 0xc0 are used as write and read identifiers there.
> What are AA, DD, and E, and how is a DeviceIoControl()
> request handled? I am guessing by means of USB control
> transfers, but what goes into the various USB control
> packet fields?
The other fields may be request, value and index as defined by the USB
spec. While there are some standard meanings, they are used just as
variables (e.g. for setting registers) in most scanners.