[sane-devel] Re: HP 4570c - progress report

Daniel Franke franke.daniel at gmail.com
Mon Sep 19 09:30:47 UTC 2005


On 9/18/05, Bertrik Sikken <bertrik at zonnet.nl> wrote:
> > I managed to reliably pass some bytes between my test program and 
> > the scanner. 
> > 
> > Already working: 
> >  * an answer to 0x1200 (version information of HP 5400 -- "SILITEKIElwood")
> >  * re-read the last command (0xc500, same as HP 5400)
> 
> Cool. :D.

Can add:
 * get on/off status (again, the same command as HP 5400)
 * switch on if off (dtio)

Working on:
 * initialize (preview-)scanning

> > An observation: 
> > Each command sequence has to be "terminated" by a null-byte, otherwise 
> > communication gets out of sync. A command sequence looks like ...
> >   - set up and write a "usb_ctrl_setup"-structure (defined in <usb.h>)
> >   - read the answer
> >   - send another '\0' to the device
> > 
> > Does this look familiar? 
> 
> No, does not look familiar to me, sorry.

Looking further: this null-byte seems to be some kind of ACK. If the
HOST reads from DEVICE, the HOST has to ACK that it got the data (send
a null-byte). OTOH, if the HOST sets a register (e.g. on/off status),
the DEVICE has to ACk that it got the value and that it was ok (?), so
the DEVICE sends the ACK, the HOST has to read it.

Seems to be part of the USB-over-USB protocol?!

 
> > Are there any other known HP5400 command bytes I could give a try?
> 
> Have a look at the #defines in backend/hp5400_internal.h from the
> sane-backends package.

Yes, I could identify some more shared commands, some of them marked
with "???" in hp5400_internals.h -- btw, if I get an idea what some of
these commands are meant to do, whom to tell? Who is the (official)
maintainer of the 5400-backend?

As an example, hp5400_internal.h:82: 
#define CMD_UNKNOWN3     0xC000        /* ??? Set to 02 03 03 3C */

If sending this command (with different bytes), the scanner is turned
on if it was off before. The lamp is switched on and it seems to
calibrate itself (the carriage is moving to some extend)?!


> A very cool thing to start with, is to try to switch the scanner
> lamp on or off. As far as I can tell from the hp5400 backend, this
> can be done with command 0x1BXX.

I'll give them a try ... IIRC, I've observed that at some point in the
logs 0x1b01 was sent to the device, but 0x1b00 was read when the
previous command was read back. I'll have to double check this.


> By the way: some scanners are not protected from moving the carriage
> beyond their physical limits. 

Jep, the HP4570c isn't ... boldly trying to mimic a preview scan
resulted in a carriage racing all the way from one end to the other
within two seconds. There was an awful sound, but it is still working
=)


One more question: I used a windows installation and snoopypro to get
a log of a preview scan - I'm missing the actual data?! Does snoopypro
not log the actual (image)data transfer?

Thanks for your help!

    Daniel



More information about the sane-devel mailing list