[sane-devel] Monolta Dimage Scan Dual II (avision backend)
Alex
tqzamf at googlemail.com
Wed Aug 5 12:58:57 BST 2026
Hi,
I recently acquired a Monolta Dimage Scan Dual II which would not scan
using SANE (1.2.1 in that case, but the relevant code is identical in
master). It would just hang when uploading the gamma table, then timeout
and abort the scan. The attached patch fixes scanning with my particular
device.
Comparison with the windows driver's USB bus traffic shows that my
particular unit needs to be sent 4096 bytes of gamma table. It reports
an ASIC of 3, i.e. AV_ASIC_C2, so SANE 1.2.1 sends it 512 bytes. This
write times out, and so do all further commands sent to the device
afterwards. I suspect the firmware ignores the length provided in the
send command and just expects 4096 bytes anyway? It would sure explain
the observed behavior since the next 3584 bytes of commands will be
interpreted as gamma table data instead...
In any case, setting gamma_table_raw_size = gamma_table_size = 4096 in
send_gamma() works and the device scans beautifully in 8-bit mode. In
the patch I set that for all AV_ASIC_C2 devices... Not sure if that's
safe to do, or if it's specific to this particular model and will break
other models.
12-bit mode didn't work properly (very strong banding). The related code
in reader_process() is clearly wrong: It's a 12- and 16-bit only
codepath, it produces a 16-bit sample... but then writes only a single
byte (lowest 8 bits) to the output buffer. The output buffer clearly
advances by 2 bytes per pixel, so I just made it write a 16-bit
host-endian pixel instead. Scanning then works perfectly in 12-bit mode
as well. That change should also fix 12- and 16-bit scanning for all
other avision devices (I don't see how any of them can scan correctly in
12- or 16-bit mode when only 8 bits of the sample data are written).
Please let me know if you need further information or need me to test
something.
Regards,
- Alex
PS: Sorry for reporting this the old-fashioned way. I don't have an
existing gitlab.com account, and their current verification process is
quite excessive IMHO.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avision.patch
Type: text/x-patch
Size: 619 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20260805/1a468f7f/attachment.bin>
More information about the sane-devel
mailing list