[sane-devel] genesys: how to add a new scanner?

Povilas Kanapickas povilas at radix.lt
Wed Dec 15 21:46:55 GMT 2021


Hi Wolfram,

On 12/14/21 8:35 PM, Wolfram Sang wrote:
> Hi all,
> 
> (I guess this is mainly for Povilas, though)
> 
> I had short access to a Plustek OpticBook 4600 scanner which is
> currently unsupported. 'sane-find-scanner' raises hopes that it might be
> easy to add:
> 
> found USB scanner (vendor=0x07b3 [PLUSTEK INC], product=0x0c26 [USB2.0 SCANNER], chip=GL843) at libusb:001:004
> 
> However, when digging into the genesys driver, it became obvious that in
> most cases just adding a USB ID is not enough. But how to continue from
> here? Snooping USB traffic from the Windows driver is not a problem if
> I'd know what to start looking for. Searching the bugreports in gitlab
> tells me that some more people would benefit from such information.

The genesys scanners work as follows: the host sets a number of
registers on the scanner, tells it to start scanning by a write to a
"special" register and then receives data by bulk transfers.

You definitely need access to USB traffic from windows to figure out
which registers get what values. At this point the genesys driver should
be flexible enough for you to add new register value sets without
additional refactoring.

This is the easy part. The most difficult part is figuring out what
special requirements are for different resolutions and how to interpret
the pixel data. In some cases the pixel shuffling is so complicated that
I've spent multiple days reverse-engineering that. Hopefully your
scanner won't do things like these.

> So, is there some documentation somewhere which explains the rough steps
> how to add a device to the genesys driver? Or is it possible to create
> one? So, I may try again once I get access to the scanner next time.

The best would be to check past commits and to look for all commits
mentioning a particular device name. You would get pretty good idea of
what code needs changing where.

See e.g. adaac29d90179e2e639c08ed0760d2125c4f9c19 or
6cb39e0a29142a832a6fe2ca772ff99be92d6a27 or
b0c42c0f5f525660dfc5ebe861ae0abb03ed744d.

Cheers,
Povilas



More information about the sane-devel mailing list