[sane-devel] GPL driver for Samsung SCX-4200 MFP

Vladimir Koutny vlado at sane.ksp.sk
Wed Nov 21 21:52:43 UTC 2007

Hi Abel,
> Great work! Having done some reverse engineering myself sone years ago,
> I believe that have an idea how much sweat you must have put into
> analyzing the data traffic.
> A small remark: The third byte of many commands you list on the web page
> seem to be SCSI commands:
> 06 - this one does not match...
> 12 - INQUIRY
> 28 - READ
> 31 - OBJECT POSITION (used to load or unload a sheet in the ADF)

Well, it is pretty well possible that it is based on this; however, I've
just tried some other scsi commands, and they don't work (namely: 00 -
test unit ready, 03 - request sense, 1D - send diagnostic) - there is no
answer from scanner for those :(

On the other hand, output of cmd12 can be somehow meaningfully matched
to what a scsi device should return ('SAMSUNG ', 'ORION   ', ... and
even those flags before these strings do make some sense..), and also
2nd byte of answers could be scsi status byte directly - 02 would be
'check condition' (ie some kind of error), 08 is 'busy' which matches
the semantics of 'read' that can't be finished at this time and should
be tried again...

So it is probably worth having a look at those scsi specs; however right
now the code ignores error responses at all, and as it is pretty stable
for my scx-4200 (I did get an error message only during my attempts to
format configuration command, and never afterwards) I'll rather look
first to other issues (like estimating pixel size of scanned area before
 we get all data or making a backend out of it ;)

But anyway, thanks for the pointers, maybe it will shed some more light
to this.. (I wouldn't even be surprised if it turns out to be the same
protocol as some other devices use - I have no idea what is currently
'out there', my last experience with scanners was good old hp scanjet :)


> You can find a general description of SCSI command here:
> http://t10.org/ftp/t10/drafts/s2/s2-r10l.pdf
> If my guess is right that these Samsung devices use SCSI commands, you
> might consider to issue a REQUEST SENSE command when a "regular" command
> fails with the (one-byte) status code "CHECK CONDITION". The sense data
> often give a better clue, what went wrong -- though without the
> documentation from Samsung it can be quite hard to figure out the
> meaning of some responses to REQUEST SENSE. Example: Some SCSI scanners
> call tell that the fuse of the stepper motor is blown. Though there are
> some quite useful generic error messages. IIRC, byte 16 and 17 of the
> REQUEST SENSE response often point to those byte of a command sent to
> the device that have an invalid value. Very handy for debugging :)
> Anyway, it is possible that I am writing nonsense (admittedly, I did not
> look into your source code, and I do not have a Samsung MFP and don't
> intend to buy one...) -- but if my guess is correct, I could send you
> some PDF files with the specs of some Fujitsu scanners and image files
> of the specs of some Sharp scanners. Might help you to figure out some
> details of the commands these Samsung devices expect.
> Abel

More information about the sane-devel mailing list