Skip to content
stefdev49 edited this page Feb 21, 2016 · 18 revisions

Welcome to the syseneg wiki!

Generating documentation

You can generate the internal documentation of the backend by running the doxygen command in the sane-backends/doc:

stefdev@Staros:~/git/sane-backends/doc$ doxygen  doxygen-genesys.conf

Then you'll have an genesys-html subdir which contains everything that has been documented in the genesys backend sources.

General process for modification

When modifying, you run the backend with full log enable. During a scan the full shadow registers are dumped. You then compare these values with registers values written for a reference scan extracted from the USB snoop. Then you have to understand each delta and modify code so it emits the right value for each register.

The analyze/scripts/relog.awk helps comparison between extracted data and genesys debug output by converting log messages in the same format than produced by the decoding scripts. So a simple diff will show the 'point on interest', ie different values that must be investigated.

Extracting data from logs

Pictures

Picture data read from scanner via bulk reads. The writing to motor register (0x0f) 'commits' the settings of the scan and actually starts scanning. So all reads after it are related to the same scan.

The typical pattern is starting motor, polling available data, and once data is available, read it.

Usually the scan ends with bit 0 of register 1 being set to 0:

.....
bulkRead(?R45?,12624)=0xec 0xec ....
.....
registerRead(0x01)=0xa3
registerWrite(0x01,0xa2)
.....

The analyze/scripts/log2bin.awk script parses a decoded log and extracts scan*.bin file containing the raw binary data.

You can create pnm files by adding a pnm header to the binary data:

echo "P5\n31008 48\n65535\n" > out.pnm
cat scan28.bin >>out.pnm

The format (P5 or P6), size and bit depth (65535 or 255) will depend on the scan settings. Getting a good picture of a known pattern is usefull to check to real dpi value of a scan.

Adding new devices

Common

Configuring build for development

By default internal genesys backend functions are private. During development if we want to write and compile small tests programs, when needs these functions to be exported. This export is triggered by defining UNIT_TESTING in cflags. Another usefull option is to enable full gdb debug symbols with -ggdb compiler option. A typical configuration of SANE's build for development is:

CFLAGS="-DUNIT_TESTING -ggdb" ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--libdir=/usr/lib64 \
--enable-parport-directio \
--enable-pnm-backend \
--enable-libusb_1_0 \
--enable-pthread \
--enable-locking \
--with-group=scanner \
--without-snmp

Skipping calibration

When adding a new scanner, calibration doesn't work yet as we focus on getting raw scan working first. To make the genesys backend skip the whole calibration process, just add GENESYS_FLAG_NO_CALIBRATION to the device flags in genesys_devices.c device entry.

GL124

GL124 devices

Clone this wiki locally