[sane-devel] Looking to add support for Avision AV50F plus scanner

Ralph Little skelband at gmail.com
Wed Sep 4 15:13:24 BST 2024


Hi,

On Wed, Sep 4, 2024 at 6:28 AM Ove Laurum <laurum.tech at gmail.com> wrote:

> Hello and thanks for your responses.
>
> The effort does not dissuade me, it will have to take the time it takes,
> in the meantime I will just have to retain a windows VM for using the
> scanner.
> ...
> Ralph, I was trying to find where the source code is, GIT hub? or
> somewhere else? so that I can take a look at the code for some examples of
> backends. I assume it's written in C.
> I found
> https://www.commandlinux.com/man-page/man-page/man-page/man5/sane-avision.5.html
>
> So I will start there trying to figure out how to read logs for the
> scanner as per your suggestion.
>
>
The SANE project is hosted at Gitlab, and you can find the source and
currently reported issues here: https://gitlab.com/sane-project/backends
The main website is here: http://www.sane-project.org/

The SANE code is divided up into two main repositories: backends and
frontends. You will find the backends contain all the code required to talk
to scanners.
Best way to start is to clone the backends repository and build it. On
Linux, building is fairly straightforward and there are instructions in the
INSTALL file.

If you wish to generate a log file from a backend, each backenc man page
does indeed contain instructions, but broadly each backend has its own
environment variable that can be used to get debug messages at various
numerical levels. One example might be:

SANE_DEBUG_AVISION=50 scanimage -d {your device} {other parameters etc}

Consult the man page (man sane-avision) for details as to what level of
diag corresponds to which number.

Personally, I would start with the avision backend. Many Avision devices
use the protocol that is supported by that backend but it is not guaranteed
in your case.
The backends are designed to support specific protocols and often these
protocols are shared amongst different manufacturers. Some scanners use
scanner-on-a-chip hardware (for example from Genesys) so a backend may
support a wide range of devices from different manufacturers. In other
cases, they are more manufacturer specific (like Canon with the pixma
backend for example).


> The other thing I will have to do is to trace a successful scan operation
> on Windows.
> My goto tracer would be wireshark, I know I can trace USB ports in Linux
> so I assume that is possible on Windows as well to get a trace of
> successful scanning.
> But is there a better tool to trace the USB traffic on Windows for the
> purpose of establishing some form of API?
>
>
Yes, we would usually do a scan on Windows and capture it using Wireshark.
I don't know of any particular analysis tools that could help you here. The
ones I have looked at I tend to print out and mark out with pen. Pretty old
school. If this device is supported by the avision backend, then I would
suspect that initial communications are pretty generic and get a little
more specific later on. On communications that I have seen, the early USB
exchanges establish the devices type and capabilities. The result of this
early exchange is output in the diag stream so would be a good place to
start.

I don't know the backend very well, but I probably would start with the
sane-avision man page and look into how to add the USB ids of your device
to the backend's code or config file and just give it a try, capturing some
detailed diag output. I would then study a trace gotten from a Windows scan
to see how to go from there. If you are stuck at this point, I can spend a
little time reminding myself how that backend works and help you out.

There is a bit of a steep learning curve and each backend has its own way
of doing things. Different scanners can have a completely different way of
working, some are fairly high level like avision and pixma, while others
are very low-level like genesys or rts8891.

Cheers,
Ralph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20240904/2f36b0c9/attachment.htm>


More information about the sane-devel mailing list