From 302276dc1b90cfc972fb726ca94a23b18f4b0088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Tue, 1 Feb 2022 15:24:35 +0100 Subject: New upstream version 1.1.1 --- backend/Makefile.am | 978 ++++++++++- backend/abaton.c | 2 +- backend/agfafocus.c | 2 +- backend/apple.c | 2 +- backend/artec.c | 2 +- backend/artec_eplus48u.c | 2 +- backend/as6e.c | 2 +- backend/avision.c | 168 +- backend/avision.h | 25 + backend/bh.c | 4 +- backend/canon-sane.c | 2 +- backend/canon630u.c | 4 +- backend/canon_dr-cmd.h | 10 +- backend/canon_dr.c | 203 ++- backend/canon_dr.conf.in | 4 + backend/canon_dr.h | 13 +- backend/canon_lide70-common.c | 2491 +++++++++++--------------- backend/canon_lide70.c | 4 +- backend/canon_pp.c | 2 +- backend/cardscan.c | 4 +- backend/coolscan.c | 2 +- backend/coolscan2.c | 2 +- backend/coolscan3.c | 2 +- backend/dc210.c | 2 +- backend/dc240.c | 2 +- backend/dc25.c | 2 +- backend/dell1600n_net.c | 2 +- backend/dmc.c | 2 +- backend/epjitsu.c | 4 +- backend/epson.c | 2 +- backend/epson2-io.c | 3 +- backend/epson2-ops.c | 33 +- backend/epson2.c | 16 +- backend/epson2_usb.c | 353 ++-- backend/epsonds-cmd.c | 254 ++- backend/epsonds-cmd.h | 2 +- backend/epsonds-jpeg.c | 311 ++-- backend/epsonds-jpeg.h | 6 +- backend/epsonds-net.c | 234 +++ backend/epsonds-net.h | 6 + backend/epsonds-ops.c | 34 +- backend/epsonds-ops.h | 1 + backend/epsonds-usb.c | 19 - backend/epsonds-usb.h | 3 - backend/epsonds.c | 2629 +++++++++++++++++++++++++--- backend/epsonds.conf.in | 5 +- backend/epsonds.h | 33 +- backend/escl.conf.in | 5 + backend/escl/escl.c | 45 +- backend/escl/escl.h | 4 + backend/escl/escl_capabilities.c | 111 +- backend/escl/escl_devices.c | 10 +- backend/escl/escl_jpeg.c | 53 +- backend/escl/escl_newjob.c | 12 + backend/escl/escl_reset.c | 10 +- backend/escl/escl_scan.c | 10 +- backend/escl/escl_status.c | 2 + backend/fujitsu.c | 6 +- backend/fujitsu.conf.in | 3 + backend/genesys.conf.in | 3 + backend/genesys/calibration.h | 21 - backend/genesys/command_set.h | 21 - backend/genesys/device.cpp | 21 - backend/genesys/device.h | 21 - backend/genesys/enums.cpp | 22 +- backend/genesys/enums.h | 25 +- backend/genesys/error.cpp | 21 - backend/genesys/error.h | 21 - backend/genesys/fwd.h | 21 - backend/genesys/genesys.cpp | 196 +-- backend/genesys/genesys.h | 23 +- backend/genesys/gl124.cpp | 46 +- backend/genesys/gl124.h | 21 - backend/genesys/gl124_registers.h | 21 - backend/genesys/gl646.cpp | 41 +- backend/genesys/gl646.h | 21 - backend/genesys/gl646_registers.h | 21 - backend/genesys/gl841.cpp | 230 +-- backend/genesys/gl841.h | 21 - backend/genesys/gl841_registers.h | 21 - backend/genesys/gl842.cpp | 9 +- backend/genesys/gl842.h | 21 - backend/genesys/gl842_registers.h | 21 - backend/genesys/gl843.cpp | 35 +- backend/genesys/gl843.h | 21 - backend/genesys/gl843_registers.h | 21 - backend/genesys/gl846.cpp | 58 +- backend/genesys/gl846.h | 21 - backend/genesys/gl846_registers.h | 21 - backend/genesys/gl847.cpp | 59 +- backend/genesys/gl847.h | 21 - backend/genesys/gl847_registers.h | 21 - backend/genesys/image.cpp | 21 - backend/genesys/image.h | 23 +- backend/genesys/image_buffer.cpp | 21 - backend/genesys/image_buffer.h | 21 - backend/genesys/image_pipeline.cpp | 102 +- backend/genesys/image_pipeline.h | 54 +- backend/genesys/image_pixel.cpp | 21 - backend/genesys/image_pixel.h | 23 +- backend/genesys/low.cpp | 59 +- backend/genesys/low.h | 22 +- backend/genesys/motor.cpp | 24 +- backend/genesys/motor.h | 21 - backend/genesys/register.h | 21 - backend/genesys/register_cache.h | 21 - backend/genesys/row_buffer.h | 21 - backend/genesys/scanner_interface.cpp | 21 - backend/genesys/scanner_interface.h | 21 - backend/genesys/scanner_interface_usb.cpp | 24 +- backend/genesys/scanner_interface_usb.h | 21 - backend/genesys/sensor.cpp | 21 - backend/genesys/sensor.h | 21 - backend/genesys/serialize.h | 23 +- backend/genesys/settings.cpp | 27 +- backend/genesys/settings.h | 40 +- backend/genesys/static_init.cpp | 32 +- backend/genesys/static_init.h | 21 - backend/genesys/status.cpp | 21 - backend/genesys/status.h | 21 - backend/genesys/tables_frontend.cpp | 21 - backend/genesys/tables_gpo.cpp | 36 +- backend/genesys/tables_model.cpp | 36 +- backend/genesys/tables_motor.cpp | 23 +- backend/genesys/tables_sensor.cpp | 103 +- backend/genesys/test_scanner_interface.cpp | 21 - backend/genesys/test_scanner_interface.h | 21 - backend/genesys/test_settings.cpp | 21 - backend/genesys/test_settings.h | 21 - backend/genesys/test_usb_device.cpp | 21 - backend/genesys/test_usb_device.h | 21 - backend/genesys/usb_device.cpp | 21 - backend/genesys/usb_device.h | 21 - backend/genesys/utilities.h | 23 +- backend/gphoto2.c | 2 +- backend/gt68xx.c | 26 +- backend/hp.c | 2 +- backend/hp3500.c | 2 +- backend/hp3900_sane.c | 2 +- backend/hp4200.c | 6 +- backend/hp5400_sane.c | 4 +- backend/hp5590.c | 4 +- backend/hpljm1005.c | 2 +- backend/hpsj5s.c | 4 +- backend/hs2p.c | 4 +- backend/ibm.c | 4 +- backend/kodak.c | 4 +- backend/kodakaio.c | 2 +- backend/kvs1025.c | 4 +- backend/kvs20xx.c | 2 +- backend/kvs40xx.c | 2 +- backend/leo.c | 4 +- backend/lexmark.c | 4 +- backend/ma1509.c | 4 +- backend/magicolor.c | 2 +- backend/matsushita.c | 4 +- backend/microtek.c | 3 +- backend/microtek2.c | 2 +- backend/mustek.c | 4 +- backend/mustek_pp.c | 2 +- backend/mustek_usb.c | 4 +- backend/mustek_usb2.c | 4 +- backend/nec.c | 2 +- backend/niash.c | 4 +- backend/p5.c | 4 +- backend/pie.c | 2 +- backend/pieusb.c | 7 +- backend/pieusb.conf.in | 6 +- backend/pieusb_specific.c | 2 +- backend/pint.c | 2 +- backend/pixma/pixma.c | 2 +- backend/pixma/pixma_common.c | 10 +- backend/plustek.c | 2 +- backend/plustek_pp.c | 2 +- backend/pnm.c | 4 +- backend/qcam.c | 2 +- backend/ricoh.c | 2 +- backend/ricoh2.c | 2 +- backend/rts8891.c | 4 +- backend/rts8891_low.c | 2 +- backend/rts88xx_lib.c | 2 +- backend/s9036.c | 2 +- backend/sceptre.c | 4 +- backend/sharp.c | 2 +- backend/sm3600-scanutil.c | 1 + backend/sm3600.c | 4 +- backend/sm3840.c | 2 +- backend/sp15c.c | 2 +- backend/st400.c | 2 +- backend/stv680.c | 4 +- backend/tamarack.c | 2 +- backend/teco1.c | 4 +- backend/teco2.c | 4 +- backend/teco3.c | 4 +- backend/test.c | 4 +- backend/u12.c | 2 +- backend/umax.c | 4 +- backend/umax1220u.c | 4 +- backend/umax_pp.c | 4 +- backend/umax_pp.h | 2 +- backend/v4l.c | 4 +- backend/xerox_mfp.c | 2 +- 202 files changed, 6251 insertions(+), 4534 deletions(-) (limited to 'backend') diff --git a/backend/Makefile.am b/backend/Makefile.am index 48a1393..e56e7f1 100644 --- a/backend/Makefile.am +++ b/backend/Makefile.am @@ -1,3 +1,4 @@ + ## Makefile.am -- an automake template for Makefile.in file ## Copyright (C) 2009 Chris Bagwell, Olaf Meeuwissen, and Sane Developers. ## @@ -251,7 +252,15 @@ libabaton_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=abaton nodist_libsane_abaton_la_SOURCES = abaton-s.c libsane_abaton_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=abaton libsane_abaton_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_abaton_la_LIBADD = $(COMMON_LIBS) libabaton.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_abaton_la_LIBADD = $(COMMON_LIBS) \ + libabaton.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += abaton.conf.in libagfafocus_la_SOURCES = agfafocus.c agfafocus.h @@ -260,7 +269,16 @@ libagfafocus_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=agfafocus nodist_libsane_agfafocus_la_SOURCES = agfafocus-s.c libsane_agfafocus_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=agfafocus libsane_agfafocus_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_agfafocus_la_LIBADD = $(COMMON_LIBS) libagfafocus.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_thread.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_agfafocus_la_LIBADD = $(COMMON_LIBS) \ + libagfafocus.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += agfafocus.conf.in libapple_la_SOURCES = apple.c apple.h @@ -269,7 +287,15 @@ libapple_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=apple nodist_libsane_apple_la_SOURCES = apple-s.c libsane_apple_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=apple libsane_apple_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_apple_la_LIBADD = $(COMMON_LIBS) libapple.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_apple_la_LIBADD = $(COMMON_LIBS) \ + libapple.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += apple.conf.in libartec_la_SOURCES = artec.c artec.h @@ -278,7 +304,15 @@ libartec_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=artec nodist_libsane_artec_la_SOURCES = artec-s.c libsane_artec_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) libsane_artec_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=artec -libsane_artec_la_LIBADD = $(COMMON_LIBS) libartec.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_artec_la_LIBADD = $(COMMON_LIBS) \ + libartec.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += artec.conf.in libartec_eplus48u_la_SOURCES = artec_eplus48u.c artec_eplus48u.h @@ -287,7 +321,15 @@ libartec_eplus48u_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=artec_eplus48u nodist_libsane_artec_eplus48u_la_SOURCES = artec_eplus48u-s.c libsane_artec_eplus48u_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=artec_eplus48u libsane_artec_eplus48u_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_artec_eplus48u_la_LIBADD = $(COMMON_LIBS) libartec_eplus48u.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo $(MATH_LIB) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMEG_LIBS) +libsane_artec_eplus48u_la_LIBADD = $(COMMON_LIBS) \ + libartec_eplus48u.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_thread.lo \ + $(MATH_LIB) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMEG_LIBS) EXTRA_DIST += artec_eplus48u.conf.in libas6e_la_SOURCES = as6e.c as6e.h @@ -304,7 +346,17 @@ libavision_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=avision nodist_libsane_avision_la_SOURCES = avision-s.c libsane_avision_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=avision libsane_avision_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_avision_la_LIBADD = $(COMMON_LIBS) libavision.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo ../sanei/sanei_scsi.lo $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_avision_la_LIBADD = $(COMMON_LIBS) \ + libavision.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_scsi.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += avision.conf.in libbh_la_SOURCES = bh.c bh.h @@ -313,7 +365,14 @@ libbh_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=bh nodist_libsane_bh_la_SOURCES = bh-s.c libsane_bh_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=bh libsane_bh_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_bh_la_LIBADD = $(COMMON_LIBS) libbh.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_bh_la_LIBADD = $(COMMON_LIBS) libbh.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += bh.conf.in libcanon_la_SOURCES = canon.c canon.h @@ -322,7 +381,14 @@ libcanon_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon nodist_libsane_canon_la_SOURCES = canon-s.c libsane_canon_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon libsane_canon_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_canon_la_LIBADD = $(COMMON_LIBS) libcanon.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(MATH_LIB) $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_canon_la_LIBADD = $(COMMON_LIBS) libcanon.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += canon.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += canon-sane.c canon-scsi.c @@ -333,7 +399,14 @@ libcanon630u_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon630u nodist_libsane_canon630u_la_SOURCES = canon630u-s.c libsane_canon630u_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon630u libsane_canon630u_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_canon630u_la_LIBADD = $(COMMON_LIBS) libcanon630u.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_canon630u_la_LIBADD = $(COMMON_LIBS) \ + libcanon630u.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += canon630u.conf.in # TODO: Why are this distributed but not compiled? EXTRA_DIST += canon630u-common.c lm9830.h @@ -344,7 +417,17 @@ libcanon_dr_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon_dr nodist_libsane_canon_dr_la_SOURCES = canon_dr-s.c libsane_canon_dr_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon_dr libsane_canon_dr_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_canon_dr_la_LIBADD = $(COMMON_LIBS) libcanon_dr.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_magic.lo $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) +libsane_canon_dr_la_LIBADD = $(COMMON_LIBS) \ + libcanon_dr.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_magic.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += canon_dr.conf.in libcanon_lide70_la_SOURCES = canon_lide70.c @@ -353,7 +436,14 @@ libcanon_lide70_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon_lide70 nodist_libsane_canon_lide70_la_SOURCES = canon_lide70-s.c libsane_canon_lide70_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon_lide70 libsane_canon_lide70_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_canon_lide70_la_LIBADD = $(COMMON_LIBS) libcanon_lide70.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_canon_lide70_la_LIBADD = $(COMMON_LIBS) \ + libcanon_lide70.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += canon_lide70.conf.in # TODO: Why are this distributed but not compiled? EXTRA_DIST += canon_lide70-common.c @@ -364,7 +454,13 @@ libcanon_pp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon_pp nodist_libsane_canon_pp_la_SOURCES = canon_pp-s.c libsane_canon_pp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=canon_pp libsane_canon_pp_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_canon_pp_la_LIBADD = $(COMMON_LIBS) libcanon_pp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(IEEE1284_LIBS) +libsane_canon_pp_la_LIBADD = $(COMMON_LIBS) \ + libcanon_pp.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(IEEE1284_LIBS) EXTRA_DIST += canon_pp.conf.in libcardscan_la_SOURCES = cardscan.c cardscan.h @@ -373,7 +469,14 @@ libcardscan_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=cardscan nodist_libsane_cardscan_la_SOURCES = cardscan-s.c libsane_cardscan_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=cardscan libsane_cardscan_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_cardscan_la_LIBADD = $(COMMON_LIBS) libcardscan.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(USB_LIBS) $(RESMGR_LIBS) +libsane_cardscan_la_LIBADD = $(COMMON_LIBS) \ + libcardscan.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += cardscan.conf.in libcoolscan_la_SOURCES = coolscan.c coolscan.h coolscan-scsidef.h @@ -382,7 +485,17 @@ libcoolscan_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=coolscan nodist_libsane_coolscan_la_SOURCES = coolscan-s.c libsane_coolscan_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=coolscan libsane_coolscan_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_coolscan_la_LIBADD = $(COMMON_LIBS) libcoolscan.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_thread.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_coolscan_la_LIBADD = $(COMMON_LIBS) \ + libcoolscan.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += coolscan.conf.in libcoolscan2_la_SOURCES = coolscan2.c @@ -391,7 +504,16 @@ libcoolscan2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=coolscan2 nodist_libsane_coolscan2_la_SOURCES = coolscan2-s.c libsane_coolscan2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=coolscan2 libsane_coolscan2_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_coolscan2_la_LIBADD = $(COMMON_LIBS) libcoolscan2.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_coolscan2_la_LIBADD = $(COMMON_LIBS) \ + libcoolscan2.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += coolscan2.conf.in libcoolscan3_la_SOURCES = coolscan3.c @@ -400,7 +522,16 @@ libcoolscan3_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=coolscan3 nodist_libsane_coolscan3_la_SOURCES = coolscan3-s.c libsane_coolscan3_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=coolscan3 libsane_coolscan3_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_coolscan3_la_LIBADD = $(COMMON_LIBS) libcoolscan3.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_coolscan3_la_LIBADD = $(COMMON_LIBS) \ + libcoolscan3.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += coolscan3.conf.in libdc25_la_SOURCES = dc25.c dc25.h @@ -409,7 +540,13 @@ libdc25_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dc25 nodist_libsane_dc25_la_SOURCES = dc25-s.c libsane_dc25_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dc25 libsane_dc25_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_dc25_la_LIBADD = $(COMMON_LIBS) libdc25.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(MATH_LIB) +libsane_dc25_la_LIBADD = $(COMMON_LIBS) \ + libdc25.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(MATH_LIB) EXTRA_DIST += dc25.conf.in libdc210_la_SOURCES = dc210.c dc210.h @@ -418,7 +555,13 @@ libdc210_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dc210 nodist_libsane_dc210_la_SOURCES = dc210-s.c libsane_dc210_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dc210 libsane_dc210_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_dc210_la_LIBADD = $(COMMON_LIBS) libdc210.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) +libsane_dc210_la_LIBADD = $(COMMON_LIBS) \ + libdc210.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) EXTRA_DIST += dc210.conf.in libdc240_la_SOURCES = dc240.c dc240.h @@ -427,7 +570,13 @@ libdc240_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dc240 nodist_libsane_dc240_la_SOURCES = dc240-s.c libsane_dc240_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dc240 libsane_dc240_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_dc240_la_LIBADD = $(COMMON_LIBS) libdc240.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) +libsane_dc240_la_LIBADD = $(COMMON_LIBS) \ + libdc240.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) EXTRA_DIST += dc240.conf.in libdell1600n_net_la_SOURCES = dell1600n_net.c @@ -436,7 +585,13 @@ libdell1600n_net_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dell1600n_net nodist_libsane_dell1600n_net_la_SOURCES = dell1600n_net-s.c libsane_dell1600n_net_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dell1600n_net libsane_dell1600n_net_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_dell1600n_net_la_LIBADD = $(COMMON_LIBS) libdell1600n_net.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(TIFF_LIBS) $(JPEG_LIBS) $(SOCKET_LIBS) +libsane_dell1600n_net_la_LIBADD = $(COMMON_LIBS) \ + libdell1600n_net.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(TIFF_LIBS) $(JPEG_LIBS) $(SOCKET_LIBS) EXTRA_DIST += dell1600n_net.conf.in libdmc_la_SOURCES = dmc.c dmc.h @@ -445,7 +600,15 @@ libdmc_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dmc nodist_libsane_dmc_la_SOURCES = dmc-s.c libsane_dmc_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dmc libsane_dmc_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_dmc_la_LIBADD = $(COMMON_LIBS) libdmc.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_dmc_la_LIBADD = $(COMMON_LIBS) \ + libdmc.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += dmc.conf.in if have_libavahi @@ -470,7 +633,14 @@ nodist_libsane_escl_la_SOURCES = escl-s.c libsane_escl_la_CPPFLAGS = $(AM_CPPFLAGS) $(JPEG_CFLAGS) $(PNG_CFLAGS) $(TIFF_CFLAGS) $(POPPLER_GLIB_CFLAGS) $(XML_CFLAGS) $(libcurl_CFLAGS) $(AVAHI_CFLAGS) -DBACKEND_NAME=escl libsane_escl_la_CFLAGS = $(AM_CFLAGS) $(JPEG_CFLAGS) $(PNG_CFLAGS) $(TIFF_CFLAGS) $(POPPLER_GLIB_CFLAGS) $(XML_CFLAGS) $(libcurl_CFLAGS) $(AVAHI_CFLAGS) -DBACKEND_NAME=escl libsane_escl_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_escl_la_LIBADD = $(COMMON_LIBS) libescl.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(MATH_LIB) $(JPEG_LIBS) $(PNG_LIBS) $(TIFF_LIBS) $(POPPLER_GLIB_LIBS) $(XML_LIBS) $(libcurl_LIBS) $(AVAHI_LIBS) +libsane_escl_la_LIBADD = $(COMMON_LIBS) \ + libescl.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(MATH_LIB) $(JPEG_LIBS) $(PNG_LIBS) $(TIFF_LIBS) $(POPPLER_GLIB_LIBS) \ + $(XML_LIBS) $(libcurl_LIBS) $(AVAHI_LIBS) endif endif endif @@ -482,7 +652,14 @@ libepjitsu_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=epjitsu nodist_libsane_epjitsu_la_SOURCES = epjitsu-s.c libsane_epjitsu_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=epjitsu libsane_epjitsu_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_epjitsu_la_LIBADD = $(COMMON_LIBS) libepjitsu.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_epjitsu_la_LIBADD = $(COMMON_LIBS) \ + libepjitsu.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += epjitsu.conf.in libepson_la_SOURCES = epson.c epson.h epson_scsi.c epson_scsi.h epson_usb.c epson_usb.h @@ -491,7 +668,17 @@ libepson_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=epson nodist_libsane_epson_la_SOURCES = epson-s.c libsane_epson_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=epson libsane_epson_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_epson_la_LIBADD = $(COMMON_LIBS) libepson.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pio.lo $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) +libsane_epson_la_LIBADD = $(COMMON_LIBS) \ + libepson.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_pio.lo \ + $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += epson.conf.in libepson2_la_SOURCES = epson2.c epson2.h epson2_scsi.c epson2_scsi.h epson2_usb.c epson2_net.c epson2_net.h epson2-io.c epson2-io.h epson2-commands.c epson2-commands.h epson2-ops.c epson2-ops.h epson2-cct.c @@ -500,7 +687,19 @@ libepson2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=epson2 nodist_libsane_epson2_la_SOURCES = epson2-s.c libsane_epson2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=epson2 libsane_epson2_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_epson2_la_LIBADD = $(COMMON_LIBS) libepson2.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo $(SCSI_LIBS) $(USB_LIBS) $(SOCKET_LIBS) $(MATH_LIB) $(RESMGR_LIBS) +libsane_epson2_la_LIBADD = $(COMMON_LIBS) \ + libepson2.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_pio.lo \ + ../sanei/sanei_tcp.lo \ + ../sanei/sanei_udp.lo \ + $(SCSI_LIBS) $(USB_LIBS) $(SOCKET_LIBS) $(MATH_LIB) $(RESMGR_LIBS) EXTRA_DIST += epson2.conf.in libepsonds_la_SOURCES = epsonds.c epsonds.h epsonds-usb.c epsonds-usb.h epsonds-io.c epsonds-io.h \ @@ -511,11 +710,20 @@ libepsonds_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=epsonds nodist_libsane_epsonds_la_SOURCES = epsonds-s.c libsane_epsonds_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=epsonds libsane_epsonds_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) + +if have_libavahi +libsane_epsonds_la_LIBADD = $(COMMON_LIBS) libepsonds.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo \ + ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo \ + ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo \ + $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) $(USB_LIBS) $(MATH_LIB) $(RESMGR_LIBS) $(SOCKET_LIBS) $(AVAHI_LIBS) +else libsane_epsonds_la_LIBADD = $(COMMON_LIBS) libepsonds.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo \ ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo \ ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo \ ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo \ $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) $(USB_LIBS) $(MATH_LIB) $(RESMGR_LIBS) $(SOCKET_LIBS) +endif EXTRA_DIST += epsonds.conf.in libfujitsu_la_SOURCES = fujitsu.c fujitsu.h fujitsu-scsi.h @@ -524,7 +732,17 @@ libfujitsu_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=fujitsu nodist_libsane_fujitsu_la_SOURCES = fujitsu-s.c libsane_fujitsu_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=fujitsu libsane_fujitsu_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_fujitsu_la_LIBADD = $(COMMON_LIBS) libfujitsu.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_magic.lo $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) +libsane_fujitsu_la_LIBADD = $(COMMON_LIBS) \ + libfujitsu.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_magic.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += fujitsu.conf.in libgenesys_la_SOURCES = genesys/genesys.cpp genesys/genesys.h \ @@ -577,8 +795,11 @@ nodist_libsane_genesys_la_SOURCES = genesys-s.cpp libsane_genesys_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=genesys libsane_genesys_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) libsane_genesys_la_LIBADD = $(COMMON_LIBS) libgenesys.la \ - ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo \ - ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ $(MATH_LIB) $(TIFF_LIBS) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += genesys.conf.in @@ -588,7 +809,13 @@ libgphoto2_i_la_CPPFLAGS = $(AM_CPPFLAGS) $(GPHOTO2_CPPFLAGS) -DBACKEND_NAME=gph nodist_libsane_gphoto2_la_SOURCES = gphoto2-s.c libsane_gphoto2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=gphoto2 libsane_gphoto2_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_gphoto2_la_LIBADD = $(GPHOTO2_LDFLAGS) $(COMMON_LIBS) libgphoto2_i.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(SANEI_SANEI_JPEG_LO) $(GPHOTO2_LIBS) $(JPEG_LIBS) +libsane_gphoto2_la_LIBADD = $(GPHOTO2_LDFLAGS) $(COMMON_LIBS) \ + libgphoto2_i.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(SANEI_SANEI_JPEG_LO) $(GPHOTO2_LIBS) $(JPEG_LIBS) EXTRA_DIST += gphoto2.conf.in libgt68xx_la_SOURCES = gt68xx.c gt68xx.h @@ -597,7 +824,14 @@ libgt68xx_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=gt68xx nodist_libsane_gt68xx_la_SOURCES = gt68xx-s.c libsane_gt68xx_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=gt68xx libsane_gt68xx_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_gt68xx_la_LIBADD = $(COMMON_LIBS) libgt68xx.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_gt68xx_la_LIBADD = $(COMMON_LIBS) \ + libgt68xx.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += gt68xx.conf.in # TODO: Why are this distributed but not compiled? EXTRA_DIST += gt68xx_devices.c gt68xx_generic.c gt68xx_generic.h gt68xx_gt6801.c gt68xx_gt6801.h gt68xx_gt6816.c gt68xx_gt6816.h gt68xx_high.c gt68xx_high.h gt68xx_low.c gt68xx_low.h gt68xx_mid.c gt68xx_mid.h gt68xx_shm_channel.c gt68xx_shm_channel.h @@ -608,7 +842,18 @@ libhp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp nodist_libsane_hp_la_SOURCES = hp-s.c libsane_hp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp libsane_hp_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hp_la_LIBADD = $(COMMON_LIBS) libhp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pio.lo ../sanei/sanei_thread.lo $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_hp_la_LIBADD = $(COMMON_LIBS) \ + libhp.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_pio.lo \ + ../sanei/sanei_thread.lo \ + $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += hp.conf.in # TODO: These should be moved to ../docs/hp; don't belong here. EXTRA_DIST += hp.README hp.TODO @@ -619,7 +864,15 @@ libhp3500_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp3500 nodist_libsane_hp3500_la_SOURCES = hp3500-s.c libsane_hp3500_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp3500 libsane_hp3500_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hp3500_la_LIBADD = $(COMMON_LIBS) libhp3500.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo $(MATH_LIB) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_hp3500_la_LIBADD = $(COMMON_LIBS) \ + libhp3500.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_thread.lo \ + $(MATH_LIB) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) libhp3900_la_SOURCES = hp3900.c libhp3900_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp3900 @@ -627,7 +880,14 @@ libhp3900_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp3900 nodist_libsane_hp3900_la_SOURCES = hp3900-s.c libsane_hp3900_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp3900 libsane_hp3900_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hp3900_la_LIBADD = $(COMMON_LIBS) libhp3900.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(TIFF_LIBS) $(USB_LIBS) $(RESMGR_LIBS) +libsane_hp3900_la_LIBADD = $(COMMON_LIBS) \ + libhp3900.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(TIFF_LIBS) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += hp3900.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += hp3900_config.c hp3900_debug.c hp3900_rts8822.c hp3900_sane.c hp3900_types.c hp3900_usb.c @@ -638,7 +898,15 @@ libhp4200_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp4200 nodist_libsane_hp4200_la_SOURCES = hp4200-s.c libsane_hp4200_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp4200 libsane_hp4200_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hp4200_la_LIBADD = $(COMMON_LIBS) libhp4200.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_pv8630.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_hp4200_la_LIBADD = $(COMMON_LIBS) \ + libhp4200.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_pv8630.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += hp4200.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += hp4200_lm9830.c hp4200_lm9830.h @@ -649,7 +917,14 @@ libhp5400_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp5400 nodist_libsane_hp5400_la_SOURCES = hp5400-s.c libsane_hp5400_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp5400 libsane_hp5400_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hp5400_la_LIBADD = $(COMMON_LIBS) libhp5400.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(USB_LIBS) $(RESMGR_LIBS) +libsane_hp5400_la_LIBADD = $(COMMON_LIBS) \ + libhp5400.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += hp5400.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += hp5400_debug.c hp5400_debug.h hp5400_internal.c hp5400_internal.h hp5400_sane.c hp5400_sanei.c hp5400_sanei.h hp5400_xfer.h @@ -660,7 +935,14 @@ libhp5590_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp5590 nodist_libsane_hp5590_la_SOURCES = hp5590-s.c libsane_hp5590_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hp5590 libsane_hp5590_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hp5590_la_LIBADD = $(COMMON_LIBS) libhp5590.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(USB_LIBS) $(RESMGR_LIBS) +libsane_hp5590_la_LIBADD = $(COMMON_LIBS) \ + libhp5590.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(RESMGR_LIBS) # TODO: Why are these distributed but not compiled? EXTRA_DIST += hp5590_cmds.c hp5590_cmds.h hp5590_low.c hp5590_low.h @@ -670,7 +952,14 @@ libhpljm1005_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hpljm1005 nodist_libsane_hpljm1005_la_SOURCES = hpljm1005-s.c libsane_hpljm1005_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hpljm1005 libsane_hpljm1005_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hpljm1005_la_LIBADD = $(COMMON_LIBS) libhpljm1005.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_hpljm1005_la_LIBADD = $(COMMON_LIBS) \ + libhpljm1005.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) libhpsj5s_la_SOURCES = hpsj5s.c hpsj5s.h libhpsj5s_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hpsj5s @@ -678,7 +967,13 @@ libhpsj5s_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hpsj5s nodist_libsane_hpsj5s_la_SOURCES = hpsj5s-s.c libsane_hpsj5s_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hpsj5s libsane_hpsj5s_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hpsj5s_la_LIBADD = $(COMMON_LIBS) libhpsj5s.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(IEEE1284_LIBS) +libsane_hpsj5s_la_LIBADD = $(COMMON_LIBS) \ + libhpsj5s.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(IEEE1284_LIBS) EXTRA_DIST += hpsj5s.conf.in libhs2p_la_SOURCES = hs2p.c hs2p.h hs2p-saneopts.h @@ -687,7 +982,15 @@ libhs2p_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hs2p nodist_libsane_hs2p_la_SOURCES = hs2p-s.c libsane_hs2p_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=hs2p libsane_hs2p_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_hs2p_la_LIBADD = $(COMMON_LIBS) libhs2p.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_hs2p_la_LIBADD = $(COMMON_LIBS) \ + libhs2p.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += hs2p.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += hs2p-scsi.c hs2p-scsi.h @@ -698,7 +1001,15 @@ libibm_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ibm nodist_libsane_ibm_la_SOURCES = ibm-s.c libsane_ibm_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ibm libsane_ibm_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_ibm_la_LIBADD = $(COMMON_LIBS) libibm.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_ibm_la_LIBADD = $(COMMON_LIBS) \ + libibm.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += ibm.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += ibm-scsi.c @@ -709,7 +1020,15 @@ libkodak_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=kodak nodist_libsane_kodak_la_SOURCES = kodak-s.c libsane_kodak_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=kodak libsane_kodak_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_kodak_la_LIBADD = $(COMMON_LIBS) libkodak.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) +libsane_kodak_la_LIBADD = $(COMMON_LIBS) \ + libkodak.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += kodak.conf.in libkodakaio_la_SOURCES = kodakaio.c kodakaio.h @@ -718,7 +1037,18 @@ libkodakaio_la_CPPFLAGS = $(AM_CPPFLAGS) $(AVAHI_CFLAGS) -DBACKEND_NAME=kodakaio nodist_libsane_kodakaio_la_SOURCES = kodakaio-s.c libsane_kodakaio_la_CPPFLAGS = $(AM_CPPFLAGS) $(AVAHI_CFLAGS) -DBACKEND_NAME=kodakaio libsane_kodakaio_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_kodakaio_la_LIBADD = $(COMMON_LIBS) libkodakaio.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo $(USB_LIBS) $(SOCKET_LIBS) $(AVAHI_LIBS) $(MATH_LIB) $(RESMGR_LIBS) +libsane_kodakaio_la_LIBADD = $(COMMON_LIBS) \ + libkodakaio.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_tcp.lo \ + ../sanei/sanei_udp.lo \ + $(USB_LIBS) $(SOCKET_LIBS) $(AVAHI_LIBS) $(MATH_LIB) $(RESMGR_LIBS) EXTRA_DIST += kodakaio.conf.in libkvs1025_la_SOURCES = kvs1025.c kvs1025_low.c kvs1025_opt.c kvs1025_usb.c \ @@ -728,7 +1058,15 @@ libkvs1025_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=kvs1025 nodist_libsane_kvs1025_la_SOURCES = kvs1025-s.c libsane_kvs1025_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=kvs1025 libsane_kvs1025_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_kvs1025_la_LIBADD = $(COMMON_LIBS) libkvs1025.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_magic.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_kvs1025_la_LIBADD = $(COMMON_LIBS) \ + libkvs1025.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_magic.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += kvs1025.conf.in libkvs20xx_la_SOURCES = kvs20xx.c kvs20xx_cmd.c kvs20xx_opt.c \ @@ -738,7 +1076,15 @@ libkvs20xx_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=kvs20xx nodist_libsane_kvs20xx_la_SOURCES = kvs20xx-s.c libsane_kvs20xx_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=kvs20xx libsane_kvs20xx_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_kvs20xx_la_LIBADD = $(COMMON_LIBS) libkvs20xx.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) +libsane_kvs20xx_la_LIBADD = $(COMMON_LIBS) \ + libkvs20xx.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) libkvs40xx_la_SOURCES = kvs40xx.c kvs40xx_cmd.c kvs40xx_opt.c \ kvs40xx.h @@ -747,7 +1093,15 @@ libkvs40xx_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=kvs40xx nodist_libsane_kvs40xx_la_SOURCES = kvs40xx-s.c libsane_kvs40xx_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=kvs40xx libsane_kvs40xx_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_kvs40xx_la_LIBADD = $(COMMON_LIBS) libkvs40xx.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(USB_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS) +libsane_kvs40xx_la_LIBADD = $(COMMON_LIBS) \ + libkvs40xx.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(USB_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS) libleo_la_SOURCES = leo.c leo.h libleo_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=leo @@ -755,7 +1109,15 @@ libleo_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=leo nodist_libsane_leo_la_SOURCES = leo-s.c libsane_leo_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=leo libsane_leo_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_leo_la_LIBADD = $(COMMON_LIBS) libleo.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_leo_la_LIBADD = $(COMMON_LIBS) \ + libleo.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += leo.conf.in liblexmark_la_SOURCES = lexmark.c lexmark.h lexmark_low.c @@ -764,7 +1126,14 @@ liblexmark_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=lexmark nodist_libsane_lexmark_la_SOURCES = lexmark-s.c libsane_lexmark_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=lexmark libsane_lexmark_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_lexmark_la_LIBADD = $(COMMON_LIBS) liblexmark.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(USB_LIBS) $(RESMGR_LIBS) +libsane_lexmark_la_LIBADD = $(COMMON_LIBS) \ + liblexmark.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += lexmark.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += lexmark_models.c lexmark_sensors.c @@ -775,7 +1144,14 @@ libma1509_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ma1509 nodist_libsane_ma1509_la_SOURCES = ma1509-s.c libsane_ma1509_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ma1509 libsane_ma1509_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_ma1509_la_LIBADD = $(COMMON_LIBS) libma1509.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(USB_LIBS) $(RESMGR_LIBS) +libsane_ma1509_la_LIBADD = $(COMMON_LIBS) \ + libma1509.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += ma1509.conf.in libmagicolor_la_SOURCES = magicolor.c magicolor.h @@ -784,7 +1160,18 @@ libmagicolor_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=magicolor $(SNMP_CFLAGS nodist_libsane_magicolor_la_SOURCES = magicolor-s.c libsane_magicolor_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=magicolor libsane_magicolor_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_magicolor_la_LIBADD = $(COMMON_LIBS) libmagicolor.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo $(USB_LIBS) $(SOCKET_LIBS) $(MATH_LIB) $(RESMGR_LIBS) $(SNMP_LIBS) +libsane_magicolor_la_LIBADD = $(COMMON_LIBS) \ + libmagicolor.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_tcp.lo \ + ../sanei/sanei_udp.lo \ + $(USB_LIBS) $(SOCKET_LIBS) $(MATH_LIB) $(RESMGR_LIBS) $(SNMP_LIBS) EXTRA_DIST += magicolor.conf.in libmatsushita_la_SOURCES = matsushita.c matsushita.h @@ -793,7 +1180,15 @@ libmatsushita_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=matsushita nodist_libsane_matsushita_la_SOURCES = matsushita-s.c libsane_matsushita_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=matsushita libsane_matsushita_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_matsushita_la_LIBADD = $(COMMON_LIBS) libmatsushita.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_matsushita_la_LIBADD = $(COMMON_LIBS) \ + libmatsushita.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += matsushita.conf.in libmicrotek_la_SOURCES = microtek.c microtek.h @@ -802,7 +1197,15 @@ libmicrotek_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=microtek nodist_libsane_microtek_la_SOURCES = microtek-s.c libsane_microtek_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=microtek libsane_microtek_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_microtek_la_LIBADD = $(COMMON_LIBS) libmicrotek.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(MATH_LIB) $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_microtek_la_LIBADD = $(COMMON_LIBS) \ + libmicrotek.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += microtek.conf.in libmicrotek2_la_SOURCES = microtek2.c microtek2.h @@ -811,7 +1214,16 @@ libmicrotek2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=microtek2 nodist_libsane_microtek2_la_SOURCES = microtek2-s.c libsane_microtek2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=microtek2 libsane_microtek2_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_microtek2_la_LIBADD = $(COMMON_LIBS) libmicrotek2.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo ../sanei/sanei_thread.lo $(MATH_LIB) $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_microtek2_la_LIBADD = $(COMMON_LIBS) \ + libmicrotek2.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_thread.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += microtek2.conf.in libmustek_la_SOURCES = mustek.c mustek.h @@ -820,7 +1232,18 @@ libmustek_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=mustek nodist_libsane_mustek_la_SOURCES = mustek-s.c libsane_mustek_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=mustek libsane_mustek_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_mustek_la_LIBADD = $(COMMON_LIBS) libmustek.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo ../sanei/sanei_thread.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pa4s2.lo $(IEEE1284_LIBS) $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_mustek_la_LIBADD = $(COMMON_LIBS) \ + libmustek.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_ab306.lo \ + ../sanei/sanei_pa4s2.lo \ + $(IEEE1284_LIBS) $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += mustek.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += mustek_scsi_pp.c mustek_scsi_pp.h @@ -831,7 +1254,14 @@ libmustek_pp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=mustek_pp nodist_libsane_mustek_pp_la_SOURCES = mustek_pp-s.c libsane_mustek_pp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=mustek_pp libsane_mustek_pp_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_mustek_pp_la_LIBADD = $(COMMON_LIBS) libmustek_pp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_pa4s2.lo $(MATH_LIB) $(IEEE1284_LIBS) +libsane_mustek_pp_la_LIBADD = $(COMMON_LIBS) \ + libmustek_pp.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_pa4s2.lo \ + $(MATH_LIB) $(IEEE1284_LIBS) EXTRA_DIST += mustek_pp.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += mustek_pp_ccd300.c mustek_pp_ccd300.h mustek_pp_cis.c mustek_pp_cis.h mustek_pp_null.c @@ -842,7 +1272,14 @@ libmustek_usb_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=mustek_usb nodist_libsane_mustek_usb_la_SOURCES = mustek_usb-s.c libsane_mustek_usb_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=mustek_usb libsane_mustek_usb_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_mustek_usb_la_LIBADD = $(COMMON_LIBS) libmustek_usb.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(USB_LIBS) $(RESMGR_LIBS) +libsane_mustek_usb_la_LIBADD = $(COMMON_LIBS) \ + libmustek_usb.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += mustek_usb.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += mustek_usb_high.c mustek_usb_high.h mustek_usb_low.c mustek_usb_low.h mustek_usb_mid.c mustek_usb_mid.h @@ -853,7 +1290,14 @@ libmustek_usb2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=mustek_usb2 nodist_libsane_mustek_usb2_la_SOURCES = mustek_usb2-s.c libsane_mustek_usb2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=mustek_usb2 libsane_mustek_usb2_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_mustek_usb2_la_LIBADD = $(COMMON_LIBS) libmustek_usb2.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(PTHREAD_LIBS) $(USB_LIBS) $(RESMGR_LIBS) +libsane_mustek_usb2_la_LIBADD = $(COMMON_LIBS) \ + libmustek_usb2.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(PTHREAD_LIBS) $(USB_LIBS) $(RESMGR_LIBS) # TODO: Why are these distributed but not compiled? EXTRA_DIST += mustek_usb2_asic.c mustek_usb2_asic.h mustek_usb2_high.c mustek_usb2_high.h mustek_usb2_reflective.c mustek_usb2_transparent.c @@ -863,7 +1307,15 @@ libnec_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=nec nodist_libsane_nec_la_SOURCES = nec-s.c libsane_nec_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=nec libsane_nec_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_nec_la_LIBADD = $(COMMON_LIBS) libnec.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(MATH_LIB) $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_nec_la_LIBADD = $(COMMON_LIBS) \ + libnec.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += nec.conf.in libnet_la_SOURCES = net.c net.h @@ -872,7 +1324,16 @@ libnet_la_CPPFLAGS = $(AM_CPPFLAGS) $(AVAHI_CFLAGS) -DBACKEND_NAME=net nodist_libsane_net_la_SOURCES = net-s.c libsane_net_la_CPPFLAGS = $(AM_CPPFLAGS) $(AVAHI_CFLAGS) -DBACKEND_NAME=net libsane_net_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_net_la_LIBADD = $(COMMON_LIBS) libnet.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo $(AVAHI_LIBS) $(SOCKET_LIBS) +libsane_net_la_LIBADD = $(COMMON_LIBS) \ + libnet.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_net.lo \ + ../sanei/sanei_wire.lo \ + ../sanei/sanei_codec_bin.lo \ + $(AVAHI_LIBS) $(SOCKET_LIBS) EXTRA_DIST += net.conf.in libniash_la_SOURCES = niash.c @@ -881,7 +1342,14 @@ libniash_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=niash nodist_libsane_niash_la_SOURCES = niash-s.c libsane_niash_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=niash libsane_niash_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_niash_la_LIBADD = $(COMMON_LIBS) libniash.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_niash_la_LIBADD = $(COMMON_LIBS) \ + libniash.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) # TODO: Why are these distributed but not compiled? EXTRA_DIST += niash_core.c niash_core.h niash_xfer.c niash_xfer.h @@ -891,7 +1359,16 @@ libpie_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pie nodist_libsane_pie_la_SOURCES = pie-s.c libsane_pie_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pie libsane_pie_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_pie_la_LIBADD = $(COMMON_LIBS) libpie.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo ../sanei/sanei_thread.lo $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_pie_la_LIBADD = $(COMMON_LIBS) \ + libpie.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_thread.lo \ + $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += pie.conf.in libpieusb_la_SOURCES = pieusb.h pieusb_buffer.c pieusb_buffer.h pieusb_scancmd.c pieusb_scancmd.h pieusb_specific.c pieusb_specific.h pieusb_usb.c pieusb_usb.h pieusb.c @@ -900,7 +1377,19 @@ libpieusb_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pieusb nodist_libsane_pieusb_la_SOURCES = pieusb-s.c libsane_pieusb_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pieusb libsane_pieusb_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_pieusb_la_LIBADD = $(COMMON_LIBS) libpieusb.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo ../sanei/sanei_thread.lo ../sanei/sanei_usb.lo ../sanei/sanei_ir.lo ../sanei/sanei_magic.lo $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) $(USB_LIBS) $(MATH_LIB) +libsane_pieusb_la_LIBADD = $(COMMON_LIBS) \ + libpieusb.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_ir.lo \ + ../sanei/sanei_magic.lo \ + $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) $(USB_LIBS) $(MATH_LIB) EXTRA_DIST += pieusb.conf.in libp5_la_SOURCES = p5.c p5.h p5_device.h @@ -909,7 +1398,13 @@ libp5_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=p5 nodist_libsane_p5_la_SOURCES = p5-s.c libsane_p5_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=p5 libsane_p5_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_p5_la_LIBADD = $(COMMON_LIBS) libp5.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo +libsane_p5_la_LIBADD = $(COMMON_LIBS) \ + libp5.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo + EXTRA_DIST += p5.conf.in p5_device.c libpint_la_SOURCES = pint.c pint.h @@ -918,7 +1413,12 @@ libpint_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pint nodist_libsane_pint_la_SOURCES = pint-s.c libsane_pint_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pint libsane_pint_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_pint_la_LIBADD = $(COMMON_LIBS) libpint.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo +libsane_pint_la_LIBADD = $(COMMON_LIBS) \ + libpint.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo libpixma_la_SOURCES = pixma/pixma.c \ pixma/pixma.h \ @@ -961,7 +1461,15 @@ CLEANFILES += pixma/pixma_sane_options.h nodist_libsane_pixma_la_SOURCES = pixma-s.c libsane_pixma_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pixma libsane_pixma_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_pixma_la_LIBADD = $(COMMON_LIBS) libpixma.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) $(XML_LIBS) $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_pixma_la_LIBADD = $(COMMON_LIBS) \ + libpixma.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_thread.lo \ + $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) $(XML_LIBS) $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += pixma.conf.in libplustek_la_SOURCES = plustek.c plustek.h @@ -970,7 +1478,17 @@ libplustek_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=plustek nodist_libsane_plustek_la_SOURCES = plustek-s.c libsane_plustek_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=plustek libsane_plustek_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_plustek_la_LIBADD = $(COMMON_LIBS) libplustek.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo $(MATH_LIB) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_plustek_la_LIBADD = $(COMMON_LIBS) \ + libplustek.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_lm983x.lo \ + ../sanei/sanei_access.lo \ + $(MATH_LIB) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += plustek.conf.in EXTRA_DIST += plustek-usb.c plustek-usb.h plustek-usbcal.c plustek-usbcalfile.c plustek-usbdevs.c plustek-usbhw.c plustek-usbimg.c plustek-usbio.c plustek-usbmap.c plustek-usbscan.c plustek-usbshading.c @@ -991,7 +1509,12 @@ libpnm_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pnm nodist_libsane_pnm_la_SOURCES = pnm-s.c libsane_pnm_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pnm libsane_pnm_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_pnm_la_LIBADD = $(COMMON_LIBS) libpnm.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo +libsane_pnm_la_LIBADD = $(COMMON_LIBS) \ + libpnm.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo libqcam_la_SOURCES = qcam.c qcam.h libqcam_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=qcam @@ -999,7 +1522,14 @@ libqcam_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=qcam nodist_libsane_qcam_la_SOURCES = qcam-s.c libsane_qcam_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=qcam libsane_qcam_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_qcam_la_LIBADD = $(COMMON_LIBS) libqcam.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_pio.lo +libsane_qcam_la_LIBADD = $(COMMON_LIBS) \ + libqcam.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_pio.lo + EXTRA_DIST += qcam.conf.in libricoh_la_SOURCES = ricoh.c ricoh.h @@ -1008,7 +1538,15 @@ libricoh_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ricoh nodist_libsane_ricoh_la_SOURCES = ricoh-s.c libsane_ricoh_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ricoh libsane_ricoh_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_ricoh_la_LIBADD = $(COMMON_LIBS) libricoh.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_ricoh_la_LIBADD = $(COMMON_LIBS) \ + libricoh.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += ricoh.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += ricoh-scsi.c @@ -1019,7 +1557,14 @@ libricoh2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ricoh2 nodist_libsane_ricoh2_la_SOURCES = ricoh2-s.c libsane_ricoh2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ricoh2 libsane_ricoh2_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_ricoh2_la_LIBADD = $(COMMON_LIBS) libricoh2.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_usb.lo ../sanei/sanei_config.lo sane_strstatus.lo $(USB_LIBS) +libsane_ricoh2_la_LIBADD = $(COMMON_LIBS) \ + libricoh2.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(USB_LIBS) EXTRA_DIST += ricoh2_buffer.c librts8891_la_SOURCES = rts8891.c rts8891.h rts88xx_lib.c rts88xx_lib.h @@ -1028,7 +1573,15 @@ librts8891_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=rts8891 nodist_libsane_rts8891_la_SOURCES = rts8891-s.c libsane_rts8891_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=rts8891 libsane_rts8891_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_rts8891_la_LIBADD = $(COMMON_LIBS) librts8891.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_scsi.lo ../sanei/sanei_usb.lo $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) $(RESMGR_LIBS) +libsane_rts8891_la_LIBADD = $(COMMON_LIBS) \ + librts8891.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_usb.lo \ + $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS) $(RESMGR_LIBS) EXTRA_DIST += rts8891.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += rts8891_devices.c rts8891_low.c rts8891_low.h @@ -1039,7 +1592,15 @@ libs9036_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=s9036 nodist_libsane_s9036_la_SOURCES = s9036-s.c libsane_s9036_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=s9036 libsane_s9036_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_s9036_la_LIBADD = $(COMMON_LIBS) libs9036.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_s9036_la_LIBADD = $(COMMON_LIBS) \ + libs9036.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += s9036.conf.in libsceptre_la_SOURCES = sceptre.c sceptre.h @@ -1048,7 +1609,15 @@ libsceptre_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sceptre nodist_libsane_sceptre_la_SOURCES = sceptre-s.c libsane_sceptre_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sceptre libsane_sceptre_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_sceptre_la_LIBADD = $(COMMON_LIBS) libsceptre.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_sceptre_la_LIBADD = $(COMMON_LIBS) \ + libsceptre.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += sceptre.conf.in libsharp_la_SOURCES = sharp.c sharp.h @@ -1057,7 +1626,15 @@ libsharp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sharp nodist_libsane_sharp_la_SOURCES = sharp-s.c libsane_sharp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sharp libsane_sharp_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_sharp_la_LIBADD = $(COMMON_LIBS) libsharp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(MATH_LIB) $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_sharp_la_LIBADD = $(COMMON_LIBS) \ + libsharp.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += sharp.conf.in libsm3600_la_SOURCES = sm3600.c sm3600.h @@ -1066,7 +1643,14 @@ libsm3600_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sm3600 nodist_libsane_sm3600_la_SOURCES = sm3600-s.c libsane_sm3600_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sm3600 libsane_sm3600_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_sm3600_la_LIBADD = $(COMMON_LIBS) libsm3600.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(USB_LIBS) $(RESMGR_LIBS) +libsane_sm3600_la_LIBADD = $(COMMON_LIBS) \ + libsm3600.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(RESMGR_LIBS) # TODO: Why are these distributed but not compiled? EXTRA_DIST += sm3600-color.c sm3600-gray.c sm3600-homerun.c sm3600-scanmtek.c sm3600-scantool.h sm3600-scanusb.c sm3600-scanutil.c @@ -1076,7 +1660,14 @@ libsm3840_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sm3840 nodist_libsane_sm3840_la_SOURCES = sm3840-s.c libsane_sm3840_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sm3840 libsane_sm3840_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_sm3840_la_LIBADD = $(COMMON_LIBS) libsm3840.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_sm3840_la_LIBADD = $(COMMON_LIBS) \ + libsm3840.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += sm3840.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += sm3840_lib.c sm3840_lib.h sm3840_scan.c @@ -1087,7 +1678,17 @@ libsnapscan_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=snapscan nodist_libsane_snapscan_la_SOURCES = snapscan-s.c libsane_snapscan_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=snapscan libsane_snapscan_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_snapscan_la_LIBADD = $(COMMON_LIBS) libsnapscan.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo ../sanei/sanei_scsi.lo $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_snapscan_la_LIBADD = $(COMMON_LIBS) \ + libsnapscan.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_scsi.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += snapscan.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += snapscan-data.c snapscan-mutex.c snapscan-options.c snapscan-scsi.c snapscan-sources.c snapscan-sources.h snapscan-usb.c snapscan-usb.h @@ -1098,16 +1699,34 @@ libsp15c_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sp15c nodist_libsane_sp15c_la_SOURCES = sp15c-s.c libsane_sp15c_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=sp15c libsane_sp15c_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_sp15c_la_LIBADD = $(COMMON_LIBS) libsp15c.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_thread.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_sp15c_la_LIBADD = $(COMMON_LIBS) \ + libsp15c.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += sp15c.conf.in libst400_la_SOURCES = st400.c st400.h libst400_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=st400 nodist_libsane_st400_la_SOURCES = st400-s.c ../sanei/sanei_scsi.lo + libsane_st400_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=st400 libsane_st400_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_st400_la_LIBADD = $(COMMON_LIBS) libst400.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_st400_la_LIBADD = $(COMMON_LIBS) \ + libst400.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += st400.conf.in libstv680_la_SOURCES = stv680.c stv680.h @@ -1116,7 +1735,14 @@ libstv680_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=stv680 nodist_libsane_stv680_la_SOURCES = stv680-s.c libsane_stv680_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=stv680 libsane_stv680_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_stv680_la_LIBADD = $(COMMON_LIBS) libstv680.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo $(USB_LIBS) $(RESMGR_LIBS) +libsane_stv680_la_LIBADD = $(COMMON_LIBS) \ + libstv680.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += stv680.conf.in libtamarack_la_SOURCES = tamarack.c tamarack.h @@ -1125,7 +1751,16 @@ libtamarack_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=tamarack nodist_libsane_tamarack_la_SOURCES = tamarack-s.c libsane_tamarack_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=tamarack libsane_tamarack_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_tamarack_la_LIBADD = $(COMMON_LIBS) libtamarack.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_thread.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_tamarack_la_LIBADD = $(COMMON_LIBS) \ + libtamarack.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += tamarack.conf.in libtest_la_SOURCES = test.c test.h @@ -1134,7 +1769,14 @@ libtest_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=test nodist_libsane_test_la_SOURCES = test-s.c libsane_test_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=test libsane_test_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_test_la_LIBADD = $(COMMON_LIBS) libtest.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_thread.lo $(SANEI_THREAD_LIBS) +libsane_test_la_LIBADD = $(COMMON_LIBS) \ + libtest.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_thread.lo \ + $(SANEI_THREAD_LIBS) EXTRA_DIST += test.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += test-picture.c @@ -1145,7 +1787,15 @@ libteco1_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=teco1 nodist_libsane_teco1_la_SOURCES = teco1-s.c libsane_teco1_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=teco1 libsane_teco1_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_teco1_la_LIBADD = $(COMMON_LIBS) libteco1.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_teco1_la_LIBADD = $(COMMON_LIBS) \ + libteco1.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += teco1.conf.in libteco2_la_SOURCES = teco2.c teco2.h @@ -1154,7 +1804,15 @@ libteco2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=teco2 nodist_libsane_teco2_la_SOURCES = teco2-s.c libsane_teco2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=teco2 libsane_teco2_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_teco2_la_LIBADD = $(COMMON_LIBS) libteco2.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_teco2_la_LIBADD = $(COMMON_LIBS) \ + libteco2.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += teco2.conf.in libteco3_la_SOURCES = teco3.c teco3.h @@ -1163,7 +1821,15 @@ libteco3_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=teco3 nodist_libsane_teco3_la_SOURCES = teco3-s.c libsane_teco3_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=teco3 libsane_teco3_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_teco3_la_LIBADD = $(COMMON_LIBS) libteco3.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_scsi.lo $(SCSI_LIBS) $(RESMGR_LIBS) +libsane_teco3_la_LIBADD = $(COMMON_LIBS) \ + libteco3.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_scsi.lo \ + $(SCSI_LIBS) $(RESMGR_LIBS) EXTRA_DIST += teco3.conf.in libu12_la_SOURCES = u12.c u12.h @@ -1172,7 +1838,15 @@ libu12_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=u12 nodist_libsane_u12_la_SOURCES = u12-s.c libsane_u12_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=u12 libsane_u12_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_u12_la_LIBADD = $(COMMON_LIBS) libu12.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo $(MATH_LIB) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_u12_la_LIBADD = $(COMMON_LIBS) \ + libu12.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_thread.lo \ + $(MATH_LIB) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += u12.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += u12-ccd.c u12-hw.c u12-hwdef.h u12-if.c u12-image.c u12-io.c u12-map.c u12-motor.c u12-scanner.h u12-shading.c u12-tpa.c @@ -1183,7 +1857,18 @@ libumax_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=umax nodist_libsane_umax_la_SOURCES = umax-s.c libsane_umax_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=umax libsane_umax_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_umax_la_LIBADD = $(COMMON_LIBS) libumax.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) +libsane_umax_la_LIBADD = $(COMMON_LIBS) \ + libumax.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + ../sanei/sanei_config2.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_pv8630.lo \ + $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += umax.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += umax-scanner.c umax-scanner.h umax-scsidef.h umax-uc1200s.c umax-uc1200se.c umax-uc1260.c umax-uc630.c umax-uc840.c umax-ug630.c umax-ug80.c umax-usb.c @@ -1194,7 +1879,15 @@ libumax1220u_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=umax1220u nodist_libsane_umax1220u_la_SOURCES = umax1220u-s.c libsane_umax1220u_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=umax1220u libsane_umax1220u_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_umax1220u_la_LIBADD = $(COMMON_LIBS) libumax1220u.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_pv8630.lo $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) +libsane_umax1220u_la_LIBADD = $(COMMON_LIBS) \ + libumax1220u.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_pv8630.lo \ + $(MATH_LIB) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += umax1220u.conf.in # TODO: Why are these distributed but not compiled? EXTRA_DIST += umax1220u-common.c @@ -1205,7 +1898,13 @@ libumax_pp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=umax_pp nodist_libsane_umax_pp_la_SOURCES = umax_pp-s.c libsane_umax_pp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=umax_pp libsane_umax_pp_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_umax_pp_la_LIBADD = $(COMMON_LIBS) libumax_pp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(MATH_LIB) +libsane_umax_pp_la_LIBADD = $(COMMON_LIBS) \ + libumax_pp.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(MATH_LIB) EXTRA_DIST += umax_pp.conf.in libv4l_la_SOURCES = v4l.c v4l.h v4l-frequencies.h @@ -1214,7 +1913,13 @@ libv4l_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBV4L_CFLAGS) -DBACKEND_NAME=v4l nodist_libsane_v4l_la_SOURCES = v4l-s.c libsane_v4l_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=v4l libsane_v4l_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_v4l_la_LIBADD = $(COMMON_LIBS) libv4l.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(LIBV4L_LIBS) +libsane_v4l_la_LIBADD = $(COMMON_LIBS) \ + libv4l.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(LIBV4L_LIBS) EXTRA_DIST += v4l.conf.in libxerox_mfp_la_SOURCES = xerox_mfp.c xerox_mfp-usb.c xerox_mfp-tcp.c xerox_mfp.h @@ -1223,22 +1928,38 @@ libxerox_mfp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=xerox_mfp nodist_libsane_xerox_mfp_la_SOURCES = xerox_mfp-s.c libsane_xerox_mfp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=xerox_mfp libsane_xerox_mfp_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_xerox_mfp_la_LIBADD = $(COMMON_LIBS) libxerox_mfp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo @SANEI_SANEI_JPEG_LO@ $(JPEG_LIBS) ../sanei/sanei_usb.lo ../sanei/sanei_tcp.lo $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(RESMGR_LIBS) +libsane_xerox_mfp_la_LIBADD = $(COMMON_LIBS) \ + libxerox_mfp.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + @SANEI_SANEI_JPEG_LO@ $(JPEG_LIBS) ../sanei/sanei_usb.lo \ + ../sanei/sanei_tcp.lo \ + $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(RESMGR_LIBS) EXTRA_DIST += xerox_mfp.conf.in libdll_preload_la_SOURCES = dll.c libdll_preload_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll -DENABLE_PRELOAD -libdll_preload_la_LIBADD = ../sanei/sanei_usb.lo $(USB_LIBS) $(XML_LIBS) +libdll_preload_la_LIBADD = ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(XML_LIBS) libdll_la_SOURCES = dll.c libdll_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll -libdll_la_LIBADD = ../sanei/sanei_usb.lo $(USB_LIBS) $(XML_LIBS) +libdll_la_LIBADD = ../sanei/sanei_usb.lo \ + $(USB_LIBS) $(XML_LIBS) BUILT_SOURCES = dll-preload.h CLEANFILES += dll-preload.h nodist_libsane_dll_la_SOURCES = dll-s.c libsane_dll_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll libsane_dll_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) -libsane_dll_la_LIBADD = $(COMMON_LIBS) libdll.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo $(DL_LIBS) +libsane_dll_la_LIBADD = $(COMMON_LIBS) \ + libdll.la \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + sane_strstatus.lo \ + $(DL_LIBS) EXTRA_DIST += dll.conf.in # TODO: Why is this distributed but not installed? EXTRA_DIST += dll.aliases @@ -1262,13 +1983,76 @@ EXTRA_DIST += dll.aliases # what backends are preloaded. It should include what is needed by # those backends that are actually preloaded. if preloadable_backends_enabled -PRELOADABLE_BACKENDS_LIBS = ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo $(LIBV4L_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(TIFF_LIBS) $(JPEG_LIBS) $(GPHOTO2_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(AVAHI_LIBS) $(SCSI_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) $(PNG_LIBS) $(POPPLER_GLIB_LIBS) $(XML_LIBS) $(libcurl_LIBS) $(SNMP_LIBS) -PRELOADABLE_BACKENDS_DEPS = ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo $(SANEI_SANEI_JPEG_LO) +PRELOADABLE_BACKENDS_LIBS = \ + ../sanei/sanei_config2.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_pv8630.lo \ + ../sanei/sanei_pp.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_lm983x.lo \ + ../sanei/sanei_access.lo \ + ../sanei/sanei_net.lo \ + ../sanei/sanei_wire.lo \ + ../sanei/sanei_codec_bin.lo \ + ../sanei/sanei_pa4s2.lo \ + ../sanei/sanei_ab306.lo \ + ../sanei/sanei_pio.lo \ + ../sanei/sanei_tcp.lo \ + ../sanei/sanei_udp.lo \ + ../sanei/sanei_magic.lo \ + $(LIBV4L_LIBS) $(MATH_LIB) \ + $(IEEE1284_LIBS) \ + $(TIFF_LIBS) \ + $(JPEG_LIBS) \ + $(GPHOTO2_LIBS) \ + $(SOCKET_LIBS) \ + $(USB_LIBS) \ + $(AVAHI_LIBS) \ + $(SCSI_LIBS) \ + $(SANEI_THREAD_LIBS) \ + $(RESMGR_LIBS) \ + $(PNG_LIBS) \ + $(POPPLER_GLIB_LIBS) \ + $(XML_LIBS) \ + $(libcurl_LIBS) \ + $(SNMP_LIBS) + +PRELOADABLE_BACKENDS_DEPS = ../sanei/sanei_config2.lo \ + ../sanei/sanei_usb.lo \ + ../sanei/sanei_scsi.lo \ + ../sanei/sanei_pv8630.lo \ + ../sanei/sanei_pp.lo \ + ../sanei/sanei_thread.lo \ + ../sanei/sanei_lm983x.lo \ + ../sanei/sanei_access.lo \ + ../sanei/sanei_net.lo \ + ../sanei/sanei_wire.lo \ + ../sanei/sanei_codec_bin.lo \ + ../sanei/sanei_pa4s2.lo \ + ../sanei/sanei_ab306.lo \ + ../sanei/sanei_pio.lo \ + ../sanei/sanei_tcp.lo \ + ../sanei/sanei_udp.lo \ + ../sanei/sanei_magic.lo \ + $(SANEI_SANEI_JPEG_LO) endif nodist_libsane_la_SOURCES = dll-s.c libsane_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll libsane_la_LDFLAGS = $(DIST_LIBS_LDFLAGS) -libsane_la_LIBADD = $(COMMON_LIBS) $(PRELOADABLE_BACKENDS_ENABLED) libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo $(PRELOADABLE_BACKENDS_LIBS) $(DL_LIBS) $(XML_LIBS) +libsane_la_LIBADD = $(COMMON_LIBS) \ + $(PRELOADABLE_BACKENDS_ENABLED) libdll_preload.la \ + sane_strstatus.lo \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + $(PRELOADABLE_BACKENDS_LIBS) $(DL_LIBS) $(XML_LIBS) # WARNING: Automake is getting this wrong so have to do it ourselves. -libsane_la_DEPENDENCIES = ../lib/liblib.la $(PRELOADABLE_BACKENDS_ENABLED) libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo $(PRELOADABLE_BACKENDS_DEPS) +libsane_la_DEPENDENCIES = ../lib/liblib.la \ + $(PRELOADABLE_BACKENDS_ENABLED) libdll_preload.la \ + sane_strstatus.lo \ + ../sanei/sanei_init_debug.lo \ + ../sanei/sanei_constrain_value.lo \ + ../sanei/sanei_config.lo \ + $(PRELOADABLE_BACKENDS_DEPS) diff --git a/backend/abaton.c b/backend/abaton.c index d5968cc..06e60f1 100644 --- a/backend/abaton.c +++ b/backend/abaton.c @@ -855,7 +855,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG_INIT (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (ABATON_CONFIG_FILE); if (!fp) diff --git a/backend/agfafocus.c b/backend/agfafocus.c index 71fcf30..d972f59 100644 --- a/backend/agfafocus.c +++ b/backend/agfafocus.c @@ -1287,7 +1287,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) sanei_thread_init (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open ("agfafocus.conf"); if (!fp) diff --git a/backend/apple.c b/backend/apple.c index 328fd1e..7b37248 100644 --- a/backend/apple.c +++ b/backend/apple.c @@ -1871,7 +1871,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG_INIT (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (APPLE_CONFIG_FILE); if (!fp) diff --git a/backend/artec.c b/backend/artec.c index 355e78e..ea211eb 100644 --- a/backend/artec.c +++ b/backend/artec.c @@ -2591,7 +2591,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) strcpy (artec_model, ""); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); if (authorize) DBG (7, "sane_init(), authorize %s null\n", (authorize) ? "!=" : "=="); diff --git a/backend/artec_eplus48u.c b/backend/artec_eplus48u.c index 4c15673..a4a3c24 100644 --- a/backend/artec_eplus48u.c +++ b/backend/artec_eplus48u.c @@ -4458,7 +4458,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) auth = authorize; if (version_code != NULL) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (ARTEC48U_CONFIG_FILE); diff --git a/backend/as6e.c b/backend/as6e.c index f7c0e81..7655777 100644 --- a/backend/as6e.c +++ b/backend/as6e.c @@ -626,7 +626,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG_INIT (); DBG (2, "sane_init (authorize %s null)\n", (authorize) ? "!=" : "=="); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); /* fp = sanei_config_open (AS6E_CONFIG_FILE);*/ if (!fp) { diff --git a/backend/avision.c b/backend/avision.c index e047a7f..b81578a 100644 --- a/backend/avision.c +++ b/backend/avision.c @@ -2013,6 +2013,102 @@ static void debug_print_window_descriptor (int dbg_level, char* func, func, window->avision.type.normal.background_lines); } +static SANE_String_Const +avision_strdatatypecode (uint8_t datatypecode) +{ + static char buf[80]; + + switch (datatypecode) + { + case AVISION_DATATYPECODE_LIGHT_STATUS: + return "Light status"; + case AVISION_DATATYPECODE_POWER_SAVING_TIMER: + return "Power saving timer"; + case AVISION_DATATYPECODE_FIRMWARE_STATUS: + return "Firmware status"; + case AVISION_DATATYPECODE_FLASH_RAM_INFO: + return "Flash RAM info"; + case AVISION_DATATYPECODE_READ_NVRAM_DATA: + return "Read NVRAM data"; + case AVISION_DATATYPECODE_SEND_NVRAM_DATA: + return "Send NVRAM data"; + case AVISION_DATATYPECODE_FLASH_DATA: + return "Flash data"; + case AVISION_DATATYPECODE_UNKNOWN: + return "Unknown"; + case AVISION_DATATYPECODE_DETECT_ACCESSORIES: + return "Detect accessories"; + case AVISION_DATATYPECODE_BUTTON_STATUS: + return "Button status"; + case AVISION_DATATYPECODE_FILM_HOLDER_SENSE: + return "Film holder sense"; + case AVISION_DATATYPECODE_READ_DUPLEX_INFO: + return "Read duplex info"; + case AVISION_DATATYPECODE_READ_GENERAL_ABILITY_PARAM: + return "Read general ability/parameter"; + case AVISION_DATATYPECODE_ATTACH_TRUNCATE_HEAD: + return "Attach/Truncate head (left) of scan length"; + case AVISION_DATATYPECODE_ATTACH_TRUNCATE_TAIL: + return "Attach/Truncate tail (right) of scan length"; + case AVISION_DATATYPECODE_GET_CALIBRATION_FORMAT: + return "Get calibration format"; + case AVISION_DATATYPECODE_DOWNLOAD_GAMMA_TABLE: + return "Download gamma table"; + case AVISION_DATATYPECODE_3X3_COLOR_MATRIX: + return "3x3 color matrix"; + case AVISION_DATATYPECODE_ACCELERATION_TABLE: + return "Acceleration table"; + case AVISION_DATATYPECODE_GET_BACKGROUND_RASTER: + return "Get background raster"; + case AVISION_DATATYPECODE_READ_IMAGE_DATA: + return "Read image data"; + default: + /* non-reentrant, but better than nothing */ + sprintf (buf, "Unknown data type code %02X", datatypecode); + return buf; + } +} + +static int +avision_strcmd (SANE_String buffer, size_t size, const void* cmd) +{ + const uint8_t* m_cmd = (const uint8_t*)cmd; + uint8_t opc = m_cmd[0]; + uint8_t datatypecode = m_cmd[2]; + + switch (opc) + { + case AVISION_SCSI_TEST_UNIT_READY: + return snprintf (buffer, size, "Test unit ready"); + case AVISION_SCSI_REQUEST_SENSE: + return snprintf (buffer, size, "Request sense"); + case AVISION_SCSI_MEDIA_CHECK: + return snprintf (buffer, size, "Media check"); + case AVISION_SCSI_INQUIRY: + return snprintf (buffer, size, "Inquiry"); + case AVISION_SCSI_MODE_SELECT: + return snprintf (buffer, size, "Mode select"); + case AVISION_SCSI_RESERVE_UNIT: + return snprintf (buffer, size, "Reserve unit"); + case AVISION_SCSI_RELEASE_UNIT: + return snprintf (buffer, size, "Release unit"); + case AVISION_SCSI_SCAN: + return snprintf (buffer, size, "Scan"); + case AVISION_SCSI_SET_WINDOW: + return snprintf (buffer, size, "Set window"); + case AVISION_SCSI_READ: + return snprintf (buffer, size, "Read (%s)", avision_strdatatypecode (datatypecode)); + case AVISION_SCSI_SEND: + return snprintf (buffer, size, "Send (%s)", avision_strdatatypecode (datatypecode)); + case AVISION_SCSI_OBJECT_POSITION: + return snprintf (buffer, size, "Object position"); + case AVISION_SCSI_GET_DATA_STATUS: + return snprintf (buffer, size, "Get data status"); + default: + return snprintf (buffer, size, "Unknown OPC %d", opc); + } +} + static int write_pnm_header (FILE* f, color_mode m, int depth, int width, int height) { int maxval = (1 << depth) - 1; @@ -2378,6 +2474,9 @@ static SANE_Status avision_cmd (Avision_Connection* av_con, const void* src, size_t src_size, void* dst, size_t* dst_size) { + SANE_Char strcmd[80]; + avision_strcmd (strcmd, sizeof (strcmd), cmd); + DBG (7, "avision_cmd: %s\n", strcmd); if (av_con->connection_type == AV_SCSI) { return sanei_scsi_cmd2 (av_con->scsi_fd, cmd, cmd_size, src, src_size, dst, dst_size); @@ -3224,7 +3323,7 @@ wait_4_light (Avision_Scanner* s) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0xa0; /* get light status */ + rcmd.datatypecode = AVISION_DATATYPECODE_LIGHT_STATUS; /* get light status */ set_double (rcmd.datatypequal, dev->data_dq); set_triple (rcmd.transferlen, size); @@ -3263,7 +3362,7 @@ wait_4_light (Avision_Scanner* s) memset (&scmd, 0, sizeof (scmd)); scmd.opc = AVISION_SCSI_SEND; - scmd.datatypecode = 0xa0; /* send light status */ + scmd.datatypecode = AVISION_DATATYPECODE_LIGHT_STATUS; /* send light status */ set_double (scmd.datatypequal, dev->data_dq); set_triple (scmd.transferlen, size); @@ -3297,7 +3396,7 @@ set_power_save_time (Avision_Scanner* s, int time) memset (&scmd, 0, sizeof (scmd)); scmd.cmd.opc = AVISION_SCSI_SEND; - scmd.cmd.datatypecode = 0xA2; /* power-saving timer */ + scmd.cmd.datatypecode = AVISION_DATATYPECODE_POWER_SAVING_TIMER; /* power-saving timer */ set_double (scmd.cmd.datatypequal, dev->data_dq); set_triple (scmd.cmd.transferlen, sizeof (scmd.time) ); @@ -3327,7 +3426,7 @@ get_firmware_status (Avision_Connection* av_con) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x90; /* firmware status */ + rcmd.datatypecode = AVISION_DATATYPECODE_FIRMWARE_STATUS; /* firmware status */ set_double (rcmd.datatypequal, 0); /* dev->data_dq not available */ set_triple (rcmd.transferlen, size); @@ -3364,7 +3463,7 @@ get_flash_ram_info (Avision_Connection* av_con) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x6a; /* flash ram information */ + rcmd.datatypecode = AVISION_DATATYPECODE_FLASH_RAM_INFO; /* flash ram information */ set_double (rcmd.datatypequal, 0); /* dev->data_dq not available */ set_triple (rcmd.transferlen, size); @@ -3433,7 +3532,7 @@ get_nvram_data (Avision_Scanner* s, nvram_data* nvram) rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x69; /* Read NVM RAM data */ + rcmd.datatypecode = AVISION_DATATYPECODE_READ_NVRAM_DATA; /* Read NVM RAM data */ set_double (rcmd.datatypequal, 0); /* dev->data_dq not available */ set_triple (rcmd.transferlen, size); @@ -3547,7 +3646,7 @@ send_nvram_data (Avision_Connection* av_con) memset (&scmd, 0, sizeof (scmd)); scmd.opc = AVISION_SCSI_SEND; - scmd.datatypecode = 0x85; /* nvram data */ + scmd.datatypecode = AVISION_DATATYPECODE_SEND_NVRAM_DATA; /* nvram data */ set_double (scmd.datatypequal, 0); /* dev->data_dq not available */ set_triple (scmd.transferlen, size); @@ -3577,7 +3676,7 @@ send_flash_ram_data (Avision_Connection* av_con) memset (&scmd, 0, sizeof (scmd)); scmd.opc = AVISION_SCSI_SEND; - scmd.datatypecode = 0x86; /* flash data */ + scmd.datatypecode = AVISION_DATATYPECODE_FLASH_DATA; /* flash data */ set_double (scmd.datatypequal, 0); set_triple (scmd.transferlen, size); @@ -3613,7 +3712,7 @@ adf_reset (Avision_Scanner* s) memset (&scmd, 0, sizeof (scmd)); memset (&payload, 0, sizeof (payload)); scmd.opc = AVISION_SCSI_SEND; - scmd.datatypecode = 0xD0; /* unknown */ + scmd.datatypecode = AVISION_DATATYPECODE_UNKNOWN; /* unknown */ set_double (scmd.datatypequal, 0); size = 2; set_triple (scmd.transferlen, size); @@ -3629,7 +3728,7 @@ adf_reset (Avision_Scanner* s) memset (&rcmd, 0, sizeof (rcmd)); memset (&payload, 0, sizeof (payload)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x69; /* Read NVRAM data */ + rcmd.datatypecode = AVISION_DATATYPECODE_READ_NVRAM_DATA; /* Read NVRAM data */ set_double (rcmd.datatypequal, dev->data_dq); size = 4 - i; /* read 3 bytes the first time, 4 the second */ set_triple (rcmd.transferlen, size); @@ -3668,7 +3767,7 @@ get_accessories_info (Avision_Scanner* s) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x64; /* detect accessories */ + rcmd.datatypecode = AVISION_DATATYPECODE_DETECT_ACCESSORIES; /* detect accessories */ set_double (rcmd.datatypequal, dev->data_dq); set_triple (rcmd.transferlen, size); @@ -3825,7 +3924,7 @@ get_button_status (Avision_Scanner* s) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0xA1; /* button status */ + rcmd.datatypecode = AVISION_DATATYPECODE_BUTTON_STATUS; /* button status */ set_double (rcmd.datatypequal, dev->data_dq); set_triple (rcmd.transferlen, size); @@ -3927,7 +4026,7 @@ get_button_status (Avision_Scanner* s) memset (&scmd, 0, sizeof (scmd)); scmd.opc = AVISION_SCSI_SEND; - scmd.datatypecode = 0xA1; /* button control */ + scmd.datatypecode = AVISION_DATATYPECODE_BUTTON_STATUS; /* button control */ set_double (scmd.datatypequal, dev->data_dq); set_triple (scmd.transferlen, size); @@ -3984,7 +4083,7 @@ get_frame_info (Avision_Scanner* s) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x87; /* film holder sense */ + rcmd.datatypecode = AVISION_DATATYPECODE_FILM_HOLDER_SENSE; /* film holder sense */ set_double (rcmd.datatypequal, dev->data_dq); set_triple (rcmd.transferlen, size); @@ -4051,7 +4150,7 @@ get_duplex_info (Avision_Scanner* s) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0xB1; /* read duplex info */ + rcmd.datatypecode = AVISION_DATATYPECODE_READ_DUPLEX_INFO; /* read duplex info */ set_double (rcmd.datatypequal, dev->data_dq); set_triple (rcmd.transferlen, size); @@ -4117,7 +4216,7 @@ set_frame (Avision_Scanner* s, SANE_Word frame) memset (&scmd, 0, sizeof (scmd)); scmd.cmd.opc = AVISION_SCSI_SEND; - scmd.cmd.datatypecode = 0x87; /* send film holder "sense" */ + scmd.cmd.datatypecode = AVISION_DATATYPECODE_FILM_HOLDER_SENSE; /* send film holder "sense" */ set_double (scmd.cmd.datatypequal, dev->data_dq); set_triple (scmd.cmd.transferlen, sizeof (scmd.data) ); @@ -4817,7 +4916,7 @@ get_tune_scan_length (Avision_Scanner* s) size = sizeof (payload); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0xD2; /* Read General Ability/Parameter */ + rcmd.datatypecode = AVISION_DATATYPECODE_READ_GENERAL_ABILITY_PARAM; /* Read General Ability/Parameter */ for (i = 1; i <= 8; ++i) { memset (&payload, 0, sizeof (payload)); @@ -4860,7 +4959,7 @@ send_tune_scan_length (Avision_Scanner* s) size = sizeof (payload); scmd.opc = AVISION_SCSI_SEND; - scmd.datatypecode = 0x96; /* Attach/Truncate head(left) of scan length */ + scmd.datatypecode = AVISION_DATATYPECODE_ATTACH_TRUNCATE_HEAD; /* Attach/Truncate head(left) of scan length */ set_triple (scmd.transferlen, size); /* the SPEC says optical DPI, but real world measuring suggests it is 1200 @@ -4907,7 +5006,7 @@ send_tune_scan_length (Avision_Scanner* s) return status; } - scmd.datatypecode = 0x95; /* Attach/Truncate tail(right) of scan length */ + scmd.datatypecode = AVISION_DATATYPECODE_ATTACH_TRUNCATE_TAIL; /* Attach/Truncate tail(right) of scan length */ bottom = dpi * SANE_UNFIX (s->val[OPT_OVERSCAN_BOTTOM].w) / MM_PER_INCH; DBG (3, "send_tune_scan_length: bottom: %d\n", bottom); @@ -5055,7 +5154,7 @@ get_calib_format (Avision_Scanner* s, struct calibration_format* format) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x60; /* get calibration format */ + rcmd.datatypecode = AVISION_DATATYPECODE_GET_CALIBRATION_FORMAT; /* get calibration format */ set_double (rcmd.datatypequal, s->hw->data_dq); set_triple (rcmd.transferlen, size); @@ -5720,7 +5819,7 @@ send_gamma (Avision_Scanner* s) memset (&scmd, 0, sizeof (scmd) ); scmd.opc = AVISION_SCSI_SEND; - scmd.datatypecode = 0x81; /* 0x81 for download gamma table */ + scmd.datatypecode = AVISION_DATATYPECODE_DOWNLOAD_GAMMA_TABLE; /* 0x81 for download gamma table */ set_triple (scmd.transferlen, gamma_table_raw_size); for (color = 0; color < 3 && status == SANE_STATUS_GOOD; ++ color) @@ -5872,7 +5971,7 @@ send_3x3_matrix (Avision_Scanner* s) } cmd.scmd.opc = AVISION_SCSI_SEND; - cmd.scmd.datatypecode = 0x83; /* 0x83 for 3x3 color matrix */ + cmd.scmd.datatypecode = AVISION_DATATYPECODE_3X3_COLOR_MATRIX; /* 0x83 for 3x3 color matrix */ set_triple (cmd.scmd.transferlen, sizeof (struct matrix_3x3)); if (1) { @@ -5903,7 +6002,7 @@ get_acceleration_info (Avision_Scanner* s, struct acceleration_info* info) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x6c; /* get acceleration information */ + rcmd.datatypecode = AVISION_DATATYPECODE_ACCELERATION_TABLE; /* get acceleration information */ set_double (rcmd.datatypequal, s->hw->data_dq); set_triple (rcmd.transferlen, size); @@ -5967,7 +6066,7 @@ send_acceleration_table (Avision_Scanner* s) memset (&scmd, 0x00, sizeof (scmd)); scmd.opc = AVISION_SCSI_SEND; - scmd.datatypecode = 0x6c; /* send acceleration table */ + scmd.datatypecode = AVISION_DATATYPECODE_ACCELERATION_TABLE; /* send acceleration table */ set_double (scmd.datatypequal, table); set_triple (scmd.transferlen, accel_info.total_steps); @@ -6393,7 +6492,7 @@ get_background_raster (Avision_Scanner* s) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x9b; /* get background raster */ + rcmd.datatypecode = AVISION_DATATYPECODE_GET_BACKGROUND_RASTER; /* get background raster */ set_double (rcmd.datatypequal, s->hw->data_dq); /* Ok, well - this part is very messy. The AV122 and DM152 appear to @@ -6792,6 +6891,11 @@ do_cancel (Avision_Scanner* s) DBG (1, "do_cancel: release_unit failed\n"); } + DBG (4, "FORCE RELEASE UNIT ON CANCEL\n"); + status = release_unit (s, 1); + if (status != SANE_STATUS_GOOD) + DBG (1, "do_cancel: release_unit failed\n"); + return SANE_STATUS_CANCELLED; } @@ -6806,7 +6910,7 @@ read_data (Avision_Scanner* s, SANE_Byte* buf, size_t* count) memset (&rcmd, 0, sizeof (rcmd)); rcmd.opc = AVISION_SCSI_READ; - rcmd.datatypecode = 0x00; /* read image data */ + rcmd.datatypecode = AVISION_DATATYPECODE_READ_IMAGE_DATA; /* read image data */ set_double (rcmd.datatypequal, s->hw->data_dq); set_triple (rcmd.transferlen, *count); @@ -8081,15 +8185,15 @@ reader_process (void *data) exit_status = SANE_STATUS_CANCELLED; } - status = release_unit (s, 0); - if (status != SANE_STATUS_GOOD) - DBG (1, "reader_process: release_unit failed\n"); - if (dev->inquiry_new_protocol && dev->scanner_type == AV_FILM) { status = object_position (s, AVISION_SCSI_OP_GO_HOME); if (status != SANE_STATUS_GOOD) DBG (1, "reader_process: object position go-home failed!\n"); } + + status = release_unit (s, 0); + if (status != SANE_STATUS_GOOD) + DBG (1, "reader_process: release_unit failed\n"); } if ((dev->hw->feature_type & AV_ADF_FLIPPING_DUPLEX) && s->source_mode == AV_ADF_DUPLEX && s->page % 2) { @@ -8347,13 +8451,13 @@ sane_init (SANE_Int* version_code, SANE_Auth_Callback authorize) #endif DBG (3, "sane_init:(Version: %i.%i Build: %i)\n", - SANE_CURRENT_MAJOR, V_MINOR, BACKEND_BUILD); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BACKEND_BUILD); /* must come first */ sanei_thread_init (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BACKEND_BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BACKEND_BUILD); sane_reload_devices (); diff --git a/backend/avision.h b/backend/avision.h index 0847dc8..aed6d9e 100644 --- a/backend/avision.h +++ b/backend/avision.h @@ -851,4 +851,29 @@ extern SANE_Status ENTRY(media_check) (SANE_Handle handle); #endif +typedef enum +{ + AVISION_DATATYPECODE_READ_IMAGE_DATA = 0x00, + AVISION_DATATYPECODE_GET_CALIBRATION_FORMAT = 0x60, + AVISION_DATATYPECODE_DETECT_ACCESSORIES = 0x64, + AVISION_DATATYPECODE_READ_NVRAM_DATA = 0x69, + AVISION_DATATYPECODE_FLASH_RAM_INFO = 0x6a, + AVISION_DATATYPECODE_ACCELERATION_TABLE = 0x6c, + AVISION_DATATYPECODE_DOWNLOAD_GAMMA_TABLE = 0x81, + AVISION_DATATYPECODE_3X3_COLOR_MATRIX = 0x83, + AVISION_DATATYPECODE_SEND_NVRAM_DATA = 0x85, + AVISION_DATATYPECODE_FLASH_DATA = 0x86, + AVISION_DATATYPECODE_FILM_HOLDER_SENSE = 0x87, + AVISION_DATATYPECODE_FIRMWARE_STATUS = 0x90, + AVISION_DATATYPECODE_ATTACH_TRUNCATE_TAIL = 0x95, + AVISION_DATATYPECODE_ATTACH_TRUNCATE_HEAD = 0x96, + AVISION_DATATYPECODE_GET_BACKGROUND_RASTER = 0x9b, + AVISION_DATATYPECODE_LIGHT_STATUS = 0xa0, + AVISION_DATATYPECODE_BUTTON_STATUS = 0xa1, + AVISION_DATATYPECODE_POWER_SAVING_TIMER = 0xa2, + AVISION_DATATYPECODE_READ_DUPLEX_INFO = 0xb1, + AVISION_DATATYPECODE_UNKNOWN = 0xd0, + AVISION_DATATYPECODE_READ_GENERAL_ABILITY_PARAM = 0xd2, +} Avision_Datatypecode; + #endif /* avision_h */ diff --git a/backend/bh.c b/backend/bh.c index dd5f6a0..0f2e70e 100644 --- a/backend/bh.c +++ b/backend/bh.c @@ -3150,11 +3150,11 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authorize) DBG_INIT(); DBG(3, "sane_init called\n"); DBG(1, "Bell+Howell SANE backend %d.%d build %d %s endian\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, _is_host_little_endian() ? "little" : "big"); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); fp = sanei_config_open(BH_CONFIG_FILE); if (fp) diff --git a/backend/canon-sane.c b/backend/canon-sane.c index 016ca8a..6957aa7 100644 --- a/backend/canon-sane.c +++ b/backend/canon-sane.c @@ -55,7 +55,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize #endif if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (CANON_CONFIG_FILE); if (fp) diff --git a/backend/canon630u.c b/backend/canon630u.c index 6a76211..659c31f 100644 --- a/backend/canon630u.c +++ b/backend/canon630u.c @@ -720,10 +720,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (2, "sane_init: version_code %s 0, authorize %s 0\n", version_code == 0 ? "=" : "!=", authorize == 0 ? "=" : "!="); DBG (1, "sane_init: SANE Canon630u backend version %d.%d.%d from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); sanei_usb_init (); diff --git a/backend/canon_dr-cmd.h b/backend/canon_dr-cmd.h index 44751fa..e9fc54b 100644 --- a/backend/canon_dr-cmd.h +++ b/backend/canon_dr-cmd.h @@ -11,9 +11,7 @@ #define USB_HEADER_LEN 12 #define USB_COMMAND_LEN 12 #define USB_STATUS_LEN 4 -#define USB_COMMAND_TIME 30000 -#define USB_DATA_TIME 30000 -#define USB_STATUS_TIME 30000 +#define USB_PACKET_TIMEOUT 30000 /*static inline void */ static void @@ -116,8 +114,10 @@ putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes) #define INQUIRY_code 0x12 #define INQUIRY_len 6 -#define INQUIRY_std_len 0x30 -#define INQUIRY_vpd_len 0x1e +#define INQUIRY_std_max_len 0x30 +#define INQUIRY_std_typ_len 0x30 +#define INQUIRY_vpd_max_len 0x30 +#define INQUIRY_vpd_typ_len 0x1e #define set_IN_evpd(icb, val) setbitfield(icb + 1, 1, 0, val) #define set_IN_page_code(icb, val) icb[0x02]=val diff --git a/backend/canon_dr.c b/backend/canon_dr.c index de7ed7e..95799e7 100644 --- a/backend/canon_dr.c +++ b/backend/canon_dr.c @@ -3,7 +3,7 @@ This file is part of the SANE package, and implements a SANE backend for various Canon DR-series scanners. - Copyright (C) 2008-2020 m. allan noah + Copyright (C) 2008-2021 m. allan noah Yabarana Corp. www.yabarana.com provided significant funding EvriChart, Inc. www.evrichart.com provided funding and loaned equipment @@ -346,6 +346,15 @@ - add new gray and color interlacing options for DR-C120 - initial support for DR-C120 and C130 - enable fine calibration for P-208 (per @sashacmc in !546) + v61 2021-02-13, MAN + - treat DR-P208 like P-208 (#356) + - treat DR-P215 like P-215 (#356) + - adjust wait_scanner to try one TUR with a long timeout (#142) + v62 2021-02-13, MAN + - allow config file to set inq and vpd lengths for DR-M1060 (#263) + - rewrite do_cmd() timeout handling + - remove long timeout TUR from v61 (did not help) + - allow config file to set initial tur timeout for DR-X10C (#142) SANE FLOW DIAGRAM @@ -384,6 +393,7 @@ #include /*tan*/ #include /*usleep*/ #include /*gettimeofday*/ +#include /*strtol*/ #include "../include/sane/sanei_backend.h" #include "../include/sane/sanei_scsi.h" @@ -396,7 +406,7 @@ #include "canon_dr.h" #define DEBUG 1 -#define BUILD 60 +#define BUILD 62 /* values for SANE_DEBUG_CANON_DR env var: - errors 5 @@ -448,6 +458,10 @@ static int global_extra_status; static int global_extra_status_default = 0; static int global_duplex_offset; static int global_duplex_offset_default = 0; +static int global_inquiry_length; +static int global_vpd_length; +static int global_tur_timeout; +static int global_tur_timeout_default = USB_PACKET_TIMEOUT/60; /* half second */ static char global_vendor_name[9]; static char global_model_name[17]; static char global_version_name[5]; @@ -486,10 +500,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (10, "sane_init: start\n"); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (5, "sane_init: canon_dr backend %d.%d.%d, from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); DBG (10, "sane_init: finish\n"); @@ -675,6 +689,84 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only) global_duplex_offset = buf; } + /* INQUIRY_LENGTH: <= 0x30 */ + else if (!strncmp (lp, "inquiry-length", 14) && isspace (lp[14])) { + + int buf; + lp += 14; + lp = sanei_config_skip_whitespace (lp); + buf = (int) strtol (lp,NULL,16); + + if (buf > INQUIRY_std_max_len) { + DBG (5, "sane_get_devices: config option \"inquiry-length\" " + "(%#04x) is > %#04x, ignoring!\n", buf, INQUIRY_std_max_len); + continue; + } + + if (buf < 0) { + DBG (5, "sane_get_devices: config option \"inquiry-length\" " + "(%#04x) is < 0, ignoring!\n", buf); + continue; + } + + DBG (15, "sane_get_devices: setting \"inquiry-length\" to %#04x\n", + buf); + + global_inquiry_length = buf; + } + + /* VPD_LENGTH: <= 0x30 */ + else if (!strncmp (lp, "vpd-length", 10) && isspace (lp[10])) { + + int buf; + lp += 10; + lp = sanei_config_skip_whitespace (lp); + buf = (int) strtol (lp,NULL,16); + + if (buf > INQUIRY_vpd_max_len) { + DBG (5, "sane_get_devices: config option \"vpd-length\" " + "(%#04x) is > %#04x, ignoring!\n", buf, INQUIRY_vpd_max_len); + continue; + } + + if (buf < 0) { + DBG (5, "sane_get_devices: config option \"vpd-length\" " + "(%#04x) is < 0, ignoring!\n", buf); + continue; + } + + DBG (15, "sane_get_devices: setting \"vpd-length\" to %#04x\n", + buf); + + global_vpd_length = buf; + } + + /* TUR_TIMEOUT <= 60000 */ + else if (!strncmp (lp, "tur-timeout", 11) && isspace (lp[11])) { + + int buf; + lp += 11; + lp = sanei_config_skip_whitespace (lp); + buf = atoi (lp); + + if (buf > 60000) { + DBG (5, "sane_get_devices: config option \"tur-timeout\" " + "(%d) is > 60000, ignoring!\n", buf); + continue; + } + + if (buf < 0) { + DBG (5, "sane_get_devices: config option \"tur-timeout\" " + "(%d) is < 0, ignoring!\n", buf); + continue; + } + + DBG (15, "sane_get_devices: setting \"tur-timeout\" to %d\n", + buf); + + global_tur_timeout = buf; + } + /* VENDOR: we ingest up to 8 bytes */ else if (!strncmp (lp, "vendor-name", 11) && isspace (lp[11])) { @@ -841,6 +933,9 @@ attach_one (const char *device_name, int connType) s->padded_read = global_padded_read; s->extra_status = global_extra_status; s->duplex_offset = global_duplex_offset; + s->inquiry_length = global_inquiry_length; + s->vpd_length = global_vpd_length; + s->tur_timeout = global_tur_timeout; /* copy the device name */ strcpy (s->device_name, device_name); @@ -1017,8 +1112,8 @@ init_inquire (struct scanner *s) unsigned char cmd[INQUIRY_len]; size_t cmdLen = INQUIRY_len; - unsigned char in[INQUIRY_std_len]; - size_t inLen = INQUIRY_std_len; + unsigned char in[INQUIRY_std_max_len]; + size_t inLen = s->inquiry_length; DBG (10, "init_inquire: start\n"); @@ -1099,8 +1194,8 @@ init_vpd (struct scanner *s) unsigned char cmd[INQUIRY_len]; size_t cmdLen = INQUIRY_len; - unsigned char in[INQUIRY_vpd_len]; - size_t inLen = INQUIRY_vpd_len; + unsigned char in[INQUIRY_vpd_max_len]; + size_t inLen = s->vpd_length; DBG (10, "init_vpd: start\n"); @@ -1491,7 +1586,8 @@ init_model (struct scanner *s) s->has_card = 1; } - else if (strstr (s->model_name, "P-208")) { + else if (strstr (s->model_name, "P-208") + || strstr (s->model_name,"DR-P208")){ s->color_interlace[SIDE_FRONT] = COLOR_INTERLACE_RRGGBB; s->color_interlace[SIDE_BACK] = COLOR_INTERLACE_rRgGbB; s->gray_interlace[SIDE_BACK] = GRAY_INTERLACE_gG; @@ -1508,7 +1604,8 @@ init_model (struct scanner *s) s->can_read_sensors = 1; } - else if (strstr (s->model_name, "P-215")) { + else if (strstr (s->model_name, "P-215") + || strstr (s->model_name,"DR-P215")){ s->color_interlace[SIDE_FRONT] = COLOR_INTERLACE_rRgGbB; s->color_interlace[SIDE_BACK] = COLOR_INTERLACE_RRGGBB; s->gray_interlace[SIDE_FRONT] = GRAY_INTERLACE_gG; @@ -7079,6 +7176,9 @@ default_globals(void) global_padded_read = global_padded_read_default; global_extra_status = global_extra_status_default; global_duplex_offset = global_duplex_offset_default; + global_inquiry_length = INQUIRY_std_typ_len; + global_vpd_length = INQUIRY_vpd_typ_len; + global_tur_timeout = global_tur_timeout_default; global_vendor_name[0] = 0; global_model_name[0] = 0; global_version_name[0] = 0; @@ -7332,21 +7432,21 @@ sense_handler (int fd, unsigned char * sensed_data, void *arg) * take a bunch of pointers, send commands to scanner */ static SANE_Status -do_cmd(struct scanner *s, int runRS, int shortTime, +do_cmd(struct scanner *s, int runRS, int timeout, unsigned char * cmdBuff, size_t cmdLen, unsigned char * outBuff, size_t outLen, unsigned char * inBuff, size_t * inLen ) { if (s->connection == CONNECTION_SCSI) { - return do_scsi_cmd(s, runRS, shortTime, + return do_scsi_cmd(s, runRS, timeout, cmdBuff, cmdLen, outBuff, outLen, inBuff, inLen ); } if (s->connection == CONNECTION_USB) { - return do_usb_cmd(s, runRS, shortTime, + return do_usb_cmd(s, runRS, timeout, cmdBuff, cmdLen, outBuff, outLen, inBuff, inLen @@ -7356,7 +7456,7 @@ do_cmd(struct scanner *s, int runRS, int shortTime, } static SANE_Status -do_scsi_cmd(struct scanner *s, int runRS, int shortTime, +do_scsi_cmd(struct scanner *s, int runRS, int timeout, unsigned char * cmdBuff, size_t cmdLen, unsigned char * outBuff, size_t outLen, unsigned char * inBuff, size_t * inLen @@ -7366,7 +7466,7 @@ do_scsi_cmd(struct scanner *s, int runRS, int shortTime, /*shut up compiler*/ runRS=runRS; - shortTime=shortTime; + timeout=timeout; DBG(10, "do_scsi_cmd: start\n"); @@ -7404,7 +7504,7 @@ do_scsi_cmd(struct scanner *s, int runRS, int shortTime, } static SANE_Status -do_usb_cmd(struct scanner *s, int runRS, int shortTime, +do_usb_cmd(struct scanner *s, int runRS, int timeout, unsigned char * cmdBuff, size_t cmdLen, unsigned char * outBuff, size_t outLen, unsigned char * inBuff, size_t * inLen @@ -7414,21 +7514,19 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, size_t cmdLength = 0; size_t cmdActual = 0; unsigned char * cmdBuffer = NULL; - int cmdTimeout = 0; size_t outOffset = 0; size_t outLength = 0; size_t outActual = 0; unsigned char * outBuffer = NULL; - int outTimeout = 0; size_t inOffset = 0; size_t inLength = 0; size_t inActual = 0; unsigned char * inBuffer = NULL; - int inTimeout = 0; size_t extraLength = 0; + int actTimeout = timeout ? timeout : USB_PACKET_TIMEOUT; int ret = 0; int ret2 = 0; @@ -7438,18 +7536,15 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, DBG (10, "do_usb_cmd: start %lu %lu\n", (long unsigned int)timer.tv_sec, (long unsigned int)timer.tv_usec); + /* change timeout */ + sanei_usb_set_timeout(actTimeout); + /****************************************************************/ /* the command stage */ { cmdOffset = USB_HEADER_LEN; cmdLength = cmdOffset+USB_COMMAND_LEN; cmdActual = cmdLength; - cmdTimeout = USB_COMMAND_TIME; - - /* change timeout */ - if(shortTime) - cmdTimeout/=60; - sanei_usb_set_timeout(cmdTimeout); /* build buffer */ cmdBuffer = calloc(cmdLength,1); @@ -7465,7 +7560,7 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, memcpy(cmdBuffer+cmdOffset,cmdBuff,cmdLen); /* write the command out */ - DBG(25, "cmd: writing %d bytes, timeout %d\n", (int)cmdLength, cmdTimeout); + DBG(25, "cmd: writing %d bytes, timeout %d\n", (int)cmdLength, actTimeout); hexdump(30, "cmd: >>", cmdBuffer, cmdLength); ret = sanei_usb_write_bulk(s->fd, cmdBuffer, &cmdActual); DBG(25, "cmd: wrote %d bytes, retVal %d\n", (int)cmdActual, ret); @@ -7488,7 +7583,7 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, /* this is like the regular status block, with an additional */ /* length component at the end */ if(s->extra_status){ - ret2 = do_usb_status(s,runRS,shortTime,&extraLength); + ret2 = do_usb_status(s,runRS,timeout,&extraLength); /* bail out on bad RS status */ if(ret2){ @@ -7504,12 +7599,6 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, outOffset = USB_HEADER_LEN; outLength = outOffset+outLen; outActual = outLength; - outTimeout = USB_DATA_TIME; - - /* change timeout */ - if(shortTime) - outTimeout/=60; - sanei_usb_set_timeout(outTimeout); /* build outBuffer */ outBuffer = calloc(outLength,1); @@ -7525,7 +7614,7 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, memcpy(outBuffer+outOffset,outBuff,outLen); /* write the command out */ - DBG(25, "out: writing %d bytes, timeout %d\n", (int)outLength, outTimeout); + DBG(25, "out: writing %d bytes, timeout %d\n", (int)outLength, actTimeout); hexdump(30, "out: >>", outBuffer, outLength); ret = sanei_usb_write_bulk(s->fd, outBuffer, &outActual); DBG(25, "out: wrote %d bytes, retVal %d\n", (int)outActual, ret); @@ -7563,13 +7652,6 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, /*blast caller's copy in case we error out*/ *inLen = 0; - inTimeout = USB_DATA_TIME; - - /* change timeout */ - if(shortTime) - inTimeout/=60; - sanei_usb_set_timeout(inTimeout); - /* build inBuffer */ inBuffer = calloc(inActual,1); if(!inBuffer){ @@ -7577,7 +7659,7 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, return SANE_STATUS_NO_MEM; } - DBG(25, "in: reading %d bytes, timeout %d\n", (int)inActual, inTimeout); + DBG(25, "in: reading %d bytes, timeout %d\n", (int)inActual, actTimeout); ret = sanei_usb_read_bulk(s->fd, inBuffer, &inActual); DBG(25, "in: read %d bytes, retval %d\n", (int)inActual, ret); hexdump(31, "in: <<", inBuffer, inActual); @@ -7603,7 +7685,7 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, /****************************************************************/ /* the normal status stage */ - ret2 = do_usb_status(s,runRS,shortTime,&extraLength); + ret2 = do_usb_status(s,runRS,timeout,&extraLength); /* if status said EOF, adjust input with remainder count */ if(ret2 == SANE_STATUS_EOF && inBuffer){ @@ -7651,7 +7733,7 @@ do_usb_cmd(struct scanner *s, int runRS, int shortTime, } static SANE_Status -do_usb_status(struct scanner *s, int runRS, int shortTime, size_t * extraLength) +do_usb_status(struct scanner *s, int runRS, int timeout, size_t * extraLength) { #define EXTRA_READ_len 4 @@ -7661,7 +7743,8 @@ do_usb_status(struct scanner *s, int runRS, int shortTime, size_t * extraLength) size_t statLength = 0; size_t statActual = 0; unsigned char * statBuffer = NULL; - int statTimeout = 0; + + int actTimeout = timeout ? timeout : USB_PACKET_TIMEOUT; int ret = 0; @@ -7675,12 +7758,9 @@ do_usb_status(struct scanner *s, int runRS, int shortTime, size_t * extraLength) statLength += EXTRA_READ_len; statActual = statLength; - statTimeout = USB_STATUS_TIME; /* change timeout */ - if(shortTime) - statTimeout/=60; - sanei_usb_set_timeout(statTimeout); + sanei_usb_set_timeout(timeout ? timeout : USB_PACKET_TIMEOUT); /* build statBuffer */ statBuffer = calloc(statLength,1); @@ -7689,7 +7769,7 @@ do_usb_status(struct scanner *s, int runRS, int shortTime, size_t * extraLength) return SANE_STATUS_NO_MEM; } - DBG(25, "stat: reading %d bytes, timeout %d\n", (int)statLength, statTimeout); + DBG(25, "stat: reading %d bytes, timeout %d\n", (int)statLength, actTimeout); ret = sanei_usb_read_bulk(s->fd, statBuffer, &statActual); DBG(25, "stat: read %d bytes, retval %d\n", (int)statActual, ret); hexdump(30, "stat: <<", statBuffer, statActual); @@ -7754,7 +7834,7 @@ do_usb_clear(struct scanner *s, int clear, int runRS) DBG(25,"rs sub call >>\n"); ret2 = do_cmd( - s,0,0, + s, 0, 0, rs_cmd, rs_cmdLen, NULL,0, rs_in, &rs_inLen @@ -7796,7 +7876,7 @@ wait_scanner(struct scanner *s) set_SCSI_opcode(cmd,TEST_UNIT_READY_code); ret = do_cmd ( - s, 0, 1, + s, 0, s->tur_timeout, cmd, cmdLen, NULL, 0, NULL, NULL @@ -7805,7 +7885,7 @@ wait_scanner(struct scanner *s) if (ret != SANE_STATUS_GOOD) { DBG(5,"WARNING: Brain-dead scanner. Hitting with stick.\n"); ret = do_cmd ( - s, 0, 1, + s, 0, s->tur_timeout, cmd, cmdLen, NULL, 0, NULL, NULL @@ -7814,7 +7894,7 @@ wait_scanner(struct scanner *s) if (ret != SANE_STATUS_GOOD) { DBG(5,"WARNING: Brain-dead scanner. Hitting with stick again.\n"); ret = do_cmd ( - s, 0, 1, + s, 0, s->tur_timeout, cmd, cmdLen, NULL, 0, NULL, NULL @@ -7823,18 +7903,9 @@ wait_scanner(struct scanner *s) // some scanners (such as DR-F120) are OK but will not respond to commands // when in sleep mode. By checking the sense it wakes them up. if (ret != SANE_STATUS_GOOD) { - DBG(5,"WARNING: Brain-dead scanner. Hitting with request sense.\n"); - ret = do_cmd ( - s, 1, 1, - cmd, cmdLen, - NULL, 0, - NULL, NULL - ); - } - if (ret != SANE_STATUS_GOOD) { - DBG(5,"WARNING: Brain-dead scanner. Hitting with stick a third time.\n"); + DBG(5,"WARNING: Brain-dead scanner. Hitting with stick and request sense.\n"); ret = do_cmd ( - s, 0, 1, + s, 1, s->tur_timeout, cmd, cmdLen, NULL, 0, NULL, NULL @@ -7843,7 +7914,7 @@ wait_scanner(struct scanner *s) if (ret != SANE_STATUS_GOOD) { DBG(5,"WARNING: Brain-dead scanner. Hitting with stick a fourth time.\n"); ret = do_cmd ( - s, 0, 1, + s, 0, s->tur_timeout, cmd, cmdLen, NULL, 0, NULL, NULL diff --git a/backend/canon_dr.conf.in b/backend/canon_dr.conf.in index 3b72fda..7bce43c 100644 --- a/backend/canon_dr.conf.in +++ b/backend/canon_dr.conf.in @@ -103,6 +103,7 @@ option duplex-offset 400 usb 0x1083 0x1617 # DR-X10C +option tur-timeout 5000 usb 0x1083 0x1618 # CR-25 @@ -173,6 +174,7 @@ usb 0x1083 0x164a usb 0x1083 0x164b # P-208 +option duplex-offset 260 usb 0x1083 0x164c # DR-G1130 @@ -194,6 +196,8 @@ option duplex-offset 1640 usb 0x1083 0x1654 # DR-M1060 +option inquiry-length 0x24 +option vpd-length 0x30 usb 0x1083 0x1657 # DR-C225 diff --git a/backend/canon_dr.h b/backend/canon_dr.h index a945d00..7afbb90 100644 --- a/backend/canon_dr.h +++ b/backend/canon_dr.h @@ -116,12 +116,18 @@ struct scanner /* --------------------------------------------------------------------- */ /* immutable values which are set during reading of config file. */ + int connection; /* hardware interface type */ int buffer_size; - int connection; /* hardware interface type */ + int duplex_offset; /* number of lines of padding added to front (1/1200)*/ + int extra_status; /* some machines need extra status read after cmd */ + int inquiry_length; /* some models are particular about inquiry size */ + int padded_read; /* some machines need extra 12 bytes on reads */ + int tur_timeout; /* some models are slow to wake up */ + int vpd_length; /* some models are particular about vpd size */ /* --------------------------------------------------------------------- */ /* immutable values which are set during inquiry probing of the scanner. */ - /* members in order found in scsi data... */ + /* members in order found in scsi data. These can also be in config file */ char vendor_name[9]; /* raw data as returned by SCSI inquiry. */ char model_name[17]; /* raw data as returned by SCSI inquiry. */ char version_name[5]; /* raw data as returned by SCSI inquiry. */ @@ -207,8 +213,6 @@ struct scanner int always_op; /* send object pos between pages */ int invert_tly; /* weird bug in some smaller scanners */ int unknown_byte2; /* weird byte, required, meaning unknown */ - int padded_read; /* some machines need extra 12 bytes on reads */ - int extra_status; /* some machines need extra status read after cmd */ int fixed_width; /* some machines always scan full width */ int even_Bpl; /* some machines require even bytes per line */ @@ -217,7 +221,6 @@ struct scanner int color_inter_by_res[16]; /* and some even change by resolution */ int duplex_interlace; /* different models interlace sides differently */ int jpeg_interlace; /* different models interlace jpeg sides differently */ - int duplex_offset; /* number of lines of padding added to front (1/1200)*/ int duplex_offset_side; /* padding added to front or back? */ int sw_lut; /* no hardware brightness/contrast support */ diff --git a/backend/canon_lide70-common.c b/backend/canon_lide70-common.c index 405d693..0882fec 100644 --- a/backend/canon_lide70-common.c +++ b/backend/canon_lide70-common.c @@ -2,7 +2,7 @@ BACKEND canon_lide70 - Copyright (C) 2019 Juergen Ernst and pimvantend. + Copyright (C) 2019-2021 Juergen Ernst and pimvantend. This file is part of the SANE package. @@ -28,7 +28,7 @@ #include #include /* usleep */ #include -#include /* exp() */ +#include /* pow() */ #ifdef HAVE_OS2_H #include /* mode_t */ #endif @@ -74,12 +74,18 @@ typedef struct CANON_Handle long width, height; /* at scan resolution */ unsigned char value_08, value_09; /* left */ unsigned char value_0a, value_0b; /* right */ - unsigned char value_67, value_68; /* bottom */ + unsigned char value_66, value_67, value_68; /* bottom */ unsigned char value_51; /* lamp colors */ + unsigned char value_90; /* motor mode */ int resolution; /* dpi */ char *fname; /* output file name */ FILE *fp; /* output file pointer (for reading) */ unsigned char absolute_threshold; + double table_gamma; + double table_gamma_blue; + unsigned char highlight_red_enhanced; + unsigned char highlight_blue_reduced; + unsigned char highlight_other; } CANON_Handle; @@ -104,12 +110,15 @@ cp2155_set (int fd, CP2155_Register reg, byte data) cmd_buffer[3] = 0x00; cmd_buffer[4] = data; +/* if (cmd_buffer[0]==0 && cmd_buffer[1]>0x21 && cmd_buffer[1]<0x44) + { */ DBG (1, "cp2155_set %02x %02x %02x %02x %02x\n", cmd_buffer[0], cmd_buffer[1], cmd_buffer[2], cmd_buffer[3], cmd_buffer[4]); -/* - usleep (100 * MSEC); -*/ +/* } */ +/* */ + usleep (0.0 * MSEC); +/* */ status = sanei_usb_write_bulk (fd, cmd_buffer, &count); if (status != SANE_STATUS_GOOD) @@ -225,110 +234,98 @@ cp2155_write_gamma_block (int fd, unsigned int addr, byte * data) sanei_usb_write_bulk (fd, data, &count); } -/* size=0x0100 */ -/* gamma table red*/ -static byte cp2155_gamma_red_enhanced_data[] = { - - 0x04, 0x70, 0x00, 0x01, - 0x00, 0x14, 0x1c, 0x26, 0x2a, 0x2e, 0x34, 0x37, 0x3a, 0x3f, 0x42, 0x44, - 0x48, 0x4a, 0x4c, 0x50, - 0x52, 0x53, 0x57, 0x58, 0x5c, 0x5d, 0x5f, 0x62, 0x63, 0x64, 0x67, 0x68, - 0x6a, 0x6c, 0x6e, 0x6f, - 0x71, 0x72, 0x74, 0x76, 0x77, 0x78, 0x7a, 0x7c, 0x7e, 0x7f, 0x80, 0x82, - 0x83, 0x84, 0x86, 0x87, - 0x88, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x91, 0x92, 0x93, 0x95, 0x96, - 0x97, 0x98, 0x99, 0x9b, - 0x9b, 0x9c, 0x9e, 0x9f, 0x9f, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa8, 0xa9, 0xaa, 0xab, - 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb6, - 0xb8, 0xb8, 0xb9, 0xba, - 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, - 0xc5, 0xc6, 0xc7, 0xc8, - 0xc9, 0xc9, 0xca, 0xcb, 0xcc, 0xcc, 0xce, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, - 0xd2, 0xd3, 0xd4, 0xd5, - 0xd5, 0xd6, 0xd7, 0xd7, 0xd9, 0xd9, 0xda, 0xdb, 0xdb, 0xdc, 0xdd, 0xdd, - 0xdf, 0xdf, 0xe0, 0xe1, - 0xe1, 0xe2, 0xe3, 0xe3, 0xe4, 0xe5, 0xe5, 0xe6, 0xe7, 0xe7, 0xe8, 0xe9, - 0xe9, 0xea, 0xeb, 0xeb, - 0xec, 0xed, 0xed, 0xee, 0xef, 0xef, 0xf0, 0xf1, 0xf1, 0xf2, 0xf3, 0xf3, - 0xf4, 0xf5, 0xf5, 0xf6, - 0xf7, 0xf7, 0xf8, 0xf9, 0xfa, 0xfa, 0xfa, 0xfb, 0xfc, 0xfc, 0xfd, 0xfe, - 0xfe, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff -}; - -/* size=0x0100 */ -/* gamma table */ -static byte cp2155_gamma_standard_data[] = { - - 0x04, 0x70, 0x00, 0x01, - 0x00, 0x14, 0x1c, 0x21, 0x26, 0x2a, 0x2e, 0x31, 0x34, 0x37, 0x3a, 0x3d, - 0x3f, 0x42, 0x44, 0x46, - 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x53, 0x55, 0x57, 0x58, 0x5a, 0x5c, - 0x5d, 0x5f, 0x60, 0x62, - 0x63, 0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x6e, 0x6f, 0x70, 0x71, - 0x72, 0x74, 0x75, 0x76, - 0x77, 0x78, 0x79, 0x7a, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, - 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, - 0x93, 0x94, 0x95, 0x96, - 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x9f, - 0xa0, 0xa1, 0xa2, 0xa3, - 0xa3, 0xa4, 0xa5, 0xa6, 0xa6, 0xa7, 0xa8, 0xa9, 0xa9, 0xaa, 0xab, 0xac, - 0xac, 0xad, 0xae, 0xaf, - 0xaf, 0xb0, 0xb1, 0xb1, 0xb2, 0xb3, 0xb4, 0xb4, 0xb5, 0xb6, 0xb6, 0xb7, - 0xb8, 0xb8, 0xb9, 0xba, - 0xba, 0xbb, 0xbc, 0xbc, 0xbd, 0xbe, 0xbe, 0xbf, 0xc0, 0xc0, 0xc1, 0xc1, - 0xc2, 0xc3, 0xc3, 0xc4, - 0xc5, 0xc5, 0xc6, 0xc6, 0xc7, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xcb, 0xcb, - 0xcc, 0xcc, 0xcd, 0xce, - 0xce, 0xcf, 0xcf, 0xd0, 0xd1, 0xd1, 0xd2, 0xd2, 0xd3, 0xd3, 0xd4, 0xd5, - 0xd5, 0xd6, 0xd6, 0xd7, - 0xd7, 0xd8, 0xd9, 0xd9, 0xda, 0xda, 0xdb, 0xdb, 0xdc, 0xdc, 0xdd, 0xdd, - 0xde, 0xdf, 0xdf, 0xe0, - 0xe0, 0xe1, 0xe1, 0xe2, 0xe2, 0xe3, 0xe3, 0xe4, 0xe4, 0xe5, 0xe5, 0xe6, - 0xe6, 0xe7, 0xe7, 0xe8, - 0xe8, 0xe9, 0xe9, 0xea, 0xea, 0xeb, 0xeb, 0xec, 0xec, 0xed, 0xed, 0xee, - 0xee, 0xef, 0xef, 0xf0, - 0xf0, 0xf1, 0xf1, 0xf2, 0xf2, 0xf3, 0xf3, 0xf4, 0xf4, 0xf5, 0xf5, 0xf6, - 0xf6, 0xf7, 0xf7, 0xf8, - 0xf8, 0xf9, 0xf9, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfc, 0xfc, 0xfd, 0xfd, - 0xfe, 0xfe, 0xff, 0xff -}; +void +makegammatable (double gamma, int highlight, unsigned char *buf) +{ + int maxin = 255; /* 8 bit gamma input */ + int maxout = 255; /* 8 bit gamma output */ + int in = 0; + int out; + + buf[0] = 0x04; + buf[1] = 0x70; + buf[2] = 0x00; + buf[3] = 0x01; + + while (in < highlight) + { + out = maxout * pow ((double) in / highlight, (1.0 / gamma)); + buf[in + 4] = (unsigned char) out; + in++; + } + + while (in <= maxin) + { + buf[in + 4] = maxout; + in++; + } + + return; +} static void -cp2155_set_gamma (int fd) +cp2155_set_gamma (int fd, CANON_Handle * chndl) { DBG (1, "cp2155_set_gamma\n"); + unsigned char buf[260]; /* gamma tables */ - cp2155_write_gamma_block (fd, 0x000, cp2155_gamma_standard_data); - cp2155_write_gamma_block (fd, 0x100, cp2155_gamma_standard_data); - cp2155_write_gamma_block (fd, 0x200, cp2155_gamma_standard_data); + makegammatable (chndl->table_gamma, chndl->highlight_other, buf); + cp2155_write_gamma_block (fd, 0x000, buf); + cp2155_write_gamma_block (fd, 0x100, buf); + cp2155_write_gamma_block (fd, 0x200, buf); } static void -cp2155_set_gamma_red_enhanced (int fd) +cp2155_set_gamma_red_enhanced (int fd, CANON_Handle * chndl) { DBG (1, "cp2155_set_gamma\n"); + unsigned char buf[260]; /* gamma tables */ - cp2155_write_gamma_block (fd, 0x000, cp2155_gamma_red_enhanced_data); - cp2155_write_gamma_block (fd, 0x100, cp2155_gamma_standard_data); - cp2155_write_gamma_block (fd, 0x200, cp2155_gamma_standard_data); + makegammatable (chndl->table_gamma, chndl->highlight_red_enhanced, buf); + cp2155_write_gamma_block (fd, 0x000, buf); + makegammatable (chndl->table_gamma, chndl->highlight_other, buf); + cp2155_write_gamma_block (fd, 0x100, buf); + makegammatable (chndl->table_gamma_blue, chndl->highlight_blue_reduced, + buf); + cp2155_write_gamma_block (fd, 0x200, buf); +} + +void +make_descending_slope (size_t start_descent, double coefficient, + unsigned char *buf) +{ + size_t count, position; + int top_value; + int value; + unsigned char value_lo, value_hi; + DBG (1, "start_descent = %lx\n", start_descent); + top_value = buf[start_descent - 2] + 256 * buf[start_descent - 1]; + DBG (1, "buf[start_descent-2] = %02x buf[start_descent-1] = %02x\n", + buf[start_descent - 2], buf[start_descent - 1]); + count = buf[2] + 256 * buf[3]; + position = start_descent; + DBG (1, "count = %ld top_value = %d\n", count, top_value); + while (position < count + 4) + { + value = + (int) (top_value / + (1.0 + coefficient * (position + 2 - start_descent))); + value_lo = value & 0xff; + value_hi = (value >> 8) & 0xff; + buf[position] = value_lo; + buf[position + 1] = value_hi; + DBG (1, + "position = %03lx buf[position]= %02x buf[position+1] = %02x\n", + position, buf[position], buf[position + 1]); + position += 2; + } } void -make_buf (size_t count, unsigned char *buf) +make_constant_buf (size_t count, unsigned int hiword, unsigned int loword, + unsigned char *buf) { size_t i = 4; - int hiword = 62756; - int loword = 20918; unsigned char hihi = (hiword >> 8) & 0xff; unsigned char hilo = (hiword) & 0xff; unsigned char lohi = (loword >> 8) & 0xff; @@ -350,6 +347,27 @@ make_buf (size_t count, unsigned char *buf) } } +void +make_slope_table (size_t count, unsigned int word, size_t start_descent, + double coefficient, unsigned char *buf) +{ + size_t i = 4; + unsigned char hi = (word >> 8) & 0xff; + unsigned char lo = (word) & 0xff; + buf[0] = 0x04; + buf[1] = 0x70; + buf[2] = (count - 4) & 0xff; + buf[3] = ((count - 4) >> 8) & 0xff; + while (i < start_descent) + { + buf[i] = lo; + i++; + buf[i] = hi; + i++; + } + make_descending_slope (start_descent, coefficient, buf); +} + void write_buf (int fd, size_t count, unsigned char *buf, unsigned char value_74, unsigned char value_75) @@ -375,10 +393,31 @@ write_buf (int fd, size_t count, unsigned char *buf, void big_write (int fd, size_t count, unsigned char *buf) { - make_buf (count, buf); + make_constant_buf (count, 62756, 20918, buf); + write_buf (fd, count, buf, 0x00, 0x00); + write_buf (fd, count, buf, 0x00, 0xb0); + write_buf (fd, count, buf, 0x01, 0x60); + write_buf (fd, count, buf, 0x02, 0x10); +} + +void +big_write_2224 (int fd, size_t count, unsigned char *buf) +{ + make_constant_buf (count, 62756, 30918, buf); write_buf (fd, count, buf, 0x00, 0x00); write_buf (fd, count, buf, 0x00, 0xb0); write_buf (fd, count, buf, 0x01, 0x60); + write_buf (fd, count, buf, 0x02, 0x10); +} + +void +big_write_film (int fd, size_t count, unsigned char *buf) +{ + make_constant_buf (count, 62756, 20918, buf); + write_buf (fd, count, buf, 0x00, 0x00); + write_buf (fd, count, buf, 0x02, 0x00); + write_buf (fd, count, buf, 0x04, 0x00); + write_buf (fd, count, buf, 0x06, 0x00); } void @@ -421,6 +460,92 @@ general_motor_2224 (int fd) cp2155_set (fd, 0x0264, 0x20); } +void +register_table (int fd, unsigned char register_value, unsigned char *buf) +{ + cp2155_set (fd, 0x1a, 0x00); + cp2155_set (fd, 0x1b, 0x00); + cp2155_set (fd, 0x1c, 0x02); + cp2155_set (fd, 0x15, 0x80); + cp2155_set (fd, 0x14, 0x7c); + cp2155_set (fd, 0x17, 0x01); + cp2155_set (fd, 0x43, 0x1c); + cp2155_set (fd, 0x44, 0x9c); + cp2155_set (fd, 0x45, 0x38); + if (register_value > 0) + { + unsigned char register_number = 0x23; + while (register_number < 0x43) + { + cp2155_set (fd, register_number, register_value); + register_number++; + } + } + else + { + int buffer_index = 0; + cp2155_set (fd, 0x23 + buffer_index, buf[buffer_index]); + cp2155_set (fd, 0x33 + buffer_index, buf[buffer_index]); + buffer_index++; + while (buffer_index < 9) + { + cp2155_set (fd, 0x23 + buffer_index, buf[buffer_index]); + cp2155_set (fd, 0x33 + buffer_index, buf[buffer_index]); + cp2155_set (fd, 0x43 - buffer_index, buf[buffer_index]); + cp2155_set (fd, 0x33 - buffer_index, buf[buffer_index]); + buffer_index++; + } + } + + cp2155_set (fd, 0xca, 0x00); + cp2155_set (fd, 0xca, 0x00); + cp2155_set (fd, 0xca, 0x00); + +} + +void +register_table_4800 (int fd, unsigned char register_value, unsigned char *buf) +{ + cp2155_set (fd, 0x1a, 0x00); + cp2155_set (fd, 0x1b, 0x00); + cp2155_set (fd, 0x1c, 0x02); + cp2155_set (fd, 0x15, 0x80); + cp2155_set (fd, 0x14, 0x7a); + cp2155_set (fd, 0x17, 0x02); + cp2155_set (fd, 0x43, 0x1c); + cp2155_set (fd, 0x44, 0x9c); + cp2155_set (fd, 0x45, 0x38); + if (register_value > 0) + { + unsigned char register_number = 0x23; + while (register_number < 0x43) + { + cp2155_set (fd, register_number, register_value); + register_number++; + } + } + else + { + int buffer_index = 0; + cp2155_set (fd, 0x23 + buffer_index, buf[buffer_index]); + cp2155_set (fd, 0x33 + buffer_index, buf[buffer_index]); + buffer_index++; + while (buffer_index < 9) + { + cp2155_set (fd, 0x23 + buffer_index, buf[buffer_index]); + cp2155_set (fd, 0x33 + buffer_index, buf[buffer_index]); + cp2155_set (fd, 0x43 - buffer_index, buf[buffer_index]); + cp2155_set (fd, 0x33 - buffer_index, buf[buffer_index]); + buffer_index++; + } + } + + cp2155_set (fd, 0xca, 0x00); + cp2155_set (fd, 0xca, 0x00); + cp2155_set (fd, 0xca, 0x00); + +} + void startblob_2225_0075 (CANON_Handle * chndl, unsigned char *buf) { @@ -429,6 +554,15 @@ startblob_2225_0075 (CANON_Handle * chndl, unsigned char *buf) fd = chndl->fd; size_t count; + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2e; + +/* original: + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2e; + ratio 320 decimal + +*/ cp2155_set (fd, 0x90, 0xd8); cp2155_set (fd, 0x90, 0xd8); cp2155_set (fd, 0xb0, 0x03); @@ -445,7 +579,7 @@ startblob_2225_0075 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x2e); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); @@ -506,114 +640,21 @@ startblob_2225_0075 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x83); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x28); - cp2155_set (fd, 0x33, 0x28); - cp2155_set (fd, 0x24, 0x27); - cp2155_set (fd, 0x34, 0x27); - cp2155_set (fd, 0x25, 0x25); - cp2155_set (fd, 0x35, 0x25); - cp2155_set (fd, 0x26, 0x21); - cp2155_set (fd, 0x36, 0x21); - cp2155_set (fd, 0x27, 0x1c); - cp2155_set (fd, 0x37, 0x1c); - cp2155_set (fd, 0x28, 0x16); - cp2155_set (fd, 0x38, 0x16); - cp2155_set (fd, 0x29, 0x0f); - cp2155_set (fd, 0x39, 0x0f); - cp2155_set (fd, 0x2a, 0x08); - cp2155_set (fd, 0x3a, 0x08); - cp2155_set (fd, 0x2b, 0x00); - cp2155_set (fd, 0x3b, 0x00); - cp2155_set (fd, 0x2c, 0x08); - cp2155_set (fd, 0x3c, 0x08); - cp2155_set (fd, 0x2d, 0x0f); - cp2155_set (fd, 0x3d, 0x0f); - cp2155_set (fd, 0x2e, 0x16); - cp2155_set (fd, 0x3e, 0x16); - cp2155_set (fd, 0x2f, 0x1c); - cp2155_set (fd, 0x3f, 0x1c); - cp2155_set (fd, 0x30, 0x21); - cp2155_set (fd, 0x40, 0x21); - cp2155_set (fd, 0x31, 0x25); - cp2155_set (fd, 0x41, 0x25); - cp2155_set (fd, 0x32, 0x27); - cp2155_set (fd, 0x42, 0x27); - cp2155_set (fd, 0xca, 0x01); - cp2155_set (fd, 0xca, 0x01); - cp2155_set (fd, 0xca, 0x11); + + memcpy (buf, "\x28\x27\x25\x21\x1c\x16\x0f\x08\x00", 9); + register_table (fd, 0, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x00000000, - "\x04\x70\x00\x01\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000010, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000030, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000040, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000050, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000060, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\xf0\x23\x80\x22\x2c\x21", - 16); - memcpy (buf + 0x00000070, - "\xf1\x1f\xcd\x1e\xbd\x1d\xc0\x1c\xd2\x1b\xf4\x1a\x22\x1a\x5e\x19", - 16); - memcpy (buf + 0x00000080, - "\xa4\x18\xf5\x17\x4f\x17\xb2\x16\x1d\x16\x90\x15\x09\x15\x89\x14", - 16); - memcpy (buf + 0x00000090, - "\x0e\x14\x9a\x13\x2a\x13\xc0\x12\x59\x12\xf8\x11\x9a\x11\x3f\x11", - 16); - memcpy (buf + 0x000000a0, - "\xe9\x10\x96\x10\x46\x10\xf8\x0f\xae\x0f\x66\x0f\x21\x0f\xde\x0e", - 16); - memcpy (buf + 0x000000b0, - "\x9e\x0e\x60\x0e\x23\x0e\xe9\x0d\xb0\x0d\x7a\x0d\x44\x0d\x11\x0d", - 16); - memcpy (buf + 0x000000c0, - "\xdf\x0c\xaf\x0c\x80\x0c\x52\x0c\x25\x0c\xfa\x0b\xd0\x0b\xa7\x0b", - 16); - memcpy (buf + 0x000000d0, - "\x80\x0b\x59\x0b\x33\x0b\x0e\x0b\xea\x0a\xc8\x0a\xa5\x0a\x84\x0a", - 16); - memcpy (buf + 0x000000e0, - "\x64\x0a\x44\x0a\x25\x0a\x07\x0a\xe9\x09\xcd\x09\xb0\x09\x95\x09", - 16); - memcpy (buf + 0x000000f0, - "\x7a\x09\x60\x09\x46\x09\x2c\x09\x14\x09\xfc\x08\xe4\x08\xcd\x08", - 16); - memcpy (buf + 0x00000100, "\xb6\x08\xa0\x08", 4); count = 260; + make_slope_table (count, top_value, 0x6a, 0.021739, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x25\xc0\x1c\x4f\x17\x9a\x13\xe9\x10\xde\x0e", - 16); - memcpy (buf + 0x00000010, - "\x44\x0d\xfa\x0b\xea\x0a\x07\x0a\x46\x09\xa0\x08\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, "\x80\x25\x80\x25", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.15217, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -628,6 +669,14 @@ startblob_2225_0150 (CANON_Handle * chndl, unsigned char *buf) fd = chndl->fd; size_t count; + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x1e; + +/* original: + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x1e; + ratio 320 decimal +*/ cp2155_set (fd, 0x90, 0xd8); cp2155_set (fd, 0x90, 0xd8); cp2155_set (fd, 0xb0, 0x02); @@ -644,7 +693,7 @@ startblob_2225_0150 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x1e); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0xa0); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); @@ -705,125 +754,21 @@ startblob_2225_0150 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x84); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x28); - cp2155_set (fd, 0x33, 0x28); - cp2155_set (fd, 0x24, 0x27); - cp2155_set (fd, 0x34, 0x27); - cp2155_set (fd, 0x25, 0x25); - cp2155_set (fd, 0x35, 0x25); - cp2155_set (fd, 0x26, 0x21); - cp2155_set (fd, 0x36, 0x21); - cp2155_set (fd, 0x27, 0x1c); - cp2155_set (fd, 0x37, 0x1c); - cp2155_set (fd, 0x28, 0x16); - cp2155_set (fd, 0x38, 0x16); - cp2155_set (fd, 0x29, 0x0f); - cp2155_set (fd, 0x39, 0x0f); - cp2155_set (fd, 0x2a, 0x08); - cp2155_set (fd, 0x3a, 0x08); - cp2155_set (fd, 0x2b, 0x00); - cp2155_set (fd, 0x3b, 0x00); - cp2155_set (fd, 0x2c, 0x08); - cp2155_set (fd, 0x3c, 0x08); - cp2155_set (fd, 0x2d, 0x0f); - cp2155_set (fd, 0x3d, 0x0f); - cp2155_set (fd, 0x2e, 0x16); - cp2155_set (fd, 0x3e, 0x16); - cp2155_set (fd, 0x2f, 0x1c); - cp2155_set (fd, 0x3f, 0x1c); - cp2155_set (fd, 0x30, 0x21); - cp2155_set (fd, 0x40, 0x21); - cp2155_set (fd, 0x31, 0x25); - cp2155_set (fd, 0x41, 0x25); - cp2155_set (fd, 0x32, 0x27); - cp2155_set (fd, 0x42, 0x27); - cp2155_set (fd, 0xca, 0x01); - cp2155_set (fd, 0xca, 0x01); - cp2155_set (fd, 0xca, 0x11); + + memcpy (buf, "\x28\x27\x25\x21\x1c\x16\x0f\x08\x00", 9); + register_table (fd, 0, buf); cp2155_set (fd, 0x18, 0x00); - cp2155_set (fd, 0x71, 0x01); - cp2155_set (fd, 0x0230, 0x11); - cp2155_set (fd, 0x71, 0x14); - cp2155_set (fd, 0x72, 0x01); - cp2155_set (fd, 0x73, 0x00); - cp2155_set (fd, 0x74, 0x03); - cp2155_set (fd, 0x75, 0x00); - cp2155_set (fd, 0x76, 0x00); - cp2155_set (fd, 0x0239, 0x40); - cp2155_set (fd, 0x0238, 0x89); - cp2155_set (fd, 0x023c, 0x2f); - cp2155_set (fd, 0x0264, 0x20); - memcpy (buf + 0x00000000, - "\x04\x70\x00\x01\x80\x25\xd7\x24\x35\x24\x98\x23\x00\x23\x6d\x22", - 16); - memcpy (buf + 0x00000010, - "\xdf\x21\x56\x21\xd1\x20\x50\x20\xd2\x1f\x59\x1f\xe3\x1e\x70\x1e", - 16); - memcpy (buf + 0x00000020, - "\x01\x1e\x95\x1d\x2c\x1d\xc6\x1c\x62\x1c\x02\x1c\xa3\x1b\x47\x1b", - 16); - memcpy (buf + 0x00000030, - "\xee\x1a\x97\x1a\x42\x1a\xef\x19\x9e\x19\x4f\x19\x02\x19\xb7\x18", - 16); - memcpy (buf + 0x00000040, - "\x6d\x18\x25\x18\xdf\x17\x9a\x17\x57\x17\x16\x17\xd6\x16\x97\x16", - 16); - memcpy (buf + 0x00000050, - "\x59\x16\x1d\x16\xe2\x15\xa8\x15\x70\x15\x38\x15\x02\x15\xcd\x14", - 16); - memcpy (buf + 0x00000060, - "\x99\x14\x66\x14\x33\x14\x02\x14\xd2\x13\xa2\x13\x74\x13\x46\x13", - 16); - memcpy (buf + 0x00000070, - "\x19\x13\xed\x12\xc2\x12\x98\x12\x6e\x12\x45\x12\x1d\x12\xf5\x11", - 16); - memcpy (buf + 0x00000080, - "\xce\x11\xa8\x11\x82\x11\x5d\x11\x39\x11\x15\x11\xf2\x10\xcf\x10", - 16); - memcpy (buf + 0x00000090, - "\xad\x10\x8b\x10\x6a\x10\x4a\x10\x2a\x10\x0a\x10\xeb\x0f\xcc\x0f", - 16); - memcpy (buf + 0x000000a0, - "\xae\x0f\x90\x0f\x73\x0f\x56\x0f\x3a\x0f\x1e\x0f\x02\x0f\xe7\x0e", - 16); - memcpy (buf + 0x000000b0, - "\xcc\x0e\xb2\x0e\x97\x0e\x7e\x0e\x64\x0e\x4b\x0e\x32\x0e\x1a\x0e", - 16); - memcpy (buf + 0x000000c0, - "\x02\x0e\xea\x0d\xd3\x0d\xbc\x0d\xa5\x0d\x8e\x0d\x78\x0d\x62\x0d", - 16); - memcpy (buf + 0x000000d0, - "\x4d\x0d\x37\x0d\x22\x0d\x0d\x0d\xf8\x0c\xe4\x0c\xd0\x0c\xbc\x0c", - 16); - memcpy (buf + 0x000000e0, - "\xa8\x0c\x95\x0c\x82\x0c\x6f\x0c\x5c\x0c\x4a\x0c\x37\x0c\x25\x0c", - 16); - memcpy (buf + 0x000000f0, - "\x14\x0c\x02\x0c\xf0\x0b\xdf\x0b\xce\x0b\xbd\x0b\xac\x0b\x9c\x0b", - 16); - memcpy (buf + 0x00000100, "\x8c\x0b\x7c\x0b", 4); + count = 260; + make_slope_table (count, top_value, 0x06, 0.0089185, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x25\x18\x1f\x8f\x1a\x2d\x17\x8f\x14\x79\x12", - 16); - memcpy (buf + 0x00000010, - "\xc6\x10\x5b\x0f\x2a\x0e\x24\x0d\x41\x0c\x7c\x0b\xe3\x1e\x70\x1e", - 16); - memcpy (buf + 0x00000020, "\x01\x1e\x95\x1d", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.102968, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -838,6 +783,14 @@ startblob_2225_0300 (CANON_Handle * chndl, unsigned char *buf) fd = chndl->fd; size_t count; + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2a; + +/* original: + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2a; + ratio 228 decimal +*/ cp2155_set (fd, 0x90, 0xd8); cp2155_set (fd, 0x90, 0xd8); cp2155_set (fd, 0xb0, 0x01); @@ -854,7 +807,7 @@ startblob_2225_0300 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x2a); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0x80); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); @@ -915,75 +868,20 @@ startblob_2225_0300 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x83); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x14); - cp2155_set (fd, 0x33, 0x14); - cp2155_set (fd, 0x24, 0x14); - cp2155_set (fd, 0x34, 0x14); - cp2155_set (fd, 0x25, 0x14); - cp2155_set (fd, 0x35, 0x14); - cp2155_set (fd, 0x26, 0x14); - cp2155_set (fd, 0x36, 0x14); - cp2155_set (fd, 0x27, 0x14); - cp2155_set (fd, 0x37, 0x14); - cp2155_set (fd, 0x28, 0x14); - cp2155_set (fd, 0x38, 0x14); - cp2155_set (fd, 0x29, 0x14); - cp2155_set (fd, 0x39, 0x14); - cp2155_set (fd, 0x2a, 0x14); - cp2155_set (fd, 0x3a, 0x14); - cp2155_set (fd, 0x2b, 0x14); - cp2155_set (fd, 0x3b, 0x14); - cp2155_set (fd, 0x2c, 0x14); - cp2155_set (fd, 0x3c, 0x14); - cp2155_set (fd, 0x2d, 0x14); - cp2155_set (fd, 0x3d, 0x14); - cp2155_set (fd, 0x2e, 0x14); - cp2155_set (fd, 0x3e, 0x14); - cp2155_set (fd, 0x2f, 0x14); - cp2155_set (fd, 0x3f, 0x14); - cp2155_set (fd, 0x30, 0x14); - cp2155_set (fd, 0x40, 0x14); - cp2155_set (fd, 0x31, 0x14); - cp2155_set (fd, 0x41, 0x14); - cp2155_set (fd, 0x32, 0x14); - cp2155_set (fd, 0x42, 0x14); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); + + register_table (fd, 0x14, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x00000000, - "\x04\x70\x30\x00\x80\x25\x36\x25\xee\x24\xa8\x24\x62\x24\x1d\x24", - 16); - memcpy (buf + 0x00000010, - "\xd9\x23\x96\x23\x54\x23\x13\x23\xd3\x22\x94\x22\x56\x22\x19\x22", - 16); - memcpy (buf + 0x00000020, - "\xdc\x21\xa1\x21\x66\x21\x2c\x21\xf3\x20\xba\x20\x82\x20\x4b\x20", - 16); - memcpy (buf + 0x00000030, "\x15\x20\xe0\x1f", 4); count = 52; + make_slope_table (count, top_value, 0x06, 0.0038363, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x25\xe8\x24\x55\x24\xc7\x23\x3d\x23\xb7\x22", - 16); - memcpy (buf + 0x00000010, - "\x35\x22\xb6\x21\x3c\x21\xc4\x20\x50\x20\xe0\x1f\x56\x22\x19\x22", - 16); - memcpy (buf + 0x00000020, "\xdc\x21\xa1\x21", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.0080213, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -998,6 +896,14 @@ startblob_2225_0600 (CANON_Handle * chndl, unsigned char *buf) fd = chndl->fd; size_t count; + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x15; + +/* original: + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x15; + ratio 457 decimal +*/ cp2155_set (fd, 0x90, 0xd8); cp2155_set (fd, 0x90, 0xd8); cp2155_set (fd, 0xb0, 0x00); @@ -1014,7 +920,7 @@ startblob_2225_0600 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x15); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0xe0); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); @@ -1072,81 +978,20 @@ startblob_2225_0600 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x01); - cp2155_set (fd, 0x14, 0x01); - cp2155_set (fd, 0x17, 0x01); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x14); - cp2155_set (fd, 0x33, 0x14); - cp2155_set (fd, 0x24, 0x14); - cp2155_set (fd, 0x34, 0x14); - cp2155_set (fd, 0x25, 0x14); - cp2155_set (fd, 0x35, 0x14); - cp2155_set (fd, 0x26, 0x14); - cp2155_set (fd, 0x36, 0x14); - cp2155_set (fd, 0x27, 0x14); - cp2155_set (fd, 0x37, 0x14); - cp2155_set (fd, 0x28, 0x14); - cp2155_set (fd, 0x38, 0x14); - cp2155_set (fd, 0x29, 0x14); - cp2155_set (fd, 0x39, 0x14); - cp2155_set (fd, 0x2a, 0x14); - cp2155_set (fd, 0x3a, 0x14); - cp2155_set (fd, 0x2b, 0x14); - cp2155_set (fd, 0x3b, 0x14); - cp2155_set (fd, 0x2c, 0x14); - cp2155_set (fd, 0x3c, 0x14); - cp2155_set (fd, 0x2d, 0x14); - cp2155_set (fd, 0x3d, 0x14); - cp2155_set (fd, 0x2e, 0x14); - cp2155_set (fd, 0x3e, 0x14); - cp2155_set (fd, 0x2f, 0x14); - cp2155_set (fd, 0x3f, 0x14); - cp2155_set (fd, 0x30, 0x14); - cp2155_set (fd, 0x40, 0x14); - cp2155_set (fd, 0x31, 0x14); - cp2155_set (fd, 0x41, 0x14); - cp2155_set (fd, 0x32, 0x14); - cp2155_set (fd, 0x42, 0x14); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); + + register_table (fd, 0x14, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x0000, - "\x04\x70\x50\x00\x80\x25\x58\x25\x32\x25\x0b\x25\xe5\x24\xc0\x24", - 16); - memcpy (buf + 0x0010, - "\x9a\x24\x75\x24\x50\x24\x2b\x24\x07\x24\xe3\x23\xbf\x23\x9c\x23", - 16); - memcpy (buf + 0x0020, - "\x79\x23\x56\x23\x33\x23\x11\x23\xee\x22\xcd\x22\xab\x22\x8a\x22", - 16); - memcpy (buf + 0x0030, - "\x68\x22\x48\x22\x27\x22\x07\x22\xe6\x21\xc7\x21\xa7\x21\x87\x21", - 16); - memcpy (buf + 0x0040, - "\x68\x21\x49\x21\x2a\x21\x0c\x21\xee\x20\xd0\x20\x00\x00\x00\x00", - 16); - memcpy (buf + 0x0050, "\x00\x00\x00\x00", 4); count = 84; + make_slope_table (count, top_value, 0x06, 0.0020408, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x0000, - "\x04\x70\x20\x00\x80\x25\x04\x25\x8c\x24\x18\x24\xa5\x23\x36\x23", - 16); - memcpy (buf + 0x0010, - "\xca\x22\x60\x22\xf8\x21\x93\x21\x30\x21\xd0\x20\x00\x00\x00\x00", - 16); - memcpy (buf + 0x0020, "\x00\x00\x00\x00", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.0064935, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -1154,15 +999,22 @@ startblob_2225_0600 (CANON_Handle * chndl, unsigned char *buf) } void -startblob_2225_0600_extra (CANON_Handle * chndl, unsigned char *buf) +startblob_2225_1200 (CANON_Handle * chndl, unsigned char *buf) { int fd; fd = chndl->fd; size_t count; - cp2155_set (fd, 0x90, 0xd8); - cp2155_set (fd, 0x90, 0xd8); + unsigned int top_value = 0xff00; + unsigned char value_62 = 0xaa; + +/* original: + unsigned int top_value = 0xff00; + unsigned char value_62 = 0xaa; +*/ + cp2155_set (fd, 0x90, 0xc8); + cp2155_set (fd, 0x90, 0xe8); cp2155_set (fd, 0xb0, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x07, 0x00); @@ -1172,12 +1024,12 @@ startblob_2225_0600_extra (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x0b, chndl->value_0b); cp2155_set (fd, 0xa0, 0x1d); cp2155_set (fd, 0xa1, 0x00); - cp2155_set (fd, 0xa2, 0x31); - cp2155_set (fd, 0xa3, 0xf0); + cp2155_set (fd, 0xa2, 0x63); + cp2155_set (fd, 0xa3, 0xd0); cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x55); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); @@ -1186,12 +1038,12 @@ startblob_2225_0600_extra (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x5b, 0x32); cp2155_set (fd, 0x5c, 0x32); cp2155_set (fd, 0x5d, 0x32); - cp2155_set (fd, 0x52, 0x09); - cp2155_set (fd, 0x53, 0x5a); - cp2155_set (fd, 0x54, 0x06); - cp2155_set (fd, 0x55, 0x08); - cp2155_set (fd, 0x56, 0x05); - cp2155_set (fd, 0x57, 0x5f); + cp2155_set (fd, 0x52, 0x11); + cp2155_set (fd, 0x53, 0x50); + cp2155_set (fd, 0x54, 0x0c); + cp2155_set (fd, 0x55, 0x01); + cp2155_set (fd, 0x56, 0x0a); + cp2155_set (fd, 0x57, 0xae); cp2155_set (fd, 0x58, 0xa9); cp2155_set (fd, 0x59, 0xce); cp2155_set (fd, 0x5e, 0x02); @@ -1213,7 +1065,7 @@ startblob_2225_0600_extra (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x80, 0x12); cp2155_set (fd, 0xb0, 0x08); - big_write (fd, 0x5174, buf); + big_write (fd, 0xa1a4, buf); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); @@ -1236,62 +1088,16 @@ startblob_2225_0600_extra (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x1e, 0x00); cp2155_set (fd, 0x1f, 0x04); cp2155_set (fd, 0x66, 0x00); - cp2155_set (fd, 0x67, 0x0f); - cp2155_set (fd, 0x68, 0x39); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x80); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x01); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x14); - cp2155_set (fd, 0x33, 0x14); - cp2155_set (fd, 0x24, 0x14); - cp2155_set (fd, 0x34, 0x14); - cp2155_set (fd, 0x25, 0x14); - cp2155_set (fd, 0x35, 0x14); - cp2155_set (fd, 0x26, 0x14); - cp2155_set (fd, 0x36, 0x14); - cp2155_set (fd, 0x27, 0x14); - cp2155_set (fd, 0x37, 0x14); - cp2155_set (fd, 0x28, 0x14); - cp2155_set (fd, 0x38, 0x14); - cp2155_set (fd, 0x29, 0x14); - cp2155_set (fd, 0x39, 0x14); - cp2155_set (fd, 0x2a, 0x14); - cp2155_set (fd, 0x3a, 0x14); - cp2155_set (fd, 0x2b, 0x14); - cp2155_set (fd, 0x3b, 0x14); - cp2155_set (fd, 0x2c, 0x14); - cp2155_set (fd, 0x3c, 0x14); - cp2155_set (fd, 0x2d, 0x14); - cp2155_set (fd, 0x3d, 0x14); - cp2155_set (fd, 0x2e, 0x14); - cp2155_set (fd, 0x3e, 0x14); - cp2155_set (fd, 0x2f, 0x14); - cp2155_set (fd, 0x3f, 0x14); - cp2155_set (fd, 0x30, 0x14); - cp2155_set (fd, 0x40, 0x14); - cp2155_set (fd, 0x31, 0x14); - cp2155_set (fd, 0x41, 0x14); - cp2155_set (fd, 0x32, 0x14); - cp2155_set (fd, 0x42, 0x14); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0x18, 0x00); + cp2155_set (fd, 0x67, chndl->value_67); + cp2155_set (fd, 0x68, chndl->value_68); + + memcpy (buf, "\x14\x14\x12\x11\x0e\x0b\x08\x04\x00", 9); + register_table (fd, 0, buf); + cp2155_set (fd, 0x18, 0x01); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000010, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x00\x00\x00\x00", - 16); - memcpy (buf + 0x00000020, "\x00\x00\x00\x00", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.0, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); @@ -1302,16 +1108,26 @@ startblob_2225_0600_extra (CANON_Handle * chndl, unsigned char *buf) } void -startblob_2225_1200 (CANON_Handle * chndl, unsigned char *buf) +startblob_2224_0075 (CANON_Handle * chndl, unsigned char *buf) { int fd; fd = chndl->fd; size_t count; - cp2155_set (fd, 0x90, 0xc8); + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2e; + +/* original: + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2e; + ratio 208 decimal +*/ cp2155_set (fd, 0x90, 0xe8); - cp2155_set (fd, 0xb0, 0x00); + cp2155_set (fd, 0x9b, 0x06); + cp2155_set (fd, 0x9b, 0x04); + cp2155_set (fd, 0x90, 0xf8); + cp2155_set (fd, 0xb0, 0x03); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x08, chndl->value_08); @@ -1320,148 +1136,115 @@ startblob_2225_1200 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x0b, chndl->value_0b); cp2155_set (fd, 0xa0, 0x1d); cp2155_set (fd, 0xa1, 0x00); - cp2155_set (fd, 0xa2, 0x63); - cp2155_set (fd, 0xa3, 0xd0); + cp2155_set (fd, 0xa2, 0x06); + cp2155_set (fd, 0xa3, 0x70); cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0xaa); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); + cp2155_set (fd, 0x90, 0xf8); cp2155_set (fd, 0x51, chndl->value_51); - cp2155_set (fd, 0x5a, 0x32); - cp2155_set (fd, 0x5b, 0x32); - cp2155_set (fd, 0x5c, 0x32); - cp2155_set (fd, 0x5d, 0x32); - cp2155_set (fd, 0x52, 0x11); - cp2155_set (fd, 0x53, 0x50); + cp2155_set (fd, 0x5a, 0xff); + cp2155_set (fd, 0x5b, 0xff); + cp2155_set (fd, 0x5c, 0xff); + cp2155_set (fd, 0x5d, 0xff); + cp2155_set (fd, 0x52, 0x0c); + cp2155_set (fd, 0x53, 0xda); cp2155_set (fd, 0x54, 0x0c); - cp2155_set (fd, 0x55, 0x01); - cp2155_set (fd, 0x56, 0x0a); - cp2155_set (fd, 0x57, 0xae); - cp2155_set (fd, 0x58, 0xa9); - cp2155_set (fd, 0x59, 0xce); + cp2155_set (fd, 0x55, 0x44); + cp2155_set (fd, 0x56, 0x08); + cp2155_set (fd, 0x57, 0xbb); + cp2155_set (fd, 0x58, 0x1d); + cp2155_set (fd, 0x59, 0xa1); cp2155_set (fd, 0x5e, 0x02); cp2155_set (fd, 0x5f, 0x00); cp2155_set (fd, 0x5f, 0x03); - cp2155_set (fd, 0x60, 0x15); - cp2155_set (fd, 0x60, 0x15); - cp2155_set (fd, 0x60, 0x15); - cp2155_set (fd, 0x60, 0x15); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x51, chndl->value_51); - cp2155_set (fd, 0x81, 0x29); - cp2155_set (fd, 0x81, 0x29); - cp2155_set (fd, 0x82, 0x09); - cp2155_set (fd, 0x82, 0x09); - cp2155_set (fd, 0x83, 0x02); - cp2155_set (fd, 0x84, 0x06); + cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x82, 0x11); + cp2155_set (fd, 0x82, 0x11); + cp2155_set (fd, 0x83, 0x01); + cp2155_set (fd, 0x84, 0x05); cp2155_set (fd, 0x80, 0x12); cp2155_set (fd, 0x80, 0x12); - cp2155_set (fd, 0xb0, 0x08); + cp2155_set (fd, 0xb0, 0x0b); - big_write (fd, 0xa1a4, buf); + big_write (fd, 0x5694, buf); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); - cp2155_set (fd, 0x9b, 0x01); cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x11, 0xc1); + cp2155_set (fd, 0x11, 0xc1); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x12, 0x06); - cp2155_set (fd, 0x13, 0x06); - cp2155_set (fd, 0x16, 0x06); + cp2155_set (fd, 0x12, 0x7d); + cp2155_set (fd, 0x13, 0x7d); + cp2155_set (fd, 0x16, 0x7d); cp2155_set (fd, 0x21, 0x06); - cp2155_set (fd, 0x22, 0x06); + cp2155_set (fd, 0x22, 0x7d); cp2155_set (fd, 0x20, 0x06); cp2155_set (fd, 0x1d, 0x00); cp2155_set (fd, 0x1e, 0x00); - cp2155_set (fd, 0x1f, 0x04); + cp2155_set (fd, 0x1f, 0x71); cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x80); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x01); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x14); - cp2155_set (fd, 0x33, 0x14); - cp2155_set (fd, 0x24, 0x14); - cp2155_set (fd, 0x34, 0x14); - cp2155_set (fd, 0x25, 0x12); - cp2155_set (fd, 0x35, 0x12); - cp2155_set (fd, 0x26, 0x11); - cp2155_set (fd, 0x36, 0x11); - cp2155_set (fd, 0x27, 0x0e); - cp2155_set (fd, 0x37, 0x0e); - cp2155_set (fd, 0x28, 0x0b); - cp2155_set (fd, 0x38, 0x0b); - cp2155_set (fd, 0x29, 0x08); - cp2155_set (fd, 0x39, 0x08); - cp2155_set (fd, 0x2a, 0x04); - cp2155_set (fd, 0x3a, 0x04); - cp2155_set (fd, 0x2b, 0x00); - cp2155_set (fd, 0x3b, 0x00); - cp2155_set (fd, 0x2c, 0x04); - cp2155_set (fd, 0x3c, 0x04); - cp2155_set (fd, 0x2d, 0x08); - cp2155_set (fd, 0x3d, 0x08); - cp2155_set (fd, 0x2e, 0x0b); - cp2155_set (fd, 0x3e, 0x0b); - cp2155_set (fd, 0x2f, 0x0e); - cp2155_set (fd, 0x3f, 0x0e); - cp2155_set (fd, 0x30, 0x11); - cp2155_set (fd, 0x40, 0x11); - cp2155_set (fd, 0x31, 0x12); - cp2155_set (fd, 0x41, 0x12); - cp2155_set (fd, 0x32, 0x14); - cp2155_set (fd, 0x42, 0x14); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0x18, 0x01); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff", - 16); - memcpy (buf + 0x00000010, - "\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00", - 16); - memcpy (buf + 0x00000020, "\x00\x00\x00\x00", 4); - count = 36; + register_table (fd, 0x0f, buf); + cp2155_set (fd, 0x18, 0x00); + + count = 516; + make_slope_table (count, top_value, 0x6a, 0.0084116, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); + + count = 36; + make_slope_table (count, top_value, 0x06, 0.15217, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); - general_motor_2225 (fd); + general_motor_2224 (fd); + } void -startblob_2224_0075 (CANON_Handle * chndl, unsigned char *buf) +startblob_2224_0150 (CANON_Handle * chndl, unsigned char *buf) { int fd; fd = chndl->fd; size_t count; + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x1e; + +/* original: + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x1e; + ratio 320 decimal +*/ cp2155_set (fd, 0x90, 0xe8); cp2155_set (fd, 0x9b, 0x06); cp2155_set (fd, 0x9b, 0x04); cp2155_set (fd, 0x90, 0xf8); - cp2155_set (fd, 0xb0, 0x03); + cp2155_set (fd, 0xb0, 0x02); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x08, chndl->value_08); @@ -1470,13 +1253,13 @@ startblob_2224_0075 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x0b, chndl->value_0b); cp2155_set (fd, 0xa0, 0x1d); cp2155_set (fd, 0xa1, 0x00); - cp2155_set (fd, 0xa2, 0x06); - cp2155_set (fd, 0xa3, 0x70); + cp2155_set (fd, 0xa2, 0x0c); + cp2155_set (fd, 0xa3, 0xd0); cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x2e); - cp2155_set (fd, 0x63, 0x00); + cp2155_set (fd, 0x62, value_62); + cp2155_set (fd, 0x63, 0xa0); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x90, 0xf8); @@ -1510,7 +1293,7 @@ startblob_2224_0075 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x84, 0x05); cp2155_set (fd, 0x80, 0x12); cp2155_set (fd, 0x80, 0x12); - cp2155_set (fd, 0xb0, 0x0b); + cp2155_set (fd, 0xb0, 0x0a); big_write (fd, 0x5694, buf); @@ -1518,181 +1301,39 @@ startblob_2224_0075 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); - cp2155_set (fd, 0x11, 0xc1); - cp2155_set (fd, 0x11, 0xc1); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x12, 0x7d); - cp2155_set (fd, 0x13, 0x7d); - cp2155_set (fd, 0x16, 0x7d); + cp2155_set (fd, 0x11, 0x81); + cp2155_set (fd, 0x11, 0x81); + cp2155_set (fd, 0x12, 0x40); + cp2155_set (fd, 0x13, 0x40); + cp2155_set (fd, 0x16, 0x40); cp2155_set (fd, 0x21, 0x06); - cp2155_set (fd, 0x22, 0x7d); + cp2155_set (fd, 0x22, 0x40); cp2155_set (fd, 0x20, 0x06); cp2155_set (fd, 0x1d, 0x00); cp2155_set (fd, 0x1e, 0x00); - cp2155_set (fd, 0x1f, 0x71); + cp2155_set (fd, 0x1f, 0x04); cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x83); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x0f); - cp2155_set (fd, 0x33, 0x0f); - cp2155_set (fd, 0x24, 0x0f); - cp2155_set (fd, 0x34, 0x0f); - cp2155_set (fd, 0x25, 0x0f); - cp2155_set (fd, 0x35, 0x0f); - cp2155_set (fd, 0x26, 0x0f); - cp2155_set (fd, 0x36, 0x0f); - cp2155_set (fd, 0x27, 0x0f); - cp2155_set (fd, 0x37, 0x0f); - cp2155_set (fd, 0x28, 0x0f); - cp2155_set (fd, 0x38, 0x0f); - cp2155_set (fd, 0x29, 0x0f); - cp2155_set (fd, 0x39, 0x0f); - cp2155_set (fd, 0x2a, 0x0f); - cp2155_set (fd, 0x3a, 0x0f); - cp2155_set (fd, 0x2b, 0x0f); - cp2155_set (fd, 0x3b, 0x0f); - cp2155_set (fd, 0x2c, 0x0f); - cp2155_set (fd, 0x3c, 0x0f); - cp2155_set (fd, 0x2d, 0x0f); - cp2155_set (fd, 0x3d, 0x0f); - cp2155_set (fd, 0x2e, 0x0f); - cp2155_set (fd, 0x3e, 0x0f); - cp2155_set (fd, 0x2f, 0x0f); - cp2155_set (fd, 0x3f, 0x0f); - cp2155_set (fd, 0x30, 0x0f); - cp2155_set (fd, 0x40, 0x0f); - cp2155_set (fd, 0x31, 0x0f); - cp2155_set (fd, 0x41, 0x0f); - cp2155_set (fd, 0x32, 0x0f); - cp2155_set (fd, 0x42, 0x0f); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); + + register_table (fd, 0x0d, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x00000000, - "\x04\x70\xf4\x01\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000010, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000030, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000040, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000050, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000060, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\xe1\x24\x47\x24\xb2\x23", - 16); - memcpy (buf + 0x00000070, - "\x22\x23\x97\x22\x0f\x22\x8c\x21\x0d\x21\x91\x20\x19\x20\xa4\x1f", - 16); - memcpy (buf + 0x00000080, - "\x33\x1f\xc5\x1e\x59\x1e\xf1\x1d\x8b\x1d\x29\x1d\xc8\x1c\x6a\x1c", - 16); - memcpy (buf + 0x00000090, - "\x0f\x1c\xb5\x1b\x5e\x1b\x09\x1b\xb6\x1a\x65\x1a\x16\x1a\xc9\x19", - 16); - memcpy (buf + 0x000000a0, - "\x7d\x19\x34\x19\xec\x18\xa5\x18\x60\x18\x1c\x18\xda\x17\x9a\x17", - 16); - memcpy (buf + 0x000000b0, - "\x5a\x17\x1c\x17\xe0\x16\xa4\x16\x6a\x16\x31\x16\xf9\x15\xc2\x15", - 16); - memcpy (buf + 0x000000c0, - "\x8c\x15\x57\x15\x23\x15\xf1\x14\xbf\x14\x8e\x14\x5e\x14\x2e\x14", - 16); - memcpy (buf + 0x000000d0, - "\x00\x14\xd2\x13\xa6\x13\x7a\x13\x4f\x13\x24\x13\xfa\x12\xd1\x12", - 16); - memcpy (buf + 0x000000e0, - "\xa9\x12\x81\x12\x5a\x12\x34\x12\x0e\x12\xe9\x11\xc5\x11\xa1\x11", - 16); - memcpy (buf + 0x000000f0, - "\x7d\x11\x5a\x11\x38\x11\x16\x11\xf5\x10\xd4\x10\xb4\x10\x94\x10", - 16); - memcpy (buf + 0x00000100, - "\x75\x10\x56\x10\x37\x10\x19\x10\xfc\x0f\xdf\x0f\xc2\x0f\xa6\x0f", - 16); - memcpy (buf + 0x00000110, - "\x8a\x0f\x6e\x0f\x53\x0f\x38\x0f\x1e\x0f\x04\x0f\xea\x0e\xd1\x0e", - 16); - memcpy (buf + 0x00000120, - "\xb8\x0e\x9f\x0e\x86\x0e\x6e\x0e\x57\x0e\x3f\x0e\x28\x0e\x11\x0e", - 16); - memcpy (buf + 0x00000130, - "\xfa\x0d\xe4\x0d\xce\x0d\xb8\x0d\xa3\x0d\x8e\x0d\x79\x0d\x64\x0d", - 16); - memcpy (buf + 0x00000140, - "\x4f\x0d\x3b\x0d\x27\x0d\x14\x0d\x00\x0d\xed\x0c\xda\x0c\xc7\x0c", - 16); - memcpy (buf + 0x00000150, - "\xb4\x0c\xa2\x0c\x8f\x0c\x7d\x0c\x6c\x0c\x5a\x0c\x49\x0c\x37\x0c", - 16); - memcpy (buf + 0x00000160, - "\x26\x0c\x15\x0c\x05\x0c\xf4\x0b\xe4\x0b\xd4\x0b\xc4\x0b\xb4\x0b", - 16); - memcpy (buf + 0x00000170, - "\xa4\x0b\x95\x0b\x85\x0b\x76\x0b\x67\x0b\x58\x0b\x4a\x0b\x3b\x0b", - 16); - memcpy (buf + 0x00000180, - "\x2d\x0b\x1e\x0b\x10\x0b\x02\x0b\xf4\x0a\xe7\x0a\xd9\x0a\xcc\x0a", - 16); - memcpy (buf + 0x00000190, - "\xbe\x0a\xb1\x0a\xa4\x0a\x97\x0a\x8a\x0a\x7e\x0a\x71\x0a\x65\x0a", - 16); - memcpy (buf + 0x000001a0, - "\x58\x0a\x4c\x0a\x40\x0a\x34\x0a\x28\x0a\x1c\x0a\x10\x0a\x05\x0a", - 16); - memcpy (buf + 0x000001b0, - "\xf9\x09\xee\x09\xe3\x09\xd8\x09\xcc\x09\xc1\x09\xb7\x09\xac\x09", - 16); - memcpy (buf + 0x000001c0, - "\xa1\x09\x96\x09\x8c\x09\x82\x09\x77\x09\x6d\x09\x63\x09\x59\x09", - 16); - memcpy (buf + 0x000001d0, - "\x4f\x09\x45\x09\x3b\x09\x31\x09\x28\x09\x1e\x09\x14\x09\x0b\x09", - 16); - memcpy (buf + 0x000001e0, - "\x02\x09\xf8\x08\xef\x08\xe6\x08\xdd\x08\xd4\x08\xcb\x08\xc2\x08", - 16); - memcpy (buf + 0x000001f0, - "\xb9\x08\xb1\x08\xa8\x08\xa0\x08\x00\x00\x00\x00\x00\x00\x00\x00", - 16); - memcpy (buf + 0x00000200, "\x00\x00\x00\x00", 4); - count = 516; + count = 260; + make_slope_table (count, top_value, 0x86, 0.017979, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x25\xc0\x1c\x4f\x17\x9a\x13\xe9\x10\xde\x0e", - 16); - memcpy (buf + 0x00000010, - "\x44\x0d\xfa\x0b\xea\x0a\x07\x0a\x46\x09\xa0\x08\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, "\x80\x25\x80\x25", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.102968, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -1701,18 +1342,139 @@ startblob_2224_0075 (CANON_Handle * chndl, unsigned char *buf) } void -startblob_2224_0150 (CANON_Handle * chndl, unsigned char *buf) +startblob_2224_0300 (CANON_Handle * chndl, unsigned char *buf) +{ + int fd; + fd = chndl->fd; + size_t count; + + unsigned int top_value = 0x3200; + unsigned char value_62 = 0x15; + +/* original: + unsigned int top_value = 0x3200; + unsigned char value_62 = 0x15; + ratio 609.52 decimal +*/ + cp2155_set (fd, 0x90, 0xe8); + cp2155_set (fd, 0x9b, 0x06); + cp2155_set (fd, 0x9b, 0x04); + cp2155_set (fd, 0x90, 0xf8); + cp2155_set (fd, 0xb0, 0x01); + cp2155_set (fd, 0x07, 0x00); + cp2155_set (fd, 0x07, 0x00); + cp2155_set (fd, 0x08, chndl->value_08); + cp2155_set (fd, 0x09, chndl->value_09); + cp2155_set (fd, 0x0a, chndl->value_0a); + cp2155_set (fd, 0x0b, chndl->value_0b); + cp2155_set (fd, 0xa0, 0x1d); + cp2155_set (fd, 0xa1, 0x00); + cp2155_set (fd, 0xa2, 0x03); + cp2155_set (fd, 0xa3, 0x10); + cp2155_set (fd, 0x64, 0x00); + cp2155_set (fd, 0x65, 0x00); + cp2155_set (fd, 0x61, 0x00); + cp2155_set (fd, 0x62, value_62); + cp2155_set (fd, 0x63, 0xe0); + cp2155_set (fd, 0x50, 0x04); + cp2155_set (fd, 0x50, 0x04); + cp2155_set (fd, 0x90, 0xf8); + cp2155_set (fd, 0x51, chndl->value_51); + cp2155_set (fd, 0x5a, 0xff); + cp2155_set (fd, 0x5b, 0xff); + cp2155_set (fd, 0x5c, 0xff); + cp2155_set (fd, 0x5d, 0xff); + cp2155_set (fd, 0x52, 0x0a); + cp2155_set (fd, 0x53, 0xf0); + cp2155_set (fd, 0x54, 0x0a); + cp2155_set (fd, 0x55, 0xf0); + cp2155_set (fd, 0x56, 0x0a); + cp2155_set (fd, 0x57, 0xf0); + cp2155_set (fd, 0x58, 0x00); + cp2155_set (fd, 0x59, 0x01); + cp2155_set (fd, 0x5e, 0x02); + cp2155_set (fd, 0x5f, 0x00); + cp2155_set (fd, 0x5f, 0x03); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x50, 0x04); + cp2155_set (fd, 0x51, chndl->value_51); + cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x82, 0x11); + cp2155_set (fd, 0x82, 0x11); + cp2155_set (fd, 0x83, 0x01); + cp2155_set (fd, 0x84, 0x05); + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0xb0, 0x01); + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0xc3); + cp2155_set (fd, 0x11, 0xc3); + cp2155_set (fd, 0x11, 0xc3); + cp2155_set (fd, 0x11, 0xc1); + cp2155_set (fd, 0x11, 0xc1); + cp2155_set (fd, 0x12, 0x40); + cp2155_set (fd, 0x13, 0x00); + cp2155_set (fd, 0x16, 0x40); + cp2155_set (fd, 0x21, 0x06); + cp2155_set (fd, 0x22, 0x40); + cp2155_set (fd, 0x20, 0x06); + cp2155_set (fd, 0x1d, 0x00); + cp2155_set (fd, 0x1e, 0x00); + cp2155_set (fd, 0x1f, 0x04); + cp2155_set (fd, 0x66, 0x00); + cp2155_set (fd, 0x67, chndl->value_67); + cp2155_set (fd, 0x68, chndl->value_68); + + register_table (fd, 0x0a, buf); + cp2155_set (fd, 0x18, 0x00); + + count = 260; + make_slope_table (count, top_value, 0x66, 0.0129596, buf); + + write_buf (fd, count, buf, 0x03, 0x00); + write_buf (fd, count, buf, 0x03, 0x02); + write_buf (fd, count, buf, 0x03, 0x06); + + count = 36; + make_slope_table (count, top_value, 0x06, 0.09307359, buf); + + write_buf (fd, count, buf, 0x03, 0x04); + write_buf (fd, count, buf, 0x03, 0x08); + + general_motor_2224 (fd); + +} + +void +startblob_2224_0600 (CANON_Handle * chndl, unsigned char *buf) { int fd; fd = chndl->fd; size_t count; + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x19; + +/* original: + unsigned int top_value = 0x7f80; + unsigned char value_62 = 0x55; + ratio 384 decimal +*/ cp2155_set (fd, 0x90, 0xe8); cp2155_set (fd, 0x9b, 0x06); cp2155_set (fd, 0x9b, 0x04); cp2155_set (fd, 0x90, 0xf8); - cp2155_set (fd, 0xb0, 0x02); + cp2155_set (fd, 0xb0, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x08, chndl->value_08); @@ -1721,13 +1483,13 @@ startblob_2224_0150 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x0b, chndl->value_0b); cp2155_set (fd, 0xa0, 0x1d); cp2155_set (fd, 0xa1, 0x00); - cp2155_set (fd, 0xa2, 0x0c); - cp2155_set (fd, 0xa3, 0xd0); + cp2155_set (fd, 0xa2, 0x31); + cp2155_set (fd, 0xa3, 0xf0); cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x1e); - cp2155_set (fd, 0x63, 0xa0); + cp2155_set (fd, 0x62, value_62); + cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x90, 0xf8); @@ -1761,9 +1523,9 @@ startblob_2224_0150 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x84, 0x05); cp2155_set (fd, 0x80, 0x12); cp2155_set (fd, 0x80, 0x12); - cp2155_set (fd, 0xb0, 0x0a); + cp2155_set (fd, 0xb0, 0x08); - big_write (fd, 0x5694, buf); + big_write_2224 (fd, 0x5694, buf); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); @@ -1776,11 +1538,11 @@ startblob_2224_0150 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x12, 0x40); - cp2155_set (fd, 0x13, 0x40); - cp2155_set (fd, 0x16, 0x40); + cp2155_set (fd, 0x12, 0x06); + cp2155_set (fd, 0x13, 0x06); + cp2155_set (fd, 0x16, 0x06); cp2155_set (fd, 0x21, 0x06); - cp2155_set (fd, 0x22, 0x40); + cp2155_set (fd, 0x22, 0x06); cp2155_set (fd, 0x20, 0x06); cp2155_set (fd, 0x1d, 0x00); cp2155_set (fd, 0x1e, 0x00); @@ -1788,114 +1550,16 @@ startblob_2224_0150 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x84); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x0d); - cp2155_set (fd, 0x33, 0x0d); - cp2155_set (fd, 0x24, 0x0d); - cp2155_set (fd, 0x34, 0x0d); - cp2155_set (fd, 0x25, 0x0d); - cp2155_set (fd, 0x35, 0x0d); - cp2155_set (fd, 0x26, 0x0d); - cp2155_set (fd, 0x36, 0x0d); - cp2155_set (fd, 0x27, 0x0d); - cp2155_set (fd, 0x37, 0x0d); - cp2155_set (fd, 0x28, 0x0d); - cp2155_set (fd, 0x38, 0x0d); - cp2155_set (fd, 0x29, 0x0d); - cp2155_set (fd, 0x39, 0x0d); - cp2155_set (fd, 0x2a, 0x0d); - cp2155_set (fd, 0x3a, 0x0d); - cp2155_set (fd, 0x2b, 0x0d); - cp2155_set (fd, 0x3b, 0x0d); - cp2155_set (fd, 0x2c, 0x0d); - cp2155_set (fd, 0x3c, 0x0d); - cp2155_set (fd, 0x2d, 0x0d); - cp2155_set (fd, 0x3d, 0x0d); - cp2155_set (fd, 0x2e, 0x0d); - cp2155_set (fd, 0x3e, 0x0d); - cp2155_set (fd, 0x2f, 0x0d); - cp2155_set (fd, 0x3f, 0x0d); - cp2155_set (fd, 0x30, 0x0d); - cp2155_set (fd, 0x40, 0x0d); - cp2155_set (fd, 0x31, 0x0d); - cp2155_set (fd, 0x41, 0x0d); - cp2155_set (fd, 0x32, 0x0d); - cp2155_set (fd, 0x42, 0x0d); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); + + register_table (fd, 0x0c, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x00000000, - "\x04\x70\x00\x01\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000010, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000030, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000040, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000050, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000060, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000070, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000080, - "\x80\x25\x80\x25\x80\x25\x32\x24\xfb\x22\xd9\x21\xc8\x20\xc9\x1f", - 16); - memcpy (buf + 0x00000090, - "\xd8\x1e\xf5\x1d\x1f\x1d\x54\x1c\x95\x1b\xdf\x1a\x32\x1a\x8d\x19", - 16); - memcpy (buf + 0x000000a0, - "\xf1\x18\x5c\x18\xce\x17\x46\x17\xc3\x16\x47\x16\xd0\x15\x5d\x15", - 16); - memcpy (buf + 0x000000b0, - "\xef\x14\x86\x14\x21\x14\xbf\x13\x61\x13\x07\x13\xaf\x12\x5b\x12", - 16); - memcpy (buf + 0x000000c0, - "\x0a\x12\xbb\x11\x6f\x11\x26\x11\xdf\x10\x9a\x10\x57\x10\x17\x10", - 16); - memcpy (buf + 0x000000d0, - "\xd8\x0f\x9c\x0f\x61\x0f\x27\x0f\xf0\x0e\xba\x0e\x85\x0e\x52\x0e", - 16); - memcpy (buf + 0x000000e0, - "\x21\x0e\xf0\x0d\xc1\x0d\x93\x0d\x67\x0d\x3b\x0d\x11\x0d\xe7\x0c", - 16); - memcpy (buf + 0x000000f0, - "\xbf\x0c\x98\x0c\x71\x0c\x4b\x0c\x27\x0c\x03\x0c\xe0\x0b\xbe\x0b", - 16); - memcpy (buf + 0x00000100, "\x9c\x0b\x7c\x0b", 4); - count = 260; + count = 36; + make_slope_table (count, top_value, 0x06, 0.0, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x25\x18\x1f\x8f\x1a\x2d\x17\x8f\x14\x79\x12", - 16); - memcpy (buf + 0x00000010, - "\xc6\x10\x5b\x0f\x2a\x0e\x24\x0d\x41\x0c\x7c\x0b\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, "\x80\x25\x80\x25", 4); - count = 36; write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -1904,18 +1568,39 @@ startblob_2224_0150 (CANON_Handle * chndl, unsigned char *buf) } void -startblob_2224_0300 (CANON_Handle * chndl, unsigned char *buf) +startblob_2224_1200 (CANON_Handle * chndl, unsigned char *buf) { - +/* + chndl->value_51 = 0x0f; +*/ int fd; fd = chndl->fd; size_t count; - cp2155_set (fd, 0x90, 0xe8); - cp2155_set (fd, 0x9b, 0x06); - cp2155_set (fd, 0x9b, 0x04); - cp2155_set (fd, 0x90, 0xf8); - cp2155_set (fd, 0xb0, 0x01); + unsigned int top_value = 0x7c71; + unsigned char value_62 = 0x29; + +/* + unsigned int top_value = 0x3fc7; + unsigned char value_62 = 0x15; + ratio 777 decimal +*/ + + cp2155_set (fd, 0x90, 0xe0); /* e8 */ + + double n_msec = 10.0; + int n_9b = 10; /* 2 */ + while (n_9b > 0) + { + cp2155_set (fd, 0x9b, 0x06); + usleep (n_msec * MSEC); + cp2155_set (fd, 0x9b, 0x04); + usleep (n_msec * MSEC); + n_9b--; + } + + cp2155_set (fd, 0x90, 0xf0); /* f8 */ + cp2155_set (fd, 0xb0, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x08, chndl->value_08); @@ -1924,13 +1609,13 @@ startblob_2224_0300 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x0b, chndl->value_0b); cp2155_set (fd, 0xa0, 0x1d); cp2155_set (fd, 0xa1, 0x00); - cp2155_set (fd, 0xa2, 0x03); - cp2155_set (fd, 0xa3, 0x10); + cp2155_set (fd, 0xa2, 0x63); + cp2155_set (fd, 0xa3, 0xd0); cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x15); - cp2155_set (fd, 0x63, 0xe0); + cp2155_set (fd, 0x62, value_62); + cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x90, 0xf8); @@ -1939,13 +1624,13 @@ startblob_2224_0300 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x5b, 0xff); cp2155_set (fd, 0x5c, 0xff); cp2155_set (fd, 0x5d, 0xff); - cp2155_set (fd, 0x52, 0x0a); - cp2155_set (fd, 0x53, 0xf0); - cp2155_set (fd, 0x54, 0x0a); - cp2155_set (fd, 0x55, 0xf0); - cp2155_set (fd, 0x56, 0x0a); - cp2155_set (fd, 0x57, 0xf0); - cp2155_set (fd, 0x58, 0x00); + cp2155_set (fd, 0x52, 0x19); + cp2155_set (fd, 0x53, 0x5a); + cp2155_set (fd, 0x54, 0x17); + cp2155_set (fd, 0x55, 0x98); + cp2155_set (fd, 0x56, 0x11); + cp2155_set (fd, 0x57, 0xae); + cp2155_set (fd, 0x58, 0xa9); cp2155_set (fd, 0x59, 0x01); cp2155_set (fd, 0x5e, 0x02); cp2155_set (fd, 0x5f, 0x00); @@ -1956,146 +1641,195 @@ startblob_2224_0300 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x60, 0x01); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x51, chndl->value_51); - cp2155_set (fd, 0x81, 0x31); - cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x82, 0x11); + cp2155_set (fd, 0x82, 0x11); + cp2155_set (fd, 0x83, 0x01); + cp2155_set (fd, 0x84, 0x05); + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0xb0, 0x08); + + big_write (fd, 0xa1a4, buf); +/* big_write_film (fd, 0xf004, buf); */ + + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x81); + cp2155_set (fd, 0x11, 0x81); + cp2155_set (fd, 0x12, 0x50); + cp2155_set (fd, 0x13, 0x50); + cp2155_set (fd, 0x16, 0x50); + cp2155_set (fd, 0x21, 0x06); + cp2155_set (fd, 0x22, 0x50); + cp2155_set (fd, 0x20, 0x06); + cp2155_set (fd, 0x1d, 0x00); + cp2155_set (fd, 0x1e, 0x00); + cp2155_set (fd, 0x1f, 0x04); + cp2155_set (fd, 0x66, 0x00); + cp2155_set (fd, 0x67, chndl->value_67); + cp2155_set (fd, 0x68, chndl->value_68); + + memcpy (buf, "\x01\x03\x05\x07\x09\x0a\x0b\x0c\x0c", 9); + register_table (fd, 0, buf); + cp2155_set (fd, 0x18, 0x00); + + count = 324; + make_slope_table (count, top_value, 0x06, 0.0, buf); + + write_buf (fd, count, buf, 0x03, 0x00); + write_buf (fd, count, buf, 0x03, 0x02); + write_buf (fd, count, buf, 0x03, 0x06); + + count = 36; + make_slope_table (count, top_value, 0x06, 0.0, buf); + + write_buf (fd, count, buf, 0x03, 0x04); + write_buf (fd, count, buf, 0x03, 0x08); + + general_motor_2224 (fd); + +} + +void +startblob_2224_2400 (CANON_Handle * chndl, unsigned char *buf) +{ + + int fd; + fd = chndl->fd; + size_t count; + + unsigned int top_value = 0x5555; /* was 0x7c71 */ + unsigned char value_62 = 0x0e; /* at 0x15 ratio 1517 decimal, value_62 was 0x29 */ + + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0x11, 0x83); +/* + unsigned int top_value = 0x3fc7; + unsigned char value_62 = 0x15; + ratio 777 decimal + + cp2155_set (fd, 0x01, 0x2b); + cp2155_set (fd, 0x04, 0x08); + cp2155_set (fd, 0x05, 0x00); + cp2155_set (fd, 0x06, 0x00); +*/ + cp2155_set (fd, 0x90, 0xe0); + + double n_msec = 10.0; + int n_9b = 11; + while (n_9b > 0) + { + cp2155_set (fd, 0x9b, 0x06); + usleep (n_msec * MSEC); + cp2155_set (fd, 0x9b, 0x04); + usleep (n_msec * MSEC); + n_9b--; + } + + cp2155_set (fd, 0x90, 0xf0); + cp2155_set (fd, 0xb0, 0x00); + cp2155_set (fd, 0x07, 0x00); + cp2155_set (fd, 0x07, 0x00); + cp2155_set (fd, 0x08, chndl->value_08); + cp2155_set (fd, 0x09, chndl->value_09); + cp2155_set (fd, 0x0a, chndl->value_0a); + cp2155_set (fd, 0x0b, chndl->value_0b); + cp2155_set (fd, 0xa0, 0x25); + cp2155_set (fd, 0xa1, 0x00); + cp2155_set (fd, 0xa2, 0x92); + cp2155_set (fd, 0xa3, 0x10); + cp2155_set (fd, 0x64, 0x00); + cp2155_set (fd, 0x65, 0x00); + cp2155_set (fd, 0x61, 0x00); + cp2155_set (fd, 0x62, value_62); + cp2155_set (fd, 0x63, 0x00); + cp2155_set (fd, 0x50, 0x04); + cp2155_set (fd, 0x50, 0x04); + cp2155_set (fd, 0x90, 0xf1); + cp2155_set (fd, 0x51, chndl->value_51); + cp2155_set (fd, 0x5a, 0xff); + cp2155_set (fd, 0x5b, 0xff); + cp2155_set (fd, 0x5c, 0xff); + cp2155_set (fd, 0x5d, 0xff); + cp2155_set (fd, 0x52, 0x47); + cp2155_set (fd, 0x53, 0x3d); + cp2155_set (fd, 0x54, 0x2b); + cp2155_set (fd, 0x55, 0xd1); + cp2155_set (fd, 0x56, 0x20); + cp2155_set (fd, 0x57, 0x3d); + cp2155_set (fd, 0x58, 0x13); + cp2155_set (fd, 0x59, 0x25); + cp2155_set (fd, 0x5e, 0x02); + cp2155_set (fd, 0x5f, 0x00); + cp2155_set (fd, 0x5f, 0x03); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x60, 0x01); + cp2155_set (fd, 0x50, 0x04); + cp2155_set (fd, 0x51, chndl->value_51); + cp2155_set (fd, 0x81, 0x31); /* 0x29); = darker */ + cp2155_set (fd, 0x81, 0x31); /* 0x29); */ cp2155_set (fd, 0x82, 0x11); cp2155_set (fd, 0x82, 0x11); cp2155_set (fd, 0x83, 0x01); cp2155_set (fd, 0x84, 0x05); cp2155_set (fd, 0x80, 0x12); cp2155_set (fd, 0x80, 0x12); - cp2155_set (fd, 0xb0, 0x01); + cp2155_set (fd, 0xb0, 0x08); + + big_write (fd, 0xa1a4, buf); + big_write_film (fd, 0xf004, buf); + cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x11, 0x83); cp2155_set (fd, 0x11, 0x83); - cp2155_set (fd, 0x11, 0xc3); - cp2155_set (fd, 0x11, 0xc3); - cp2155_set (fd, 0x11, 0xc3); - cp2155_set (fd, 0x11, 0xc1); - cp2155_set (fd, 0x11, 0xc1); - cp2155_set (fd, 0x12, 0x40); - cp2155_set (fd, 0x13, 0x00); - cp2155_set (fd, 0x16, 0x40); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x81); + cp2155_set (fd, 0x11, 0x81); + cp2155_set (fd, 0x12, 0x50); + cp2155_set (fd, 0x13, 0x50); + cp2155_set (fd, 0x16, 0x50); cp2155_set (fd, 0x21, 0x06); - cp2155_set (fd, 0x22, 0x40); + cp2155_set (fd, 0x22, 0x50); cp2155_set (fd, 0x20, 0x06); cp2155_set (fd, 0x1d, 0x00); cp2155_set (fd, 0x1e, 0x00); cp2155_set (fd, 0x1f, 0x04); - cp2155_set (fd, 0x66, 0x00); + cp2155_set (fd, 0x66, chndl->value_66); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x01); - cp2155_set (fd, 0x14, 0x01); - cp2155_set (fd, 0x17, 0x01); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x0a); - cp2155_set (fd, 0x33, 0x0a); - cp2155_set (fd, 0x24, 0x0a); - cp2155_set (fd, 0x34, 0x0a); - cp2155_set (fd, 0x25, 0x0a); - cp2155_set (fd, 0x35, 0x0a); - cp2155_set (fd, 0x26, 0x0a); - cp2155_set (fd, 0x36, 0x0a); - cp2155_set (fd, 0x27, 0x0a); - cp2155_set (fd, 0x37, 0x0a); - cp2155_set (fd, 0x28, 0x0a); - cp2155_set (fd, 0x38, 0x0a); - cp2155_set (fd, 0x29, 0x0a); - cp2155_set (fd, 0x39, 0x0a); - cp2155_set (fd, 0x2a, 0x0a); - cp2155_set (fd, 0x3a, 0x0a); - cp2155_set (fd, 0x2b, 0x0a); - cp2155_set (fd, 0x3b, 0x0a); - cp2155_set (fd, 0x2c, 0x0a); - cp2155_set (fd, 0x3c, 0x0a); - cp2155_set (fd, 0x2d, 0x0a); - cp2155_set (fd, 0x3d, 0x0a); - cp2155_set (fd, 0x2e, 0x0a); - cp2155_set (fd, 0x3e, 0x0a); - cp2155_set (fd, 0x2f, 0x0a); - cp2155_set (fd, 0x3f, 0x0a); - cp2155_set (fd, 0x30, 0x0a); - cp2155_set (fd, 0x40, 0x0a); - cp2155_set (fd, 0x31, 0x0a); - cp2155_set (fd, 0x41, 0x0a); - cp2155_set (fd, 0x32, 0x0a); - cp2155_set (fd, 0x42, 0x0a); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); + + memcpy (buf, "\x02\x04\x04\x06\x06\x08\x08\x0a\x0a", 9); + register_table (fd, 0, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x0000, - "\x04\x70\x00\x01\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32", - 16); - memcpy (buf + 0x0010, - "\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32", - 16); - memcpy (buf + 0x0020, - "\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32", - 16); - memcpy (buf + 0x0030, - "\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32", - 16); - memcpy (buf + 0x0040, - "\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32", - 16); - memcpy (buf + 0x0050, - "\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32", - 16); - memcpy (buf + 0x0060, - "\x00\x32\x00\x32\x00\x32\xbc\x30\x89\x2f\x64\x2e\x4d\x2d\x43\x2c", - 16); - memcpy (buf + 0x0070, - "\x45\x2b\x52\x2a\x69\x29\x8a\x28\xb5\x27\xe8\x26\x23\x26\x66\x25", - 16); - memcpy (buf + 0x0080, - "\xaf\x24\x00\x24\x57\x23\xb5\x22\x17\x22\x80\x21\xee\x20\x60\x20", - 16); - memcpy (buf + 0x0090, - "\xd7\x1f\x53\x1f\xd3\x1e\x57\x1e\xde\x1d\x6a\x1d\xf9\x1c\x8b\x1c", - 16); - memcpy (buf + 0x00a0, - "\x20\x1c\xb9\x1b\x54\x1b\xf3\x1a\x93\x1a\x37\x1a\xdd\x19\x85\x19", - 16); - memcpy (buf + 0x00b0, - "\x30\x19\xdd\x18\x8c\x18\x3d\x18\xf0\x17\xa5\x17\x5c\x17\x14\x17", - 16); - memcpy (buf + 0x00c0, - "\xce\x16\x8a\x16\x47\x16\x06\x16\xc7\x15\x88\x15\x4b\x15\x10\x15", - 16); - memcpy (buf + 0x00d0, - "\xd6\x14\x9d\x14\x65\x14\x2e\x14\xf9\x13\xc4\x13\x91\x13\x5f\x13", - 16); - memcpy (buf + 0x00e0, - "\x2d\x13\xfd\x12\xce\x12\x9f\x12\x72\x12\x45\x12\x19\x12\xee\x11", - 16); - memcpy (buf + 0x00f0, - "\xc4\x11\x9a\x11\x71\x11\x49\x11\x22\x11\xfb\x10\xd5\x10\xb0\x10", - 16); - memcpy (buf + 0x0100, "\x8c\x10\x68\x10", 4); - count = 260; + count = 324; + make_slope_table (count, top_value, 0x06, 0.0, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x0000, - "\x04\x70\x20\x00\x00\x32\x27\x2a\x6f\x24\x15\x20\xa8\x1c\xe5\x19", - 16); - memcpy (buf + 0x0010, - "\x9e\x17\xb5\x15\x16\x14\xb0\x12\x79\x11\x68\x10\x00\x00\x00\x00", - 16); - memcpy (buf + 0x0020, "\x00\x00\x00\x00", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.0, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -2104,17 +1838,44 @@ startblob_2224_0300 (CANON_Handle * chndl, unsigned char *buf) } void -startblob_2224_0600 (CANON_Handle * chndl, unsigned char *buf) +startblob_2224_4800 (CANON_Handle * chndl, unsigned char *buf) { int fd; fd = chndl->fd; size_t count; - cp2155_set (fd, 0x90, 0xe8); - cp2155_set (fd, 0x9b, 0x06); - cp2155_set (fd, 0x9b, 0x04); - cp2155_set (fd, 0x90, 0xf8); + unsigned int top_value = 0x3fc7; /* was 0x7c71 */ + unsigned char value_62 = 0x15; /* at 0x15 ratio 1517 decimal, value_62 was 0x29 */ + + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0x11, 0x83); +/* + unsigned int top_value = 0x3fc7; + unsigned char value_62 = 0x15; + ratio 777 decimal + + cp2155_set (fd, 0x01, 0x2b); + cp2155_set (fd, 0x04, 0x08); + cp2155_set (fd, 0x05, 0x00); + cp2155_set (fd, 0x06, 0x00); +*/ + cp2155_set (fd, 0x90, 0xe0); + + double n_msec = 10.0; + int n_9b = 12; + while (n_9b > 0) + { + cp2155_set (fd, 0x9b, 0x06); + usleep (n_msec * MSEC); + cp2155_set (fd, 0x9b, 0x04); + usleep (n_msec * MSEC); + n_9b--; + } + + cp2155_set (fd, 0x90, 0xf0); cp2155_set (fd, 0xb0, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x07, 0x00); @@ -2122,31 +1883,31 @@ startblob_2224_0600 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x09, chndl->value_09); cp2155_set (fd, 0x0a, chndl->value_0a); cp2155_set (fd, 0x0b, chndl->value_0b); - cp2155_set (fd, 0xa0, 0x1d); + cp2155_set (fd, 0xa0, 0x25); cp2155_set (fd, 0xa1, 0x00); - cp2155_set (fd, 0xa2, 0x31); - cp2155_set (fd, 0xa3, 0xf0); + cp2155_set (fd, 0xa2, 0x92); + cp2155_set (fd, 0xa3, 0x10); cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x55); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); - cp2155_set (fd, 0x90, 0xf8); + cp2155_set (fd, 0x90, 0xf1); cp2155_set (fd, 0x51, chndl->value_51); cp2155_set (fd, 0x5a, 0xff); cp2155_set (fd, 0x5b, 0xff); cp2155_set (fd, 0x5c, 0xff); cp2155_set (fd, 0x5d, 0xff); - cp2155_set (fd, 0x52, 0x0c); - cp2155_set (fd, 0x53, 0xda); - cp2155_set (fd, 0x54, 0x0c); - cp2155_set (fd, 0x55, 0x44); - cp2155_set (fd, 0x56, 0x08); - cp2155_set (fd, 0x57, 0xbb); - cp2155_set (fd, 0x58, 0x1d); - cp2155_set (fd, 0x59, 0xa1); + cp2155_set (fd, 0x52, 0x47); + cp2155_set (fd, 0x53, 0x3d); + cp2155_set (fd, 0x54, 0x2b); + cp2155_set (fd, 0x55, 0xd1); + cp2155_set (fd, 0x56, 0x20); + cp2155_set (fd, 0x57, 0x3d); + cp2155_set (fd, 0x58, 0x13); + cp2155_set (fd, 0x59, 0x25); cp2155_set (fd, 0x5e, 0x02); cp2155_set (fd, 0x5f, 0x00); cp2155_set (fd, 0x5f, 0x03); @@ -2156,8 +1917,8 @@ startblob_2224_0600 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x60, 0x01); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x51, chndl->value_51); - cp2155_set (fd, 0x81, 0x31); - cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x81, 0x31); /* 0x29); = darker */ + cp2155_set (fd, 0x81, 0x31); /* 0x29); */ cp2155_set (fd, 0x82, 0x11); cp2155_set (fd, 0x82, 0x11); cp2155_set (fd, 0x83, 0x01); @@ -2166,87 +1927,47 @@ startblob_2224_0600 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x80, 0x12); cp2155_set (fd, 0xb0, 0x08); - big_write (fd, 0x5694, buf); + big_write (fd, 0xa1a4, buf); + big_write_film (fd, 0xf004, buf); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x11, 0x83); cp2155_set (fd, 0x11, 0x81); cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x11, 0x81); - cp2155_set (fd, 0x12, 0x06); - cp2155_set (fd, 0x13, 0x06); - cp2155_set (fd, 0x16, 0x06); + cp2155_set (fd, 0x12, 0x50); + cp2155_set (fd, 0x13, 0x50); + cp2155_set (fd, 0x16, 0x50); cp2155_set (fd, 0x21, 0x06); - cp2155_set (fd, 0x22, 0x06); + cp2155_set (fd, 0x22, 0x50); cp2155_set (fd, 0x20, 0x06); cp2155_set (fd, 0x1d, 0x00); cp2155_set (fd, 0x1e, 0x00); cp2155_set (fd, 0x1f, 0x04); - cp2155_set (fd, 0x66, 0x00); + cp2155_set (fd, 0x66, chndl->value_66); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x80); - cp2155_set (fd, 0x14, 0x7a); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x0c); - cp2155_set (fd, 0x33, 0x0c); - cp2155_set (fd, 0x24, 0x0c); - cp2155_set (fd, 0x34, 0x0c); - cp2155_set (fd, 0x25, 0x0c); - cp2155_set (fd, 0x35, 0x0c); - cp2155_set (fd, 0x26, 0x0c); - cp2155_set (fd, 0x36, 0x0c); - cp2155_set (fd, 0x27, 0x0c); - cp2155_set (fd, 0x37, 0x0c); - cp2155_set (fd, 0x28, 0x0c); - cp2155_set (fd, 0x38, 0x0c); - cp2155_set (fd, 0x29, 0x0c); - cp2155_set (fd, 0x39, 0x0c); - cp2155_set (fd, 0x2a, 0x0c); - cp2155_set (fd, 0x3a, 0x0c); - cp2155_set (fd, 0x2b, 0x0c); - cp2155_set (fd, 0x3b, 0x0c); - cp2155_set (fd, 0x2c, 0x0c); - cp2155_set (fd, 0x3c, 0x0c); - cp2155_set (fd, 0x2d, 0x0c); - cp2155_set (fd, 0x3d, 0x0c); - cp2155_set (fd, 0x2e, 0x0c); - cp2155_set (fd, 0x3e, 0x0c); - cp2155_set (fd, 0x2f, 0x0c); - cp2155_set (fd, 0x3f, 0x0c); - cp2155_set (fd, 0x30, 0x0c); - cp2155_set (fd, 0x40, 0x0c); - cp2155_set (fd, 0x31, 0x0c); - cp2155_set (fd, 0x41, 0x0c); - cp2155_set (fd, 0x32, 0x0c); - cp2155_set (fd, 0x42, 0x0c); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); + + memcpy (buf, "\x02\x04\x04\x06\x06\x08\x08\x0a\x0a", 9); + register_table (fd, 0, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000010, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x00\x00\x00\x00", - 16); - memcpy (buf + 0x00000020, "\x00\x00\x00\x00", 4); - count = 36; + + count = 324; + make_slope_table (count, top_value, 0x06, 0.0, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); + + count = 36; + make_slope_table (count, top_value, 0x06, 0.0, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -2255,19 +1976,45 @@ startblob_2224_0600 (CANON_Handle * chndl, unsigned char *buf) } void -startblob_2224_1200 (CANON_Handle * chndl, unsigned char *buf) +startblob_2224_4799 (CANON_Handle * chndl, unsigned char *buf) { int fd; fd = chndl->fd; size_t count; - cp2155_set (fd, 0x90, 0xe8); - cp2155_set (fd, 0x9b, 0x06); - cp2155_set (fd, 0x9b, 0x04); - cp2155_set (fd, 0x9b, 0x06); - cp2155_set (fd, 0x9b, 0x04); - cp2155_set (fd, 0x90, 0xf8); + unsigned int top_value = 0x1400; /* was 0x7c71 */ + unsigned char value_62 = 0x14; /* at 0x15 ratio 1517 decimal, value_62 was 0x29 */ + + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0x11, 0x83); + cp2155_set (fd, 0x80, 0x12); + cp2155_set (fd, 0x11, 0x83); + +/* + unsigned int top_value = 0x3fc7; + unsigned char value_62 = 0x15; + ratio 777 decimal + + cp2155_set (fd, 0x01, 0x2b); + cp2155_set (fd, 0x04, 0x08); + cp2155_set (fd, 0x05, 0x00); + cp2155_set (fd, 0x06, 0x00); +*/ + cp2155_set (fd, 0x90, 0xe0); + + double n_msec = 10.0; + int n_9b = 12; + while (n_9b > 0) + { + cp2155_set (fd, 0x9b, 0x06); + usleep (n_msec * MSEC); + cp2155_set (fd, 0x9b, 0x04); + usleep (n_msec * MSEC); + n_9b--; + } + + cp2155_set (fd, 0x90, 0xf0); cp2155_set (fd, 0xb0, 0x00); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x07, 0x00); @@ -2275,31 +2022,31 @@ startblob_2224_1200 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x09, chndl->value_09); cp2155_set (fd, 0x0a, chndl->value_0a); cp2155_set (fd, 0x0b, chndl->value_0b); - cp2155_set (fd, 0xa0, 0x1d); - cp2155_set (fd, 0xa1, 0x00); - cp2155_set (fd, 0xa2, 0x63); - cp2155_set (fd, 0xa3, 0xd0); + cp2155_set (fd, 0xa0, 0x25); + cp2155_set (fd, 0xa1, 0x01); + cp2155_set (fd, 0xa2, 0x23); + cp2155_set (fd, 0xa3, 0x10); cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0xaa); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); - cp2155_set (fd, 0x90, 0xf8); + cp2155_set (fd, 0x90, 0xf1); cp2155_set (fd, 0x51, chndl->value_51); cp2155_set (fd, 0x5a, 0xff); cp2155_set (fd, 0x5b, 0xff); cp2155_set (fd, 0x5c, 0xff); cp2155_set (fd, 0x5d, 0xff); - cp2155_set (fd, 0x52, 0x19); - cp2155_set (fd, 0x53, 0x5a); - cp2155_set (fd, 0x54, 0x17); - cp2155_set (fd, 0x55, 0x98); - cp2155_set (fd, 0x56, 0x11); - cp2155_set (fd, 0x57, 0xae); - cp2155_set (fd, 0x58, 0xa9); - cp2155_set (fd, 0x59, 0x01); + cp2155_set (fd, 0x52, 0x92); + cp2155_set (fd, 0x53, 0xa0); + cp2155_set (fd, 0x54, 0x58); + cp2155_set (fd, 0x55, 0x29); + cp2155_set (fd, 0x56, 0x40); + cp2155_set (fd, 0x57, 0x08); + cp2155_set (fd, 0x58, 0x27); + cp2155_set (fd, 0x59, 0xc7); cp2155_set (fd, 0x5e, 0x02); cp2155_set (fd, 0x5f, 0x00); cp2155_set (fd, 0x5f, 0x03); @@ -2309,8 +2056,8 @@ startblob_2224_1200 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x60, 0x01); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x51, chndl->value_51); - cp2155_set (fd, 0x81, 0x31); - cp2155_set (fd, 0x81, 0x31); + cp2155_set (fd, 0x81, 0x29); + cp2155_set (fd, 0x81, 0x29); cp2155_set (fd, 0x82, 0x11); cp2155_set (fd, 0x82, 0x11); cp2155_set (fd, 0x83, 0x01); @@ -2319,7 +2066,8 @@ startblob_2224_1200 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x80, 0x12); cp2155_set (fd, 0xb0, 0x08); - big_write (fd, 0xa714, buf); + big_write (fd, 0xa1a4, buf); + big_write_film (fd, 0xf004, buf); cp2155_set (fd, 0x10, 0x05); cp2155_set (fd, 0x10, 0x05); @@ -2341,130 +2089,22 @@ startblob_2224_1200 (CANON_Handle * chndl, unsigned char *buf) cp2155_set (fd, 0x1d, 0x00); cp2155_set (fd, 0x1e, 0x00); cp2155_set (fd, 0x1f, 0x04); - cp2155_set (fd, 0x66, 0x00); + cp2155_set (fd, 0x66, chndl->value_66); cp2155_set (fd, 0x67, chndl->value_67); cp2155_set (fd, 0x68, chndl->value_68); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x80); - cp2155_set (fd, 0x14, 0x7a); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x01); - cp2155_set (fd, 0x33, 0x01); - cp2155_set (fd, 0x24, 0x03); - cp2155_set (fd, 0x34, 0x03); - cp2155_set (fd, 0x25, 0x05); - cp2155_set (fd, 0x35, 0x05); - cp2155_set (fd, 0x26, 0x07); - cp2155_set (fd, 0x36, 0x07); - cp2155_set (fd, 0x27, 0x09); - cp2155_set (fd, 0x37, 0x09); - cp2155_set (fd, 0x28, 0x0a); - cp2155_set (fd, 0x38, 0x0a); - cp2155_set (fd, 0x29, 0x0b); - cp2155_set (fd, 0x39, 0x0b); - cp2155_set (fd, 0x2a, 0x0c); - cp2155_set (fd, 0x3a, 0x0c); - cp2155_set (fd, 0x2b, 0x0c); - cp2155_set (fd, 0x3b, 0x0c); - cp2155_set (fd, 0x2c, 0x0b); - cp2155_set (fd, 0x3c, 0x0b); - cp2155_set (fd, 0x2d, 0x0a); - cp2155_set (fd, 0x3d, 0x0a); - cp2155_set (fd, 0x2e, 0x09); - cp2155_set (fd, 0x3e, 0x09); - cp2155_set (fd, 0x2f, 0x07); - cp2155_set (fd, 0x3f, 0x07); - cp2155_set (fd, 0x30, 0x05); - cp2155_set (fd, 0x40, 0x05); - cp2155_set (fd, 0x31, 0x03); - cp2155_set (fd, 0x41, 0x03); - cp2155_set (fd, 0x32, 0x01); - cp2155_set (fd, 0x42, 0x01); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x00000000, - "\x04\x70\x40\x01\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000010, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000020, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000030, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000040, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000050, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000060, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000070, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000080, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000090, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x000000a0, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x000000b0, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x000000c0, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x000000d0, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x000000e0, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x000000f0, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000100, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000110, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000120, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000130, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000140, "\x80\x7f\x80\x7f", 4); + register_table_4800 (fd, 0x05, buf); + cp2155_set (fd, 0x18, 0x02); + count = 324; + make_slope_table (count, top_value, 0x06, 0.0, buf); write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000010, - "\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f\x80\x7f", - 16); - memcpy (buf + 0x00000020, "\x80\x7f\x80\x7f", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.0, buf); write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -2476,16 +2116,18 @@ startblob_2224_1200 (CANON_Handle * chndl, unsigned char *buf) void send_start_blob (CANON_Handle * chndl) { - unsigned char buf[0xf000]; + unsigned char buf[0xfff0]; int fd; fd = chndl->fd; /* value_51: lamp colors - bit 0 set: red on, bit 1 set: green on, bit 2 set: blue on + bit 0 set: red on, bit 1 set: green on, bit 2 set: blue on, + bit 3 set: infrared on all bits off: no scan is made */ chndl->value_51 = 0x07; + chndl->value_66 = 0x00; switch (chndl->val[opt_resolution].w) { @@ -2508,21 +2150,33 @@ send_start_blob (CANON_Handle * chndl) case 1200: chndl->value_67 = 0xab; /* 6*7300 */ chndl->value_68 = 0x18; + break; + case 2400: + chndl->value_66 = 0x01; + chndl->value_67 = 0x56; /* 12*7300 */ + chndl->value_68 = 0x30; + break; + case 4800: + chndl->value_66 = 0x02; + chndl->value_67 = 0xac; /* 24*7300 */ + chndl->value_68 = 0x60; } + unsigned char value_11 = 0xc1; /* 0x00; */ + cp2155_set (fd, 0x80, 0x12); - cp2155_set (fd, 0x11, 0xc1); + cp2155_set (fd, 0x11, value_11); cp2155_set (fd, 0x80, 0x12); - cp2155_set (fd, 0x11, 0xc1); + cp2155_set (fd, 0x11, value_11); cp2155_set (fd, 0x90, 0xf8); cp2155_set (fd, 0x80, 0x12); - cp2155_set (fd, 0x11, 0xc1); + cp2155_set (fd, 0x11, value_11); cp2155_set (fd, 0x01, 0x29); cp2155_set (fd, 0x04, 0x0c); cp2155_set (fd, 0x05, 0x00); cp2155_set (fd, 0x06, 0x00); cp2155_set (fd, 0x01, 0x29); - cp2155_set_gamma (fd); + cp2155_set_gamma (fd, chndl); switch (chndl->val[opt_resolution].w) { @@ -2553,14 +2207,14 @@ send_start_blob (CANON_Handle * chndl) } else { - cp2155_set_gamma_red_enhanced (fd); + cp2155_set_gamma_red_enhanced (fd, chndl); startblob_2224_0300 (chndl, buf); } break; case 600: if (chndl->productcode == 0x2225) { - cp2155_set_gamma_red_enhanced (fd); + cp2155_set_gamma_red_enhanced (fd, chndl); startblob_2225_0600 (chndl, buf); /* startblob_2225_0600_extra (chndl, buf); @@ -2581,6 +2235,26 @@ send_start_blob (CANON_Handle * chndl) startblob_2224_1200 (chndl, buf); } break; + case 2400: + if (chndl->productcode == 0x2225) + { + startblob_2225_1200 (chndl, buf); + } + else + { + startblob_2224_2400 (chndl, buf); + } + break; + case 4800: + if (chndl->productcode == 0x2225) + { + startblob_2225_1200 (chndl, buf); + } + else + { + startblob_2224_4800 (chndl, buf); + } + break; } } @@ -2658,7 +2332,7 @@ init_2225 (CANON_Handle * chndl) /* Detect if scanner is plugged in */ if (value != 0x81 && value != 0x40) { - DBG (0, "INIT: unexpected value: %x\n", value); + DBG (1, "INIT: unexpected value: %x\n", value); } if (value == 0x00) @@ -2774,10 +2448,20 @@ init (CANON_Handle * chndl) int result; if (chndl->productcode == 0x2225) { + chndl->table_gamma = 2.2; + chndl->table_gamma_blue = 2.2; + chndl->highlight_red_enhanced = 190; + chndl->highlight_other = 240; + chndl->highlight_blue_reduced = 240; result = init_2225 (chndl); } else { + chndl->table_gamma = 2.2; + chndl->table_gamma_blue = 1.95; + chndl->highlight_red_enhanced = 190; + chndl->highlight_other = 215; + chndl->highlight_blue_reduced = 255; result = init_2224 (chndl); } return result; @@ -2787,6 +2471,14 @@ void back2225 (int fd, unsigned char *buf) { size_t count; + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2e; + +/* original: + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2e; + ratio 320 decimal +*/ cp2155_set (fd, 0x90, 0xc8); cp2155_set (fd, 0x90, 0xc8); cp2155_set (fd, 0xb0, 0x03); @@ -2803,7 +2495,7 @@ back2225 (int fd, unsigned char *buf) cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x2e); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); @@ -2861,114 +2553,21 @@ back2225 (int fd, unsigned char *buf) cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, 0x00); cp2155_set (fd, 0x68, 0x06); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x83); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x28); - cp2155_set (fd, 0x33, 0x28); - cp2155_set (fd, 0x24, 0x27); - cp2155_set (fd, 0x34, 0x27); - cp2155_set (fd, 0x25, 0x25); - cp2155_set (fd, 0x35, 0x25); - cp2155_set (fd, 0x26, 0x21); - cp2155_set (fd, 0x36, 0x21); - cp2155_set (fd, 0x27, 0x1c); - cp2155_set (fd, 0x37, 0x1c); - cp2155_set (fd, 0x28, 0x16); - cp2155_set (fd, 0x38, 0x16); - cp2155_set (fd, 0x29, 0x0f); - cp2155_set (fd, 0x39, 0x0f); - cp2155_set (fd, 0x2a, 0x08); - cp2155_set (fd, 0x3a, 0x08); - cp2155_set (fd, 0x2b, 0x00); - cp2155_set (fd, 0x3b, 0x00); - cp2155_set (fd, 0x2c, 0x08); - cp2155_set (fd, 0x3c, 0x08); - cp2155_set (fd, 0x2d, 0x0f); - cp2155_set (fd, 0x3d, 0x0f); - cp2155_set (fd, 0x2e, 0x16); - cp2155_set (fd, 0x3e, 0x16); - cp2155_set (fd, 0x2f, 0x1c); - cp2155_set (fd, 0x3f, 0x1c); - cp2155_set (fd, 0x30, 0x21); - cp2155_set (fd, 0x40, 0x21); - cp2155_set (fd, 0x31, 0x25); - cp2155_set (fd, 0x41, 0x25); - cp2155_set (fd, 0x32, 0x27); - cp2155_set (fd, 0x42, 0x27); - cp2155_set (fd, 0xca, 0x02); - cp2155_set (fd, 0xca, 0x02); - cp2155_set (fd, 0xca, 0x22); + + memcpy (buf, "\x28\x27\x25\x21\x1c\x16\x0f\x08\x00", 9); + register_table (fd, 0, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x00000000, - "\x04\x70\x00\x01\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000010, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000030, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000040, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000050, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000060, - "\x80\x25\x80\x25\x80\x25\x80\x25\x80\x25\xf0\x23\x80\x22\x2c\x21", - 16); - memcpy (buf + 0x00000070, - "\xf1\x1f\xcd\x1e\xbd\x1d\xc0\x1c\xd2\x1b\xf4\x1a\x22\x1a\x5e\x19", - 16); - memcpy (buf + 0x00000080, - "\xa4\x18\xf5\x17\x4f\x17\xb2\x16\x1d\x16\x90\x15\x09\x15\x89\x14", - 16); - memcpy (buf + 0x00000090, - "\x0e\x14\x9a\x13\x2a\x13\xc0\x12\x59\x12\xf8\x11\x9a\x11\x3f\x11", - 16); - memcpy (buf + 0x000000a0, - "\xe9\x10\x96\x10\x46\x10\xf8\x0f\xae\x0f\x66\x0f\x21\x0f\xde\x0e", - 16); - memcpy (buf + 0x000000b0, - "\x9e\x0e\x60\x0e\x23\x0e\xe9\x0d\xb0\x0d\x7a\x0d\x44\x0d\x11\x0d", - 16); - memcpy (buf + 0x000000c0, - "\xdf\x0c\xaf\x0c\x80\x0c\x52\x0c\x25\x0c\xfa\x0b\xd0\x0b\xa7\x0b", - 16); - memcpy (buf + 0x000000d0, - "\x80\x0b\x59\x0b\x33\x0b\x0e\x0b\xea\x0a\xc8\x0a\xa5\x0a\x84\x0a", - 16); - memcpy (buf + 0x000000e0, - "\x64\x0a\x44\x0a\x25\x0a\x07\x0a\xe9\x09\xcd\x09\xb0\x09\x95\x09", - 16); - memcpy (buf + 0x000000f0, - "\x7a\x09\x60\x09\x46\x09\x2c\x09\x14\x09\xfc\x08\xe4\x08\xcd\x08", - 16); - memcpy (buf + 0x00000100, "\xb6\x08\xa0\x08", 4); count = 260; + make_slope_table (count, top_value, 0x6a, 0.021739, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x25\xc0\x1c\x4f\x17\x9a\x13\xe9\x10\xde\x0e", - 16); - memcpy (buf + 0x00000010, - "\x44\x0d\xfa\x0b\xea\x0a\x07\x0a\x46\x09\xa0\x08\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, "\x80\x25\x80\x25", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.15217, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -2985,10 +2584,18 @@ back2224 (int fd, unsigned char *buf) { size_t count; -/* cp2155_set (fd, 0x90, 0xe8); */ + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2e; + +/* original: + unsigned int top_value = 0x2580; + unsigned char value_62 = 0x2e; + ratio 320 decimal +*/ + cp2155_set (fd, 0x90, 0xe8); cp2155_set (fd, 0x9b, 0x06); cp2155_set (fd, 0x9b, 0x04); -/* cp2155_set (fd, 0x90, 0xf8); */ + cp2155_set (fd, 0x90, 0xf8); cp2155_set (fd, 0xb0, 0x03); cp2155_set (fd, 0x07, 0x00); cp2155_set (fd, 0x07, 0x00); @@ -3003,7 +2610,7 @@ back2224 (int fd, unsigned char *buf) cp2155_set (fd, 0x64, 0x00); cp2155_set (fd, 0x65, 0x00); cp2155_set (fd, 0x61, 0x00); - cp2155_set (fd, 0x62, 0x2e); + cp2155_set (fd, 0x62, value_62); cp2155_set (fd, 0x63, 0x00); cp2155_set (fd, 0x50, 0x04); cp2155_set (fd, 0x50, 0x04); @@ -3062,162 +2669,20 @@ back2224 (int fd, unsigned char *buf) cp2155_set (fd, 0x66, 0x00); cp2155_set (fd, 0x67, 0x00); cp2155_set (fd, 0x68, 0x06); - cp2155_set (fd, 0x1a, 0x00); - cp2155_set (fd, 0x1b, 0x00); - cp2155_set (fd, 0x1c, 0x02); - cp2155_set (fd, 0x15, 0x83); - cp2155_set (fd, 0x14, 0x7c); - cp2155_set (fd, 0x17, 0x02); - cp2155_set (fd, 0x43, 0x1c); - cp2155_set (fd, 0x44, 0x9c); - cp2155_set (fd, 0x45, 0x38); - cp2155_set (fd, 0x23, 0x0d); - cp2155_set (fd, 0x33, 0x0d); - cp2155_set (fd, 0x24, 0x0d); - cp2155_set (fd, 0x34, 0x0d); - cp2155_set (fd, 0x25, 0x0d); - cp2155_set (fd, 0x35, 0x0d); - cp2155_set (fd, 0x26, 0x0d); - cp2155_set (fd, 0x36, 0x0d); - cp2155_set (fd, 0x27, 0x0d); - cp2155_set (fd, 0x37, 0x0d); - cp2155_set (fd, 0x28, 0x0d); - cp2155_set (fd, 0x38, 0x0d); - cp2155_set (fd, 0x29, 0x0d); - cp2155_set (fd, 0x39, 0x0d); - cp2155_set (fd, 0x2a, 0x0d); - cp2155_set (fd, 0x3a, 0x0d); - cp2155_set (fd, 0x2b, 0x0d); - cp2155_set (fd, 0x3b, 0x0d); - cp2155_set (fd, 0x2c, 0x0d); - cp2155_set (fd, 0x3c, 0x0d); - cp2155_set (fd, 0x2d, 0x0d); - cp2155_set (fd, 0x3d, 0x0d); - cp2155_set (fd, 0x2e, 0x0d); - cp2155_set (fd, 0x3e, 0x0d); - cp2155_set (fd, 0x2f, 0x0d); - cp2155_set (fd, 0x3f, 0x0d); - cp2155_set (fd, 0x30, 0x0d); - cp2155_set (fd, 0x40, 0x0d); - cp2155_set (fd, 0x31, 0x0d); - cp2155_set (fd, 0x41, 0x0d); - cp2155_set (fd, 0x32, 0x0d); - cp2155_set (fd, 0x42, 0x0d); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); - cp2155_set (fd, 0xca, 0x00); + + register_table (fd, 0x0d, buf); cp2155_set (fd, 0x18, 0x00); - memcpy (buf + 0x0000, - "\x04\x70\xf4\x01\x80\x25\x00\x25\x84\x24\x0b\x24\x96\x23\x23\x23", - 16); - memcpy (buf + 0x0010, - "\xb3\x22\x46\x22\xdb\x21\x73\x21\x0e\x21\xab\x20\x4a\x20\xeb\x1f", - 16); - memcpy (buf + 0x0020, - "\x8f\x1f\x34\x1f\xdc\x1e\x85\x1e\x31\x1e\xde\x1d\x8d\x1d\x3e\x1d", - 16); - memcpy (buf + 0x0030, - "\xf0\x1c\xa4\x1c\x59\x1c\x10\x1c\xc9\x1b\x83\x1b\x3e\x1b\xfa\x1a", - 16); - memcpy (buf + 0x0040, - "\xb8\x1a\x77\x1a\x38\x1a\xf9\x19\xbc\x19\x80\x19\x44\x19\x0a\x19", - 16); - memcpy (buf + 0x0050, - "\xd1\x18\x99\x18\x62\x18\x2c\x18\xf7\x17\xc3\x17\x8f\x17\x5d\x17", - 16); - memcpy (buf + 0x0060, - "\x2b\x17\xfa\x16\xca\x16\x9b\x16\x6c\x16\x3e\x16\x11\x16\xe5\x15", - 16); - memcpy (buf + 0x0070, - "\xb9\x15\x8e\x15\x64\x15\x3a\x15\x11\x15\xe9\x14\xc1\x14\x9a\x14", - 16); - memcpy (buf + 0x0080, - "\x73\x14\x4d\x14\x27\x14\x02\x14\xde\x13\xba\x13\x96\x13\x74\x13", - 16); - memcpy (buf + 0x0090, - "\x51\x13\x2f\x13\x0d\x13\xec\x12\xcc\x12\xab\x12\x8c\x12\x6c\x12", - 16); - memcpy (buf + 0x00a0, - "\x4d\x12\x2f\x12\x11\x12\xf3\x11\xd5\x11\xb8\x11\x9c\x11\x80\x11", - 16); - memcpy (buf + 0x00b0, - "\x64\x11\x48\x11\x2d\x11\x12\x11\xf7\x10\xdd\x10\xc3\x10\xa9\x10", - 16); - memcpy (buf + 0x00c0, - "\x90\x10\x77\x10\x5e\x10\x46\x10\x2e\x10\x16\x10\xfe\x0f\xe7\x0f", - 16); - memcpy (buf + 0x00d0, - "\xd0\x0f\xb9\x0f\xa2\x0f\x8c\x0f\x76\x0f\x60\x0f\x4b\x0f\x35\x0f", - 16); - memcpy (buf + 0x00e0, - "\x20\x0f\x0b\x0f\xf7\x0e\xe2\x0e\xce\x0e\xba\x0e\xa6\x0e\x92\x0e", - 16); - memcpy (buf + 0x00f0, - "\x7f\x0e\x6c\x0e\x59\x0e\x46\x0e\x33\x0e\x21\x0e\x0f\x0e\xfd\x0d", - 16); - memcpy (buf + 0x0100, - "\xeb\x0d\xd9\x0d\xc8\x0d\xb6\x0d\xa5\x0d\x94\x0d\x83\x0d\x73\x0d", - 16); - memcpy (buf + 0x0110, - "\x62\x0d\x52\x0d\x41\x0d\x31\x0d\x22\x0d\x12\x0d\x02\x0d\xf3\x0c", - 16); - memcpy (buf + 0x0120, - "\xe3\x0c\xd4\x0c\xc5\x0c\xb6\x0c\xa7\x0c\x99\x0c\x8a\x0c\x7c\x0c", - 16); - memcpy (buf + 0x0130, - "\x6e\x0c\x60\x0c\x52\x0c\x44\x0c\x36\x0c\x28\x0c\x1b\x0c\x0d\x0c", - 16); - memcpy (buf + 0x0140, - "\x00\x0c\xf3\x0b\xe6\x0b\xd9\x0b\xcc\x0b\xbf\x0b\xb3\x0b\xa6\x0b", - 16); - memcpy (buf + 0x0150, - "\x9a\x0b\x8e\x0b\x81\x0b\x75\x0b\x69\x0b\x5d\x0b\x52\x0b\x46\x0b", - 16); - memcpy (buf + 0x0160, - "\x3a\x0b\x2f\x0b\x23\x0b\x18\x0b\x0d\x0b\x02\x0b\xf6\x0a\xeb\x0a", - 16); - memcpy (buf + 0x0170, - "\xe1\x0a\xd6\x0a\xcb\x0a\xc0\x0a\xb6\x0a\xab\x0a\xa1\x0a\x97\x0a", - 16); - memcpy (buf + 0x0180, - "\x8c\x0a\x82\x0a\x78\x0a\x6e\x0a\x64\x0a\x5a\x0a\x50\x0a\x47\x0a", - 16); - memcpy (buf + 0x0190, - "\x3d\x0a\x33\x0a\x2a\x0a\x20\x0a\x17\x0a\x0e\x0a\x04\x0a\xfb\x09", - 16); - memcpy (buf + 0x01a0, - "\xf2\x09\xe9\x09\xe0\x09\xd7\x09\xce\x09\xc6\x09\xbd\x09\xb4\x09", - 16); - memcpy (buf + 0x01b0, - "\xab\x09\xa3\x09\x9a\x09\x92\x09\x8a\x09\x81\x09\x79\x09\x71\x09", - 16); - memcpy (buf + 0x01c0, - "\x69\x09\x61\x09\x59\x09\x51\x09\x49\x09\x41\x09\x39\x09\x31\x09", - 16); - memcpy (buf + 0x01d0, - "\x29\x09\x22\x09\x1a\x09\x12\x09\x0b\x09\x03\x09\xfc\x08\xf5\x08", - 16); - memcpy (buf + 0x01e0, - "\xed\x08\xe6\x08\xdf\x08\xd8\x08\xd0\x08\xc9\x08\xc2\x08\xbb\x08", - 16); - memcpy (buf + 0x01f0, - "\xb4\x08\xad\x08\xa6\x08\xa0\x08\x00\x00\x00\x00\x00\x00\x00\x00", - 16); - memcpy (buf + 0x0200, "\x00\x00\x00\x00", 4); count = 516; + make_slope_table (count, top_value, 0x06, 0.0067225, buf); + write_buf (fd, count, buf, 0x03, 0x00); write_buf (fd, count, buf, 0x03, 0x02); write_buf (fd, count, buf, 0x03, 0x06); - memcpy (buf + 0x00000000, - "\x04\x70\x18\x00\x80\x25\xc0\x1c\x4f\x17\x9a\x13\xe9\x10\xde\x0e", - 16); - memcpy (buf + 0x00000010, - "\x44\x0d\xfa\x0b\xea\x0a\x07\x0a\x46\x09\xa0\x08\x80\x25\x80\x25", - 16); - memcpy (buf + 0x00000020, "\x80\x25\x80\x25", 4); count = 36; + make_slope_table (count, top_value, 0x06, 0.15217, buf); + write_buf (fd, count, buf, 0x03, 0x04); write_buf (fd, count, buf, 0x03, 0x08); @@ -3281,14 +2746,6 @@ go_home (CANON_Handle * chndl) return 0; } - -/* Scanner init, called at calibration and scan time. - Returns: - 1 if this was the first time the scanner was plugged in, - 0 afterward, and - -1 on error. */ - - /* Scan and save the resulting image as r,g,b non-interleaved PPM file */ static SANE_Status preread (CANON_Handle * chndl, SANE_Byte * data, FILE * fp) @@ -3487,7 +2944,27 @@ do_scan (CANON_Handle * chndl) case 1200: if (chndl->productcode == 0x2224) { - left_edge = 0x1e3; + left_edge = 0x1b2; + } + else + { + left_edge = 0x87; + } + break; + case 2400: + if (chndl->productcode == 0x2224) + { + left_edge = 0x287; /* 0x2eb; */ + } + else + { + left_edge = 0x87; + } + break; + case 4800: + if (chndl->productcode == 0x2224) + { + left_edge = 0x2e3; /* should be adjusted; 0x23e; 0x2eb; */ } else { @@ -3533,14 +3010,14 @@ do_scan (CANON_Handle * chndl) } /* Scan sequence */ -/* resolution is 75,150,300,600,1200 +/* resolution is 75,150,300,600,1200,2400,4800 scan coordinates in 600-dpi pixels */ static SANE_Status scan (CANON_Handle * chndl) { SANE_Status status = SANE_STATUS_GOOD; - /* Resolution: dpi 75, 150, 300, 600, 1200 */ + /* Resolution: dpi 75, 150, 300, 600, 1200, 2400, 4800 */ switch (chndl->val[opt_resolution].w) { case 75: @@ -3548,6 +3025,8 @@ scan (CANON_Handle * chndl) case 300: case 600: case 1200: + case 2400: + case 4800: break; default: chndl->val[opt_resolution].w = 600; @@ -3584,11 +3063,15 @@ CANON_set_scan_parameters (CANON_Handle * chndl) int widthi; int heighti; - int top_edge = 7; + int top_edge = 7; /* in mm */ if (chndl->val[opt_resolution].w < 300) { top_edge = 0; } + if (chndl->val[opt_resolution].w == 300 && chndl->productcode == 0x2224) + { + top_edge = 0; + } left = SANE_UNFIX (chndl->val[opt_tl_x].w) / MM_IN_INCH * 600; top = (top_edge + SANE_UNFIX (chndl->val[opt_tl_y].w)) / MM_IN_INCH * 600; @@ -3633,7 +3116,9 @@ CANON_set_scan_parameters (CANON_Handle * chndl) (chndl->val[opt_resolution].w != 150) && (chndl->val[opt_resolution].w != 300) && (chndl->val[opt_resolution].w != 600) && - (chndl->val[opt_resolution].w != 1200)) + (chndl->val[opt_resolution].w != 1200) && + (chndl->val[opt_resolution].w != 2400) && + (chndl->val[opt_resolution].w != 4800)) { return SANE_STATUS_INVAL; } @@ -3789,7 +3274,7 @@ CANON_start_scan (CANON_Handle * chndl) return status; } - /* read the temp file back out */ + /* prepare for reading the temp file back out */ chndl->fp = fopen (chndl->fname, "r"); DBG (4, "reading %s\n", chndl->fname); diff --git a/backend/canon_lide70.c b/backend/canon_lide70.c index 8f18ed9..4cc8999 100644 --- a/backend/canon_lide70.c +++ b/backend/canon_lide70.c @@ -225,10 +225,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (2, "sane_init: version_code %s 0, authorize %s 0\n", version_code == 0 ? "=" : "!=", authorize == 0 ? "=" : "!="); DBG (1, "sane_init: SANE Canon LiDE70 backend version %d.%d.%d from %s\n", - V_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); sanei_usb_init (); diff --git a/backend/canon_pp.c b/backend/canon_pp.c index 5a23892..b933102 100644 --- a/backend/canon_pp.c +++ b/backend/canon_pp.c @@ -147,7 +147,7 @@ sane_init (SANE_Int *vc, SANE_Auth_Callback cb) #endif if(vc) - *vc = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *vc = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); DBG(2,"sane_init: >> ieee1284_find_ports\n"); /* Find lp ports */ diff --git a/backend/cardscan.c b/backend/cardscan.c index 8090006..2adad7c 100644 --- a/backend/cardscan.c +++ b/backend/cardscan.c @@ -279,10 +279,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) sanei_usb_init(); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (5, "sane_init: cardscan backend %d.%d.%d, from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); DBG (10, "sane_init: finish\n"); diff --git a/backend/coolscan.c b/backend/coolscan.c index a7760c3..e51b499 100644 --- a/backend/coolscan.c +++ b/backend/coolscan.c @@ -3244,7 +3244,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (10, "sane_init\n"); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (COOLSCAN_CONFIG_FILE); if (!fp) diff --git a/backend/coolscan2.c b/backend/coolscan2.c index 9b1f570..f0d897f 100644 --- a/backend/coolscan2.c +++ b/backend/coolscan2.c @@ -348,7 +348,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) if (version_code) *version_code = - SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); sanei_usb_init (); diff --git a/backend/coolscan3.c b/backend/coolscan3.c index 5bc5b5e..f279c9c 100644 --- a/backend/coolscan3.c +++ b/backend/coolscan3.c @@ -317,7 +317,7 @@ sane_init(SANE_Int * version_code, SANE_Auth_Callback authorize) authorize = authorize; /* to shut up compiler */ if (version_code) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); sanei_usb_init(); diff --git a/backend/dc210.c b/backend/dc210.c index f2d1ec3..b6eae40 100644 --- a/backend/dc210.c +++ b/backend/dc210.c @@ -663,7 +663,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG_INIT (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (DC210_CONFIG_FILE); diff --git a/backend/dc240.c b/backend/dc240.c index 47aeab9..bdab777 100644 --- a/backend/dc240.c +++ b/backend/dc240.c @@ -820,7 +820,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG_INIT (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (DC240_CONFIG_FILE); diff --git a/backend/dc25.c b/backend/dc25.c index 1d9032d..59597a5 100644 --- a/backend/dc25.c +++ b/backend/dc25.c @@ -1833,7 +1833,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG_INIT (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (DC25_CONFIG_FILE); diff --git a/backend/dell1600n_net.c b/backend/dell1600n_net.c index 2436dd4..41be589 100644 --- a/backend/dell1600n_net.c +++ b/backend/dell1600n_net.c @@ -86,7 +86,7 @@ #define MAX_SCANNERS 32 /* version number */ -#define DRIVER_VERSION SANE_VERSION_CODE( SANE_CURRENT_MAJOR, V_MINOR, 0 ) +#define DRIVER_VERSION SANE_VERSION_CODE( SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0 ) /* size of buffer for socket communication */ #define SOCK_BUF_SIZE 2048 diff --git a/backend/dmc.c b/backend/dmc.c index 5edb417..b1a3b5a 100644 --- a/backend/dmc.c +++ b/backend/dmc.c @@ -816,7 +816,7 @@ sane_init(SANE_Int *version_code, SANE_Auth_Callback authorize) DBG_INIT(); if (version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); } fp = sanei_config_open(DMC_CONFIG_FILE); diff --git a/backend/epjitsu.c b/backend/epjitsu.c index 90ef148..6fda662 100644 --- a/backend/epjitsu.c +++ b/backend/epjitsu.c @@ -271,10 +271,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (10, "sane_init: start\n"); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (5, "sane_init: epjitsu backend %d.%d.%d, from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); DBG (10, "sane_init: finish\n"); diff --git a/backend/epson.c b/backend/epson.c index 8c1a41d..d0f5e54 100644 --- a/backend/epson.c +++ b/backend/epson.c @@ -2663,7 +2663,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) #endif if (version_code != NULL) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, SANE_EPSON_BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, SANE_EPSON_BUILD); sanei_usb_init (); diff --git a/backend/epson2-io.c b/backend/epson2-io.c index 9d23e2a..293a825 100644 --- a/backend/epson2-io.c +++ b/backend/epson2-io.c @@ -77,7 +77,8 @@ e2_send(Epson_Scanner * s, void *buf, size_t buf_size, size_t reply_len, if (reply_len == 0) { DBG(0, "Cannot send this command to a networked scanner\n"); - return SANE_STATUS_INVAL; + *status = SANE_STATUS_INVAL; + return 0; /* nothing actually sent */ } return sanei_epson_net_write(s, 0x2000, buf, buf_size, reply_len, status); diff --git a/backend/epson2-ops.c b/backend/epson2-ops.c index 83a0169..faf0ffa 100644 --- a/backend/epson2-ops.c +++ b/backend/epson2-ops.c @@ -291,14 +291,14 @@ e2_dev_post_init(struct Epson_Device *dev) dev->need_reset_on_source_change = SANE_FALSE; if (e2_dev_model(dev, "ES-9000H") || e2_dev_model(dev, "GT-30000")) { - dev->cmd->set_focus_position = 0; + dev->focusSupport = SANE_FALSE; dev->cmd->feed = 0x19; } if (e2_dev_model(dev, "GT-8200") || e2_dev_model(dev, "Perfection1650") || e2_dev_model(dev, "Perfection1640") || e2_dev_model(dev, "GT-8700")) { + dev->focusSupport = SANE_FALSE; dev->cmd->feed = 0; - dev->cmd->set_focus_position = 0; dev->need_reset_on_source_change = SANE_TRUE; } @@ -588,7 +588,7 @@ e2_discover_capabilities(Epson_Scanner *s) /* ESC F, request status */ status = esci_request_status(s, &scanner_status); if (status != SANE_STATUS_GOOD) - return status;; + return status; /* set capabilities */ if (scanner_status & STATUS_OPTION) @@ -817,20 +817,17 @@ e2_discover_capabilities(Epson_Scanner *s) DBG(1, "maximum supported color depth: %d\n", dev->maxDepth); /* - * Check for "request focus position" command. If this command is - * supported, then the scanner does also support the "set focus - * position" command. - * XXX ??? + * We assume that setting focus is supported when we can get the focus. + * This assumption may be overridden in e2_dev_post_init() */ - if (esci_request_focus_position(s, &s->currentFocusPosition) == SANE_STATUS_GOOD) { - DBG(1, "setting focus is supported, current focus: %u\n", s->currentFocusPosition); + DBG(1, "getting focus is supported, current focus: %u\n", s->currentFocusPosition); dev->focusSupport = SANE_TRUE; s->opt[OPT_FOCUS_POS].cap &= ~SANE_CAP_INACTIVE; s->val[OPT_FOCUS_POS].w = s->currentFocusPosition; } else { - DBG(1, "setting focus is not supported\n"); + DBG(1, "getting focus is not supported\n"); dev->focusSupport = SANE_FALSE; s->opt[OPT_FOCUS_POS].cap |= SANE_CAP_INACTIVE; s->val[OPT_FOCUS_POS].w = FOCUS_ON_GLASS; /* just in case */ @@ -1596,7 +1593,7 @@ e2_check_adf(Epson_Scanner * s) status = esci_request_extended_status(s, &buf, NULL); if (status != SANE_STATUS_GOOD) - return status;; + return status; t = buf[1]; @@ -1649,11 +1646,23 @@ e2_start_ext_scan(Epson_Scanner * s) if (buf[0] != STX) return SANE_STATUS_INVAL; - if (buf[1] & 0x80) { + if (buf[1] & STATUS_FER) { DBG(1, "%s: fatal error\n", __func__); return SANE_STATUS_IO_ERROR; } + /* + * The 12000XL signals busy only with FS+G, all other status queries + * say non-busy. Probably because you can in deed communicate with the + * device, just scanning is not yet possible. I tried polling with FS+G + * every 5 seconds, but that made scary noises. So, bail out and let + * the user retry manually. + */ + if (buf[1] & STATUS_NOT_READY) { + DBG(1, "%s: device not ready\n", __func__); + return SANE_STATUS_DEVICE_BUSY; + } + s->ext_block_len = le32atoh(&buf[2]); s->ext_blocks = le32atoh(&buf[6]); s->ext_last_len = le32atoh(&buf[10]); diff --git a/backend/epson2.c b/backend/epson2.c index a15a620..5bb75d4 100644 --- a/backend/epson2.c +++ b/backend/epson2.c @@ -15,10 +15,6 @@ * published by the Free Software Foundation, version 2. */ -#define EPSON2_VERSION 1 -#define EPSON2_REVISION 0 -#define EPSON2_BUILD 124 - /* debugging levels: * * 127 e2_recv buffer @@ -900,16 +896,14 @@ SANE_Status sane_init(SANE_Int *version_code, SANE_Auth_Callback __sane_unused__ authorize) { DBG_INIT(); - DBG(2, "%s: " PACKAGE " " VERSION "\n", __func__); - - DBG(1, "epson2 backend, version %i.%i.%i\n", - EPSON2_VERSION, EPSON2_REVISION, EPSON2_BUILD); + DBG(1, "%s: version " VERSION "\n", __func__); - if (version_code != NULL) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, - EPSON2_BUILD); + /* Keep '124' as our build version. The arg is obsolete by now */ + if (version_code) + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 124); sanei_usb_init(); + sanei_usb_set_timeout(60 * 1000); return SANE_STATUS_GOOD; } diff --git a/backend/epson2_usb.c b/backend/epson2_usb.c index 3977ee3..8c850ab 100644 --- a/backend/epson2_usb.c +++ b/backend/epson2_usb.c @@ -5,184 +5,193 @@ /* generated with epson2usb.pl doc/descriptions/epson2.desc */ SANE_Word sanei_epson_usb_product_ids[] = { - 0x101, /* GT-7000U, Perfection 636U */ - 0x103, /* GT-6600U, Perfection 610 */ - 0x104, /* GT-7600U, GT-7600UF, Perfection 1200U, Perfection 1200U PHOTO */ - 0x105, /* Stylus Scan 2000 */ - 0x106, /* Stylus Scan 2500 */ - 0x107, /* ES-2000, Expression 1600 */ - 0x109, /* ES-8500, Expression 1640XL */ - 0x10a, /* GT-8700, GT-8700F, Perfection 1640SU, Perfection 1640SU PHOTO */ - 0x10b, /* GT-7700U, Perfection 1240U */ - 0x10c, /* GT-6700U, Perfection 640U */ - 0x10e, /* ES-2200, Expression 1680 */ - 0x110, /* GT-8200U, GT-8200UF, Perfection 1650, Perfection 1650 PHOTO */ - 0x1116, /* XP-243 245 247 Series, XP-427 */ - 0x112, /* GT-9700F, Perfection 2450 PHOTO */ + 0x0101, /* GT-7000U, Perfection 636U */ + 0x0103, /* GT-6600U, Perfection 610 */ + 0x0104, /* GT-7600U, GT-7600UF, Perfection 1200U, Perfection 1200U PHOTO */ + 0x0105, /* Stylus Scan 2000 */ + 0x0106, /* Stylus Scan 2500 */ + 0x0107, /* ES-2000, Expression 1600 */ + 0x0109, /* ES-8500, Expression 1640XL */ + 0x010a, /* GT-8700, GT-8700F, Perfection 1640SU, Perfection 1640SU PHOTO */ + 0x010b, /* GT-7700U, Perfection 1240U */ + 0x010c, /* GT-6700U, Perfection 640U */ + 0x010e, /* ES-2200, Expression 1680 */ + 0x0110, /* GT-8200U, GT-8200UF, Perfection 1650, Perfection 1650 PHOTO */ + 0x0112, /* GT-9700F, Perfection 2450 PHOTO */ + 0x011b, /* GT-9300UF, Perfection 2400 PHOTO */ + 0x011c, /* GT-9800F, Perfection 3200 PHOTO */ + 0x011e, /* GT-8300UF, Perfection 1660 PHOTO */ + 0x0126, /* ES-7000H, GT-15000 */ + 0x0128, /* GT-X700, Perfection 4870 PHOTO */ + 0x0129, /* ES-10000G, Expression 10000XL */ + 0x012a, /* GT-X800, Perfection 4990 PHOTO */ + 0x012b, /* ES-H300, GT-2500 */ + 0x012c, /* GT-X900, Perfection V700 Photo, Perfection V750 Photo */ + 0x0135, /* GT-X970 */ + 0x0138, /* ES-H7200, GT-20000 */ + 0x014b, /* ES-G11000, Expression 11000XL */ + 0x0151, /* GT-X980, Perfection V800 Photo, Perfection V850 Pro */ + 0x015b, /* DS-G20000, Expression 12000XL */ + 0x0801, /* CC-600PX, Stylus CX5100, Stylus CX5200 */ + 0x0802, /* CC-570L, Stylus CX3100, Stylus CX3200 */ + 0x0805, /* Stylus CX6300, Stylus CX6400 */ + 0x0806, /* PM-A850, Stylus Photo RX600 */ + 0x0807, /* Stylus Photo RX500, Stylus Photo RX510 */ + 0x0808, /* Stylus CX5300, Stylus CX5400 */ + 0x080d, /* Stylus CX4500, Stylus CX4600 */ + 0x080e, /* PX-A550, Stylus CX3500, Stylus CX3600, Stylus CX3650 */ + 0x080f, /* Stylus Photo RX420, Stylus Photo RX425, Stylus Photo RX430 */ + 0x0810, /* PM-A900, Stylus Photo RX700 */ + 0x0811, /* PM-A870, Stylus Photo RX620, Stylus Photo RX630 */ + 0x0813, /* Stylus CX6500, Stylus CX6600 */ + 0x0814, /* PM-A700 */ + 0x0815, /* AcuLaser CX11, AcuLaser CX11NF, LP-A500 */ + 0x0817, /* LP-M5500, LP-M5500F */ + 0x0818, /* Stylus CX3700, Stylus CX3800, Stylus CX3810, Stylus DX3800 */ + 0x0819, /* PX-A650, Stylus CX4700, Stylus CX4800, Stylus DX4800, Stylus DX4850 */ + 0x081a, /* PM-A750, Stylus Photo RX520, Stylus Photo RX530 */ + 0x081c, /* PM-A890, Stylus Photo RX640, Stylus Photo RX650 */ + 0x081d, /* PM-A950 */ + 0x081f, /* Stylus CX7700, Stylus CX7800 */ + 0x0820, /* Stylus CX4100, Stylus CX4200, Stylus DX4200 */ + 0x0827, /* PM-A820, Stylus Photo RX560, Stylus Photo RX580, Stylus Photo RX590 */ + 0x0828, /* PM-A970 */ + 0x0829, /* PM-T990 */ + 0x082a, /* PM-A920 */ + 0x082b, /* Stylus CX4900, Stylus CX5000, Stylus DX5000 */ + 0x082e, /* PX-A720, Stylus CX5900, Stylus CX6000, Stylus DX6000 */ + 0x082f, /* PX-A620, Stylus CX3900, Stylus DX4000 */ + 0x0830, /* ME 200, Stylus CX2800, Stylus CX2900 */ + 0x0833, /* LP-M5600 */ + 0x0834, /* LP-M6000 */ + 0x0835, /* AcuLaser CX21 */ + 0x0836, /* PM-T960 */ + 0x0837, /* PM-A940, Stylus Photo RX680, Stylus Photo RX685, Stylus Photo RX690 */ + 0x0838, /* PX-A640, Stylus CX7300, Stylus CX7400, Stylus DX7400 */ + 0x0839, /* PX-A740, Stylus CX8300, Stylus CX8400, Stylus DX8400 */ + 0x083a, /* PX-FA700, Stylus CX9300F, Stylus CX9400Fax, Stylus DX9400F */ + 0x083c, /* PM-A840, PM-A840S, Stylus Photo RX585, Stylus Photo RX595, Stylus Photo RX610 */ + 0x0841, /* ME 300, PX-401A, Stylus NX100, Stylus SX100, Stylus TX100 */ + 0x0843, /* LP-M5000 */ + 0x0844, /* Artisan 800, EP-901A, EP-901F, Stylus Photo PX800FW, Stylus Photo TX800FW */ + 0x0846, /* Artisan 700, EP-801A, Stylus Photo PX700W, Stylus Photo TX700W */ + 0x0847, /* ME Office 700FW, PX-601F, Stylus Office BX600FW, Stylus Office TX600FW, Stylus SX600FW, WorkForce 600 */ + 0x0848, /* ME Office 600F, Stylus Office BX300F, Stylus Office TX300F, Stylus NX300 Series */ + 0x0849, /* Stylus NX200, Stylus SX200, Stylus SX205, Stylus TX200, Stylus TX203, Stylus TX209 */ + 0x084a, /* PX-501A, Stylus NX400, Stylus SX400, Stylus SX405, Stylus TX400 */ + 0x084c, /* WorkForce 500 */ + 0x084d, /* PX-402A, Stylus NX110 Series, Stylus SX110 Series, Stylus TX110 Series */ + 0x084f, /* ME OFFICE 510, Stylus NX210 Series, Stylus SX210 Series, Stylus TX210 Series */ + 0x0850, /* EP-702A, Stylus Photo PX650 Series, Stylus Photo TX650 Series */ + 0x0851, /* Stylus NX410 Series, Stylus SX410 Series, Stylus TX410 Series */ + 0x0852, /* Artisan 710 Series, EP-802A, Stylus Photo PX710W Series, Stylus Photo TX710W Series */ + 0x0853, /* Artisan 810 Series, EP-902A, Stylus Photo PX810FW Series */ + 0x0854, /* ME OFFICE 650FN Series, Stylus Office BX310FN Series, Stylus Office TX510FN Series, WorkForce 310 Series */ + 0x0855, /* PX-602F, Stylus Office BX610FW Series, Stylus Office TX610FW Series, Stylus SX610FW Series, WorkForce 610 Series */ + 0x0856, /* PX-502A, Stylus NX510 Series, Stylus SX510W Series, Stylus TX550W Series */ + 0x085c, /* ME 320 Series, ME 330 Series, Stylus NX125, Stylus NX127, Stylus SX125, Stylus TX120 Series */ + 0x085d, /* ME OFFICE 960FWD Series, PX-603F, Stylus Office BX625FWD, Stylus Office TX620FWD Series, Stylus SX620FW Series, WorkForce 630 Series */ + 0x085e, /* ME OFFICE 900WD Series, PX-503A, Stylus Office BX525WD, Stylus NX625, Stylus SX525WD, Stylus TX560WD Series, WorkForce 625 */ + 0x085f, /* Stylus Office BX320FW Series, Stylus Office TX525FW, WorkForce 520 Series */ + 0x0860, /* Artisan 835, EP-903A, EP-903F, Stylus Photo PX820FWD Series, Stylus Photo TX820FWD Series */ + 0x0861, /* Artisan 725, EP-803A, EP-803AW, Stylus Photo PX720WD Series, Stylus Photo TX720WD Series */ + 0x0862, /* EP-703A, Stylus Photo PX660 Series */ + 0x0863, /* ME OFFICE 620F Series, Stylus Office BX305F, Stylus Office BX305FW, Stylus Office TX320F Series, WorkForce 320 Series */ + 0x0864, /* ME OFFICE 560W Series, Stylus NX420 Series, Stylus SX420W Series, Stylus TX420W Series */ + 0x0865, /* ME OFFICE 520 Series, Stylus NX220 Series, Stylus SX218, Stylus TX220 Series */ + 0x0866, /* AcuLaser MX20DN, AcuLaser MX20DNF, AcuLaser MX21DNF */ + 0x0869, /* PX-1600F, WF-7510 Series */ + 0x086a, /* PX-673F, Stylus Office BX925FWD, WorkForce 840 Series */ + 0x0870, /* Stylus Office BX305FW Plus, WorkForce 435 */ + 0x0871, /* K200 Series */ + 0x0872, /* K300 Series, WorkForce K301 */ + 0x0873, /* L200 Series */ + 0x0878, /* Artisan 635, EP-704A */ + 0x0879, /* Artisan 837, EP-904A, EP-904F, Stylus Photo PX830FWD Series */ + 0x087b, /* Artisan 730 Series, EP-804A, EP-804AR, EP-804AW, Stylus Photo PX730WD Series, Stylus Photo TX730WD Series */ + 0x087c, /* PX-1700F, WF-7520 Series */ + 0x087d, /* PX-B750F, WP-4511, WP-4515, WP-4521, WP-4525, WP-4530 Series, WP-4540 Series */ + 0x087e, /* WP-4590 Series */ + 0x087f, /* PX-403A */ + 0x0880, /* ME OFFICE 570W Series, PX-434A, Stylus NX330 Series, Stylus SX430W Series, Stylus TX430W Series */ + 0x0881, /* ME OFFICE 535, PX-404A, Stylus SX230 Series, Stylus TX235 */ + 0x0883, /* ME 340 Series, Stylus NX130 Series, Stylus SX130 Series, Stylus TX130 Series */ + 0x0884, /* Stylus NX430W Series, Stylus SX440W Series, Stylus TX435W */ + 0x0885, /* Stylus NX230 Series, Stylus SX235W, Stylus TX230W Series */ + 0x088d, /* Epson ME 350 */ + 0x088f, /* Stylus Office BX635FWD, WorkForce 645 */ + 0x0890, /* ME OFFICE 940FW Series, Stylus Office BX630FW Series, WorkForce 545 */ + 0x0891, /* PX-504A, Stylus Office BX535WD, Stylus NX530 Series, Stylus NX635, Stylus SX535WD */ + 0x0892, /* Stylus Office BX935FWD, WorkForce 845 */ + 0x0893, /* EP-774A */ + 0x0894, /* LP-M5300 Series */ + 0x0895, /* PX-045A, XP-100 Series */ + 0x0896, /* ME-301, XP-200 Series */ + 0x0897, /* ME-303, PX-405A */ + 0x0898, /* ME-401, PX-435A, XP-300 Series, XP-400 Series */ + 0x0899, /* PX-605F, PX-675F, WF-3520 Series, WF-3530 Series, WF-3540 Series */ + 0x089a, /* EP-905F, XP-850 Series */ + 0x089b, /* EP-905A, XP-800 Series */ + 0x089c, /* EP-805A, EP-805AR, EP-805AW, XP-750 Series */ + 0x089d, /* XP-700 Series */ + 0x089e, /* EP-775A, EP-775AW, XP-600 Series */ + 0x089f, /* EP-705A */ + 0x08a0, /* ME-101 */ + 0x08a1, /* L210 Series, L350, L351 */ + 0x08a5, /* PX-505F, WF-2510 Series */ + 0x08a6, /* PX-535F, WF-2520 Series, WF-2530 Series, WF-2540 Series */ + 0x08a7, /* WP-M4525, WP-M4521, PX-K751F, WP-M4595 */ + 0x08a8, /* L355, L358 */ + 0x08a9, /* L550 Series */ + 0x08aa, /* M200 Series */ + 0x08ab, /* WF-M1560 Series */ + 0x08ac, /* AL-MX300DN Series, AL-MX300DNF Series */ + 0x08ad, /* LP-M8040, LP-M8040A, LP-M8040F */ + 0x08ae, /* PX-046A, XP-211, XP-212, XP-215 */ + 0x08af, /* PX-436A, XP-310 Series */ + 0x08b0, /* XP-410 Series */ + 0x08b3, /* EP-976A3, XP-950 Series */ + 0x08b4, /* EP-906F, XP-810 Series */ + 0x08b5, /* EP-806AB, EP-806AR, EP-806AW, XP-710 Series */ + 0x08b6, /* EP-776AB, EP-776AW, XP-610 Series */ + 0x08b7, /* EP-706A, XP-510 Series */ + 0x08b8, /* PX-M740F, PX-M741F, WF-3620 Series, WF-3640 Series */ + 0x08b9, /* PX-M5040F, PX-M5041F, WF-7610 Series, WF-7620 Series */ + 0x08bd, /* PX-M840F, WF-5620 Series, WF-5690 Series */ + 0x08be, /* WF-4630 Series, WF-4640 Series */ + 0x08bf, /* PX-437A, XP-320 Series */ + 0x08c0, /* PX-047A, XP-225 */ + 0x08c1, /* XP-420 Series */ + 0x08c3, /* PX-M650A, PX-M650F, WF-2650 Series, WF-2660 Series */ + 0x08c4, /* WF-2630 Series */ + 0x08c5, /* EP-977A3 */ + 0x08c6, /* EP-907F, XP-820 Series, XP-860 Series */ + 0x08c7, /* EP-807AB, EP-807AR, EP-807AW, XP-720 Series, XP-760 Series */ + 0x08c8, /* EP-777A, XP-520 Series, XP-620 Series */ + 0x08c9, /* EP-707A */ + 0x08ca, /* L850 Series */ + 0x08cd, /* WF-R4640 Series, WF-R5690 Series */ + 0x08d0, /* PX-M350F, WF-M5690 Series */ + 0x08d2, /* L365 Series, L366 Series */ + 0x1102, /* PX-048A Series, XP-230 Series, XP-235 Series */ + 0x1105, /* ET-2500 Series, L375 Series */ + 0x110f, /* PX-M160T Series */ + 0x1116, /* XP-240 243 245 247 Series, XP-427, PX-049A Series */ 0x1120, /* L380 */ 0x1121, /* ET-2650, L495 */ - 0x1122, /* ET-2600 */ + 0x1122, /* ET-2600 Series, ET-2610 Series, L3050 Series, L3060 Series, L395 Series, L396 Series */ 0x113d, /* XP-255 */ - 0x11b, /* GT-9300UF, Perfection 2400 PHOTO */ - 0x11c, /* GT-9800F, Perfection 3200 PHOTO */ - 0x11e, /* GT-8300UF, Perfection 1660 PHOTO */ - 0x126, /* ES-7000H, GT-15000 */ - 0x128, /* GT-X700, Perfection 4870 PHOTO */ - 0x129, /* ES-10000G, Expression 10000XL */ - 0x12a, /* GT-X800, Perfection 4990 PHOTO */ - 0x12b, /* ES-H300, GT-2500 */ - 0x12c, /* GT-X900, Perfection V700 Photo, Perfection V750 Photo */ - 0x135, /* GT-X970 */ - 0x138, /* ES-H7200, GT-20000 */ - 0x14b, /* ES-G11000, Expression 11000XL */ - 0x151, /* GT-X980, Perfection V800 Photo, Perfection V850 Pro */ - 0x15b, /* DS-G20000, Expression 12000XL */ - 0x801, /* CC-600PX, Stylus CX5100, Stylus CX5200 */ - 0x802, /* CC-570L, Stylus CX3100, Stylus CX3200 */ - 0x805, /* Stylus CX6300, Stylus CX6400 */ - 0x806, /* PM-A850, Stylus Photo RX600 */ - 0x807, /* Stylus Photo RX500, Stylus Photo RX510 */ - 0x808, /* Stylus CX5300, Stylus CX5400 */ - 0x80d, /* Stylus CX4500, Stylus CX4600 */ - 0x80e, /* PX-A550, Stylus CX3500, Stylus CX3600, Stylus CX3650 */ - 0x80f, /* Stylus Photo RX420, Stylus Photo RX425, Stylus Photo RX430 */ - 0x810, /* PM-A900, Stylus Photo RX700 */ - 0x811, /* PM-A870, Stylus Photo RX620, Stylus Photo RX630 */ - 0x813, /* Stylus CX6500, Stylus CX6600 */ - 0x814, /* PM-A700 */ - 0x815, /* AcuLaser CX11, AcuLaser CX11NF, LP-A500 */ - 0x817, /* LP-M5500, LP-M5500F */ - 0x818, /* Stylus CX3700, Stylus CX3800, Stylus CX3810, Stylus DX3800 */ - 0x819, /* PX-A650, Stylus CX4700, Stylus CX4800, Stylus DX4800, Stylus DX4850 */ - 0x81a, /* PM-A750, Stylus Photo RX520, Stylus Photo RX530 */ - 0x81c, /* PM-A890, Stylus Photo RX640, Stylus Photo RX650 */ - 0x81d, /* PM-A950 */ - 0x81f, /* Stylus CX7700, Stylus CX7800 */ - 0x820, /* Stylus CX4100, Stylus CX4200, Stylus DX4200 */ - 0x827, /* PM-A820, Stylus Photo RX560, Stylus Photo RX580, Stylus Photo RX590 */ - 0x828, /* PM-A970 */ - 0x829, /* PM-T990 */ - 0x82a, /* PM-A920 */ - 0x82b, /* Stylus CX4900, Stylus CX5000, Stylus DX5000 */ - 0x82e, /* PX-A720, Stylus CX5900, Stylus CX6000, Stylus DX6000 */ - 0x82f, /* PX-A620, Stylus CX3900, Stylus DX4000 */ - 0x830, /* ME 200, Stylus CX2800, Stylus CX2900 */ - 0x833, /* LP-M5600 */ - 0x834, /* LP-M6000 */ - 0x835, /* AcuLaser CX21 */ - 0x836, /* PM-T960 */ - 0x837, /* PM-A940, Stylus Photo RX680, Stylus Photo RX685, Stylus Photo RX690 */ - 0x838, /* PX-A640, Stylus CX7300, Stylus CX7400, Stylus DX7400 */ - 0x839, /* PX-A740, Stylus CX8300, Stylus CX8400, Stylus DX8400 */ - 0x83a, /* PX-FA700, Stylus CX9300F, Stylus CX9400Fax, Stylus DX9400F */ - 0x83c, /* PM-A840, PM-A840S, Stylus Photo RX585, Stylus Photo RX595, Stylus Photo RX610 */ - 0x841, /* ME 300, PX-401A, Stylus NX100, Stylus SX100, Stylus TX100 */ - 0x843, /* LP-M5000 */ - 0x844, /* Artisan 800, EP-901A, EP-901F, Stylus Photo PX800FW, Stylus Photo TX800FW */ - 0x846, /* Artisan 700, EP-801A, Stylus Photo PX700W, Stylus Photo TX700W */ - 0x847, /* ME Office 700FW, PX-601F, Stylus Office BX600FW, Stylus Office TX600FW, Stylus SX600FW, WorkForce 600 */ - 0x848, /* ME Office 600F, Stylus Office BX300F, Stylus Office TX300F, Stylus NX300 Series */ - 0x849, /* Stylus NX200, Stylus SX200, Stylus SX205, Stylus TX200, Stylus TX203, Stylus TX209 */ - 0x84a, /* PX-501A, Stylus NX400, Stylus SX400, Stylus SX405, Stylus TX400 */ - 0x84c, /* WorkForce 500 */ - 0x84d, /* PX-402A, Stylus NX110 Series, Stylus SX110 Series, Stylus TX110 Series */ - 0x84f, /* ME OFFICE 510, Stylus NX210 Series, Stylus SX210 Series, Stylus TX210 Series */ - 0x850, /* EP-702A, Stylus Photo PX650 Series, Stylus Photo TX650 Series */ - 0x851, /* Stylus NX410 Series, Stylus SX410 Series, Stylus TX410 Series */ - 0x852, /* Artisan 710 Series, EP-802A, Stylus Photo PX710W Series, Stylus Photo TX710W Series */ - 0x853, /* Artisan 810 Series, EP-902A, Stylus Photo PX810FW Series */ - 0x854, /* ME OFFICE 650FN Series, Stylus Office BX310FN Series, Stylus Office TX510FN Series, WorkForce 310 Series */ - 0x855, /* PX-602F, Stylus Office BX610FW Series, Stylus Office TX610FW Series, Stylus SX610FW Series, WorkForce 610 Series */ - 0x856, /* PX-502A, Stylus NX510 Series, Stylus SX510W Series, Stylus TX550W Series */ - 0x85c, /* ME 320 Series, ME 330 Series, Stylus NX125, Stylus NX127, Stylus SX125, Stylus TX120 Series */ - 0x85d, /* ME OFFICE 960FWD Series, PX-603F, Stylus Office BX625FWD, Stylus Office TX620FWD Series, Stylus SX620FW Series, WorkForce 630 Series */ - 0x85e, /* ME OFFICE 900WD Series, PX-503A, Stylus Office BX525WD, Stylus NX625, Stylus SX525WD, Stylus TX560WD Series, WorkForce 625 */ - 0x85f, /* Stylus Office BX320FW Series, Stylus Office TX525FW, WorkForce 520 Series */ - 0x860, /* Artisan 835, EP-903A, EP-903F, Stylus Photo PX820FWD Series, Stylus Photo TX820FWD Series */ - 0x861, /* Artisan 725, EP-803A, EP-803AW, Stylus Photo PX720WD Series, Stylus Photo TX720WD Series */ - 0x862, /* EP-703A, Stylus Photo PX660 Series */ - 0x863, /* ME OFFICE 620F Series, Stylus Office BX305F, Stylus Office BX305FW, Stylus Office TX320F Series, WorkForce 320 Series */ - 0x864, /* ME OFFICE 560W Series, Stylus NX420 Series, Stylus SX420W Series, Stylus TX420W Series */ - 0x865, /* ME OFFICE 520 Series, Stylus NX220 Series, Stylus SX218, Stylus TX220 Series */ - 0x866, /* AcuLaser MX20DN, AcuLaser MX20DNF, AcuLaser MX21DNF */ - 0x869, /* PX-1600F, WF-7510 Series */ - 0x86a, /* PX-673F, Stylus Office BX925FWD, WorkForce 840 Series */ - 0x870, /* Stylus Office BX305FW Plus, WorkForce 435 */ - 0x871, /* K200 Series */ - 0x872, /* K300 Series, WorkForce K301 */ - 0x873, /* L200 Series */ - 0x878, /* Artisan 635, EP-704A */ - 0x879, /* Artisan 837, EP-904A, EP-904F, Stylus Photo PX830FWD Series */ - 0x87b, /* Artisan 730 Series, EP-804A, EP-804AR, EP-804AW, Stylus Photo PX730WD Series, Stylus Photo TX730WD Series */ - 0x87c, /* PX-1700F, WF-7520 Series */ - 0x87d, /* PX-B750F, WP-4511, WP-4515, WP-4521, WP-4525, WP-4530 Series, WP-4540 Series */ - 0x87e, /* WP-4590 Series */ - 0x87f, /* PX-403A */ - 0x880, /* ME OFFICE 570W Series, PX-434A, Stylus NX330 Series, Stylus SX430W Series, Stylus TX430W Series */ - 0x881, /* ME OFFICE 535, PX-404A, Stylus SX230 Series, Stylus TX235 */ - 0x883, /* ME 340 Series, Stylus NX130 Series, Stylus SX130 Series, Stylus TX130 Series */ - 0x884, /* Stylus NX430W Series, Stylus SX440W Series, Stylus TX435W */ - 0x885, /* Stylus NX230 Series, Stylus SX235W, Stylus TX230W Series */ - 0x88d, /* Epson ME 350 */ - 0x88f, /* Stylus Office BX635FWD, WorkForce 645 */ - 0x890, /* ME OFFICE 940FW Series, Stylus Office BX630FW Series, WorkForce 545 */ - 0x891, /* PX-504A, Stylus Office BX535WD, Stylus NX530 Series, Stylus NX635, Stylus SX535WD */ - 0x892, /* Stylus Office BX935FWD, WorkForce 845 */ - 0x893, /* EP-774A */ - 0x894, /* LP-M5300 Series */ - 0x895, /* PX-045A, XP-100 Series */ - 0x896, /* ME-301, XP-200 Series */ - 0x897, /* ME-303, PX-405A */ - 0x898, /* ME-401, PX-435A, XP-300 Series, XP-400 Series */ - 0x899, /* PX-605F, PX-675F, WF-3520 Series, WF-3530 Series, WF-3540 Series */ - 0x89a, /* EP-905F, XP-850 Series */ - 0x89b, /* EP-905A, XP-800 Series */ - 0x89c, /* EP-805A, EP-805AR, EP-805AW, XP-750 Series */ - 0x89d, /* XP-700 Series */ - 0x89e, /* EP-775A, EP-775AW, XP-600 Series */ - 0x89f, /* EP-705A */ - 0x8a0, /* ME-101 */ - 0x8a1, /* L210 Series, L350, L351 */ - 0x8a5, /* PX-505F, WF-2510 Series */ - 0x8a6, /* PX-535F, WF-2520 Series, WF-2530 Series, WF-2540 Series */ - 0x8a7, /* WP-M4525, WP-M4521, PX-K751F, WP-M4595 */ - 0x8a8, /* L355, L358 */ - 0x8a9, /* L550 Series */ - 0x8aa, /* M200 Series */ - 0x8ab, /* WF-M1560 Series */ - 0x8ac, /* AL-MX300DN Series, AL-MX300DNF Series */ - 0x8ad, /* LP-M8040, LP-M8040A, LP-M8040F */ - 0x8ae, /* PX-046A, XP-211, XP-212, XP-215 */ - 0x8af, /* PX-436A, XP-310 Series */ - 0x8b0, /* XP-410 Series */ - 0x8b3, /* EP-976A3, XP-950 Series */ - 0x8b4, /* EP-906F, XP-810 Series */ - 0x8b5, /* EP-806AB, EP-806AR, EP-806AW, XP-710 Series */ - 0x8b6, /* EP-776AB, EP-776AW, XP-610 Series */ - 0x8b7, /* EP-706A, XP-510 Series */ - 0x8b8, /* PX-M740F, PX-M741F, WF-3620 Series, WF-3640 Series */ - 0x8b9, /* PX-M5040F, PX-M5041F, WF-7610 Series, WF-7620 Series */ - 0x8bd, /* PX-M840F, WF-5620 Series, WF-5690 Series */ - 0x8be, /* WF-4630 Series, WF-4640 Series */ - 0x8bf, /* PX-437A, XP-320 Series */ - 0x8c0, /* PX-047A, XP-225 */ - 0x8c1, /* XP-420 Series */ - 0x8c3, /* PX-M650A, PX-M650F, WF-2650 Series, WF-2660 Series */ - 0x8c4, /* WF-2630 Series */ - 0x8c5, /* EP-977A3 */ - 0x8c6, /* EP-907F, XP-820 Series, XP-860 Series */ - 0x8c7, /* EP-807AB, EP-807AR, EP-807AW, XP-720 Series, XP-760 Series */ - 0x8c8, /* EP-777A, XP-520 Series, XP-620 Series */ - 0x8c9, /* EP-707A */ - 0x8ca, /* L850 Series */ - 0x8cd, /* WF-R4640 Series, WF-R5690 Series */ - 0x8d0, /* PX-M350F, WF-M5690 Series */ - 0 /* last entry - this is used for devices that are specified - in the config file as "usb " */ + 0x113e, /* XP-452 455 Series */ + 0x1141, /* L3100 Series */ + 0x1142, /* L3110 Series */ + 0x1188, /* L3210 Series */ + 0x1189, /* L3200 Series */ + 0 /* last entry - this is used for devices that are specified + in the config file as "usb " */ }; int -sanei_epson_getNumberOfUSBProductIds (void) +sanei_epson_getNumberOfUSBProductIds(void) { return sizeof (sanei_epson_usb_product_ids) / sizeof (SANE_Word); } diff --git a/backend/epsonds-cmd.c b/backend/epsonds-cmd.c index 5141e07..6f0ec64 100644 --- a/backend/epsonds-cmd.c +++ b/backend/epsonds-cmd.c @@ -134,6 +134,7 @@ static SANE_Status esci2_cmd(epsonds_scanner* s, SANE_Status status; unsigned int more; char header[13], rbuf[64]; /* add one more byte for header buffer to correct buffer overflow issue,*/ + char *buf; DBG(8, "%s: %4s len %lu, payload len: %lu\n", __func__, cmd, len, plen); @@ -151,6 +152,21 @@ static SANE_Status esci2_cmd(epsonds_scanner* s, // send RequestBlock, request immediate response if there's no payload status = eds_txrx(s, header, len, rbuf, (plen > 0) ? 0 : 64); + + /* pointer to the token's value */ + buf = rbuf + 12; + /* nrd / nrdBUSY */ + DBG(8, "buf = %s\n",buf); + if (strncmp("#nrd", buf, 4) == 0) { + buf += 4; + DBG(8, "buf = %s\n",buf); + if (strncmp("BUSY", buf, 4) == 0) { + DBG(8, "device busy\n"); + DBG(8, "SANE_STATUS:%d\n", SANE_STATUS_DEVICE_BUSY); + return SANE_STATUS_DEVICE_BUSY; + } + } + if (status != SANE_STATUS_GOOD) { return status; } @@ -227,6 +243,21 @@ SANE_Status esci2_fin(epsonds_scanner *s) DBG(5, "%s\n", __func__); status = esci2_cmd_simple(s, "FIN x0000000", NULL); + + for(int i = 0; i < 10; i++) { + + if(status == SANE_STATUS_DEVICE_BUSY || status == SANE_STATUS_IO_ERROR) { + status = esci2_cmd_simple(s, "FIN x0000000", NULL); + } + else { + DBG(1, "break\n"); + break; + } + DBG(1, "sleep(5)\n"); + sleep(5); + + } + s->locked = 0; return status; } @@ -264,13 +295,13 @@ static char *decode_binary(char *buf, int len) memcpy(tmp, buf, 4); tmp[4] = '\0'; - len -= 4; if (buf[0] != 'h') return NULL; hl = strtol(tmp + 1, NULL, 16); - if (hl > len) hl = len; + if (hl > len) + hl = len; if (hl) { char *v = malloc(hl + 1); @@ -313,9 +344,6 @@ static SANE_Status info_cb(void *userdata, char *token, int len) epsonds_scanner *s = (epsonds_scanner *)userdata; char *value; - if (DBG_LEVEL >= 11) { - debug_token(DBG_LEVEL, __func__, token, len); - } /* pointer to the token's value */ value = token + 3; @@ -333,7 +361,6 @@ static SANE_Status info_cb(void *userdata, char *token, int len) s->hw->model = decode_string(value, len); s->hw->sane.model = s->hw->model; DBG(1, " product: %s\n", s->hw->model); - /* we will free the string later */ } if (strncmp("VER", token, 3) == 0) { @@ -421,6 +448,7 @@ static SANE_Status info_cb(void *userdata, char *token, int len) int max = decode_value(value + 4 + 8, 8); DBG(1, " ADF: area %dx%d @ 100dpi\n", min, max); + eds_set_adf_area(s->hw, min, max, 100); } if (strncmp("AMIN", value, 4) == 0) { @@ -437,11 +465,40 @@ static SANE_Status info_cb(void *userdata, char *token, int len) int max = decode_value(value + 4 + 8, 8); DBG(1, " ADF: max %dx%d @ 100dpi\n", min, max); + } + } + + + + + + + if (len == 16) { + + if (strncmp("AREA", value, 4) == 0) { + + int min = decode_value(value + 4, 4); + int max = decode_value(value + 4 + 4, 8); + + DBG(1, " ADF: area %dx%d @ 100dpi\n", min, max); eds_set_adf_area(s->hw, min, max, 100); } + + if (strncmp("AMAX", value, 4) == 0) { + + // d + int min = decode_value(value + 4, 4); + // i + int max = decode_value(value + 4 + 4, 8); + + DBG(1, " ADF: max %dx%d @ 100dpi\n", min, max); + } } + + + if (len == 12) { /* RESOi0000600 */ @@ -483,6 +540,22 @@ static SANE_Status info_cb(void *userdata, char *token, int len) } } + + if (len == 16) { + + /* AREAi0000850i0001400 */ + if (strncmp("AREA", value, 4) == 0) { + //d + int min = decode_value(value + 4, 4); + //i + int max = decode_value(value + 4 + 4, 8); + + DBG(1, " FB: area %dx%d @ 100dpi\n", min, max); + + eds_set_fbf_area(s->hw, min, max, 100); + } + } + if (len == 8) { if (strncmp("ALGNLEFT", value, len) == 0) { @@ -602,6 +675,7 @@ static SANE_Status capa_cb(void *userdata, char *token, int len) if (strncmp("ADFCRP ", token, 3 + 4) == 0) { DBG(1, " ADF: image cropping\n"); + s->hw->adf_has_crp = 1; } if (strncmp("ADFFAST", token, 3 + 4) == 0) { @@ -636,6 +710,23 @@ static SANE_Status capa_cb(void *userdata, char *token, int len) } } + + if (strncmp("COLLIST", token, 3 + 4) == 0) + { + char *p = token + 3 + 4; + int count = (len - 4); + int readBytes = 0; + s->hw->has_mono = 0; + while (readBytes < count) { + if (strncmp(p, "M001", 4) == 0) + { + s->hw->has_mono = 1; + } + readBytes+=4; + p+=4; + } + } + /* RSMRANGi0000050i0000600 */ if (strncmp("RSMRANG", token, 3 + 4) == 0) { @@ -659,17 +750,24 @@ static SANE_Status capa_cb(void *userdata, char *token, int len) char *p = token + 3 + 4; - if (p[0] == 'i') { - - int i; - int count = (len - 4) / 8; - for (i = 0; i < count; i++) { + int count = (len - 4); + int readBytes = 0; + while (readBytes < count) { + if(*p == 'i') + { eds_add_resolution(s->hw, decode_value(p, 8)); p += 8; + readBytes += 8; + }else if(*p == 'd') + { + eds_add_resolution(s->hw, decode_value(p, 4)); + p += 4; + readBytes +=4; + } } - } + } return SANE_STATUS_GOOD; @@ -684,16 +782,26 @@ SANE_Status esci2_capa(epsonds_scanner *s) static SANE_Status stat_cb(void *userdata, char *token, int len) { -/* - epsonds_scanner *s = (epsonds_scanner *)userdata; char *value = token + 3; -*/ + userdata = userdata; if (DBG_LEVEL >= 11) { debug_token(DBG_LEVEL, __func__, token, len); } + if (strncmp("ERR", token, 3) == 0) { + if (strncmp("ADF PE ", value, len) == 0) { + DBG(1, " PE : paper empty\n"); + return SANE_STATUS_NO_DOCS; + } + + if (strncmp("ADF OPN", value, len) == 0) { + DBG(1, " conver open\n"); + return SANE_STATUS_COVER_OPEN; + } + } + return SANE_STATUS_GOOD; } @@ -742,10 +850,10 @@ static SANE_Status para_cb(void *userdata, char *token, int len) return SANE_STATUS_GOOD; } -SANE_Status esci2_para(epsonds_scanner *s, char *parameters) +SANE_Status esci2_para(epsonds_scanner *s, char *parameters, int len) { DBG(8, "%s: %s\n", __func__, parameters); - return esci2_cmd(s, "PARAx0000000", 12, parameters, strlen(parameters), NULL, ¶_cb); + return esci2_cmd(s, "PARAx0000000", 12, parameters, len, NULL, ¶_cb); } SANE_Status esci2_mech(epsonds_scanner *s, char *parameters) @@ -784,12 +892,105 @@ static SANE_Status img_cb(void *userdata, char *token, int len) return SANE_STATUS_GOOD; } + if (len == 12 && strncmp("pst", token, 3) == 0) { + + s->dummy = decode_value(token + 3 + 4, 4); + + DBG(10, "%s: pst width: %d, height: %d, dummy: %d\n", + __func__, + decode_value(token + 3, 4), + decode_value(token + 3 + 4 + 4, 4), + s->dummy); + + return SANE_STATUS_GOOD; + } + + if (len == 16 && strncmp("pst", token, 3) == 0) { + + s->dummy = decode_value(token + 3 + 4, 4); + + DBG(10, "%s: pst width: %d, height: %d, dummy: %d\n", + __func__, + decode_value(token + 3, 4), + decode_value(token + 3 + 4 + 4, 8), + s->dummy); + + return SANE_STATUS_GOOD; + } + + if (len == 20 && strncmp("pst", token, 3) == 0) { + + s->dummy = decode_value(token + 3 + 8, 4); + + DBG(10, "%s: pst width: %d, height: %d, dummy: %d\n", + __func__, + decode_value(token + 3, 8), + decode_value(token + 3 + 8 + 4, 8), + s->dummy); + + return SANE_STATUS_GOOD; + } + + + // i0001696i0002347 if (len == 16 && strncmp("pen", token, 3) == 0) { DBG(10, "%s: page end\n", __func__); s->eof = 1; + if (s->isflatbedScan) + { + s->scanning = 0; + } + DBG(10, "%s: pen width: %d, height: %d, dummy: %d\n", + __func__, + decode_value(token + 3, 8), + decode_value(token + 3 + 8, 8), + s->dummy); + s->width_temp = decode_value(token + 3, 8); + s->height_temp = decode_value(token + 3 + 8, 8); return SANE_STATUS_EOF; } + // d696i0002347 + if (len == 12 && strncmp("pen", token, 3) == 0) { + DBG(10, "%s: page end\n", __func__); + s->eof = 1; + if (s->isflatbedScan) + { + s->scanning = 0; + } + + DBG(10, "%s: pen width: %d, height: %d, dummy: %d\n", + __func__, + decode_value(token + 3, 4), + decode_value(token + 3 + 4, 8), + s->dummy); + + s->width_temp = decode_value(token + 3, 4); + s->height_temp = decode_value(token + 3 + 4, 8); + return SANE_STATUS_EOF; + } + + // d696d2347 + if (len == 8 && strncmp("pen", token, 3) == 0) { + DBG(10, "%s: page end\n", __func__); + s->eof = 1; + if (s->isflatbedScan) + { + s->scanning = 0; + } + DBG(10, "%s: pen width: %d, height: %d, dummy: %d\n", + __func__, + decode_value(token + 3, 4), + decode_value(token + 3 + 4, 4), + s->dummy); + + s->width_temp = decode_value(token + 3, 4); + s->height_temp = decode_value(token + 3 + 4, 4); + + return SANE_STATUS_EOF; + } + + /* typIMGA or typIMGB */ if (len == 4 && strncmp("typ", token, 3) == 0) { @@ -807,6 +1008,7 @@ static SANE_Status img_cb(void *userdata, char *token, int len) char *cause = token + 3 + 4; /* OPN, PJ, PE, ERR, LTF, LOCK, DFED, DTCL, AUT, PERM */ s->scanning = 0; + s->scanEnd = 1; DBG(1, "%s: error on option %3.3s, cause %4.4s\n", __func__, option, cause); @@ -831,6 +1033,8 @@ static SANE_Status img_cb(void *userdata, char *token, int len) } if (len == 4 && strncmp("lftd000", token, 3 + 4) == 0) { + DBG(1, "%s:lft ok\n", __func__); + s->scanEnd = 1; s->scanning = 0; } @@ -846,6 +1050,8 @@ esci2_img(struct epsonds_scanner *s, SANE_Int *length) unsigned int more; ssize_t read; + DBG(15, "esci2_img start\n"); + *length = 0; if (s->canceling) @@ -856,6 +1062,7 @@ esci2_img(struct epsonds_scanner *s, SANE_Int *length) if (status != SANE_STATUS_GOOD) { return status; } + DBG(15, "request img OK\n"); /* receive DataHeaderBlock */ memset(s->buf, 0x00, 64); @@ -863,6 +1070,7 @@ esci2_img(struct epsonds_scanner *s, SANE_Int *length) if (status != SANE_STATUS_GOOD) { return status; } + DBG(15, "receive img OK\n"); /* check if we need to read any image data */ more = 0; @@ -873,6 +1081,17 @@ esci2_img(struct epsonds_scanner *s, SANE_Int *length) /* this handles eof and errors */ parse_status = esci2_parse_block((char *)s->buf + 12, 64 - 12, s, &img_cb); + if (s->backside) + { + s->width_back = s->width_temp; + s->height_back = s->height_temp; + }else{ + s->width_front = s->width_temp; + s->height_front = s->height_temp; + + } + + /* no more data? return using the status of the esci2_parse_block * call, which might hold other error conditions. */ @@ -884,7 +1103,6 @@ esci2_img(struct epsonds_scanner *s, SANE_Int *length) if (more > s->bsz) { return SANE_STATUS_IO_ERROR; } - /* ALWAYS read image data */ if (s->hw->connection == SANE_EPSONDS_NET) { epsonds_net_request_read(s, more); diff --git a/backend/epsonds-cmd.h b/backend/epsonds-cmd.h index 973609a..2bd19db 100644 --- a/backend/epsonds-cmd.h +++ b/backend/epsonds-cmd.h @@ -20,7 +20,7 @@ SANE_Status esci2_can(epsonds_scanner *s); SANE_Status esci2_capa(epsonds_scanner *s); SANE_Status esci2_resa(epsonds_scanner *s); SANE_Status esci2_stat(epsonds_scanner *s); -SANE_Status esci2_para(epsonds_scanner *s, char *parameters); +SANE_Status esci2_para(epsonds_scanner *s, char *parameters, int len); SANE_Status esci2_mech(epsonds_scanner *s, char *parameters); SANE_Status esci2_trdt(epsonds_scanner *s); SANE_Status esci2_img(struct epsonds_scanner *s, SANE_Int *length) ; diff --git a/backend/epsonds-jpeg.c b/backend/epsonds-jpeg.c index 244f442..99ca53a 100644 --- a/backend/epsonds-jpeg.c +++ b/backend/epsonds-jpeg.c @@ -20,19 +20,39 @@ #include "epsonds.h" #include "epsonds-jpeg.h" #include "epsonds-ops.h" +#include -#define min(A,B) (((A)<(B)) ? (A) : (B)) +struct my_error_mgr { + struct jpeg_error_mgr pub; + jmp_buf setjmp_buffer; +}; + +typedef struct my_error_mgr * my_error_ptr; + + +METHODDEF(void) my_error_exit (j_common_ptr cinfo) +{ + + char buffer[JMSG_LENGTH_MAX]; + (*cinfo->err->format_message) (cinfo, buffer); + + DBG(10,"Jpeg decode error [%s]", buffer); +} + +LOCAL(struct jpeg_error_mgr *) jpeg_custom_error (struct my_error_mgr * err) +{ + + struct jpeg_error_mgr* pRet = jpeg_std_error(&(err->pub)); + err->pub.error_exit = my_error_exit; + + return pRet; +} typedef struct { struct jpeg_source_mgr pub; - - epsonds_scanner *s; JOCTET *buffer; - - SANE_Byte *linebuffer; - SANE_Int linebuffer_size; - SANE_Int linebuffer_index; + int length; } epsonds_src_mgr; @@ -50,22 +70,11 @@ METHODDEF(boolean) jpeg_fill_input_buffer(j_decompress_ptr cinfo) { epsonds_src_mgr *src = (epsonds_src_mgr *)cinfo->src; - int avail, size; - - /* read from the scanner or the ring buffer */ - - avail = eds_ring_avail(src->s->current); - if (avail == 0) { - return FALSE; - } - /* read from scanner if no data? */ - size = min(1024, avail); - - eds_ring_read(src->s->current, src->buffer, size); src->pub.next_input_byte = src->buffer; - src->pub.bytes_in_buffer = size; + src->pub.bytes_in_buffer = src->length; + DBG(18, "reading from ring buffer, %d left\n", src->length); return TRUE; } @@ -87,140 +96,140 @@ jpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes) } } -SANE_Status -eds_jpeg_start(epsonds_scanner *s) -{ - epsonds_src_mgr *src; - - s->jpeg_cinfo.err = jpeg_std_error(&s->jpeg_err); - - jpeg_create_decompress(&s->jpeg_cinfo); - - s->jpeg_cinfo.src = (struct jpeg_source_mgr *)(*s->jpeg_cinfo.mem->alloc_small)((j_common_ptr)&s->jpeg_cinfo, - JPOOL_PERMANENT, sizeof(epsonds_src_mgr)); - - memset(s->jpeg_cinfo.src, 0x00, sizeof(epsonds_src_mgr)); - - src = (epsonds_src_mgr *)s->jpeg_cinfo.src; - src->s = s; - - src->buffer = (JOCTET *)(*s->jpeg_cinfo.mem->alloc_small)((j_common_ptr)&s->jpeg_cinfo, - JPOOL_PERMANENT, - 1024 * sizeof(JOCTET)); - src->pub.init_source = jpeg_init_source; - src->pub.fill_input_buffer = jpeg_fill_input_buffer; - src->pub.skip_input_data = jpeg_skip_input_data; - src->pub.resync_to_restart = jpeg_resync_to_restart; - src->pub.term_source = jpeg_term_source; - src->pub.bytes_in_buffer = 0; - src->pub.next_input_byte = NULL; - - s->jpeg_header_seen = 0; - - return SANE_STATUS_GOOD; -} - -SANE_Status -eds_jpeg_read_header(epsonds_scanner *s) +void eds_decode_jpeg(epsonds_scanner*s, SANE_Byte *data, SANE_Int size, ring_buffer* ringBuffer, SANE_Int isBackSide, SANE_Int needToConvertBW) { - epsonds_src_mgr *src = (epsonds_src_mgr *)s->jpeg_cinfo.src; - - if (jpeg_read_header(&s->jpeg_cinfo, TRUE)) { - - s->jdst = sanei_jpeg_jinit_write_ppm(&s->jpeg_cinfo); - - if (jpeg_start_decompress(&s->jpeg_cinfo)) { - - int size; - - DBG(3, "%s: w: %d, h: %d, components: %d\n", + struct jpeg_decompress_struct jpeg_cinfo; + struct my_error_mgr jpeg_err; + + { + epsonds_src_mgr *src; + + jpeg_cinfo.err = jpeg_custom_error(&jpeg_err); + + jpeg_create_decompress(&jpeg_cinfo); + + jpeg_cinfo.src = (struct jpeg_source_mgr *)(*jpeg_cinfo.mem->alloc_small)((j_common_ptr)&jpeg_cinfo, + JPOOL_PERMANENT, sizeof(epsonds_src_mgr)); + + memset(jpeg_cinfo.src, 0x00, sizeof(epsonds_src_mgr)); +; + src = (epsonds_src_mgr *)jpeg_cinfo.src; + src->pub.init_source = jpeg_init_source; + src->pub.fill_input_buffer = jpeg_fill_input_buffer; + src->pub.skip_input_data = jpeg_skip_input_data; + src->pub.resync_to_restart = jpeg_resync_to_restart; + src->pub.term_source = jpeg_term_source; + src->pub.bytes_in_buffer = 0; + src->pub.next_input_byte = NULL; + src->buffer = (JOCTET*)data; + src->length = size; + } + { + if (jpeg_read_header(&jpeg_cinfo, TRUE)) { + + if (jpeg_start_decompress(&jpeg_cinfo)) { + + DBG(10,"%s: w: %d, h: %d, components: %d\n", __func__, - s->jpeg_cinfo.output_width, s->jpeg_cinfo.output_height, - s->jpeg_cinfo.output_components); - - size = s->jpeg_cinfo.output_width * s->jpeg_cinfo.output_components * 1; - - src->linebuffer = (*s->jpeg_cinfo.mem->alloc_large)((j_common_ptr)&s->jpeg_cinfo, - JPOOL_PERMANENT, size); - - src->linebuffer_size = 0; - src->linebuffer_index = 0; - - s->jpeg_header_seen = 1; - - return SANE_STATUS_GOOD; - - } else { - DBG(0, "%s: decompression failed\n", __func__); - return SANE_STATUS_IO_ERROR; + jpeg_cinfo.output_width, jpeg_cinfo.output_height, + jpeg_cinfo.output_components); + } + } + } + { + int sum = 0; + int bufSize = jpeg_cinfo.output_width * jpeg_cinfo.output_components; + + int monoBufSize = (jpeg_cinfo.output_width + 7)/8; + + JSAMPARRAY scanlines = (jpeg_cinfo.mem->alloc_sarray)((j_common_ptr)&jpeg_cinfo, JPOOL_IMAGE, bufSize, 1); + while (jpeg_cinfo.output_scanline < jpeg_cinfo.output_height) { + int l = jpeg_read_scanlines(&jpeg_cinfo, scanlines, 1); + if (l == 0) { + break; + } + sum += l; + + if (needToConvertBW) + { + SANE_Byte* bytes = scanlines[0]; + + SANE_Int imgPos = 0; + + for (int i = 0; i < monoBufSize; i++) + { + SANE_Byte outByte = 0; + + for(SANE_Int bitIndex = 0; bitIndex < 8 && imgPos < bufSize; bitIndex++) { + //DBG(10,"bytes[imgPos] = %d\n", bytes[imgPos]); + + if(bytes[imgPos] >= 110) { + SANE_Byte bit = 7 - (bitIndex % 8); + outByte |= (1<< bit); + } + imgPos += 1; + } + //DBG(10,"outByte = %d\n", outByte); + eds_ring_write(ringBuffer, &outByte, 1); + } + } + else + { + eds_ring_write(ringBuffer, scanlines[0], bufSize); + } + + // decode until valida data + if (isBackSide) + { + if (sum >= s->height_back) + { + break; + } + }else + { + if (sum >= s->height_front) + { + break; + } + } + } + DBG(10,"decodded lines = %d\n", sum); + + // abandon unncessary data + if ((JDIMENSION)sum < jpeg_cinfo.output_height) + { + // unncessary data + while(1) + { + int l = jpeg_read_scanlines(&jpeg_cinfo, scanlines, 1); + if (l == 0) + { + break; + } + } } - } else { - DBG(0, "%s: cannot read JPEG header\n", __func__); - return SANE_STATUS_IO_ERROR; - } -} - -void -eds_jpeg_finish(epsonds_scanner *s) -{ - jpeg_destroy_decompress(&s->jpeg_cinfo); -} - -void -eds_jpeg_read(SANE_Handle handle, SANE_Byte *data, - SANE_Int max_length, SANE_Int *length) -{ - epsonds_scanner *s = handle; - - struct jpeg_decompress_struct cinfo = s->jpeg_cinfo; - epsonds_src_mgr *src = (epsonds_src_mgr *)s->jpeg_cinfo.src; - - int l; - - *length = 0; - - /* copy from line buffer if available */ - if (src->linebuffer_size && src->linebuffer_index < src->linebuffer_size) { - - *length = src->linebuffer_size - src->linebuffer_index; - - if (*length > max_length) - *length = max_length; - - memcpy(data, src->linebuffer + src->linebuffer_index, *length); - src->linebuffer_index += *length; - - return; - } - - if (cinfo.output_scanline >= cinfo.output_height) { - *length = 0; - return; - } - - /* scanlines of decompressed data will be in s->jdst->buffer - * only one line at time is supported - */ - - l = jpeg_read_scanlines(&cinfo, s->jdst->buffer, 1); - if (l == 0) { - return; - } - - /* from s->jdst->buffer to linebuffer - * linebuffer holds width * bytesperpixel - */ - - (*s->jdst->put_pixel_rows)(&cinfo, s->jdst, 1, (char *)src->linebuffer); - - *length = cinfo.output_width * cinfo.output_components * 1; - src->linebuffer_size = *length; - src->linebuffer_index = 0; - - if (*length > max_length) - *length = max_length; - memcpy(data, src->linebuffer + src->linebuffer_index, *length); - src->linebuffer_index += *length; + // if not auto crop mode padding to lines + if (s->val[OPT_ADF_CRP].w == 0) + { + unsigned char* padding = malloc(s->params.bytes_per_line); + memset(padding, 255, s->params.bytes_per_line); + DBG(10,"padding data lines = %d to %d pa \n", sum, s->params.lines); + + while(sum < s->params.lines) + { + eds_ring_write(ringBuffer, padding, bufSize); + sum++; + } + + free(padding); + padding = NULL; + } + } + { + jpeg_finish_decompress(&jpeg_cinfo); + jpeg_destroy_decompress(&jpeg_cinfo); + } + return; } diff --git a/backend/epsonds-jpeg.h b/backend/epsonds-jpeg.h index a804dec..42f542d 100644 --- a/backend/epsonds-jpeg.h +++ b/backend/epsonds-jpeg.h @@ -10,8 +10,4 @@ * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2. */ - -SANE_Status eds_jpeg_start(epsonds_scanner *s); -void eds_jpeg_finish(epsonds_scanner *s); -SANE_Status eds_jpeg_read_header(epsonds_scanner *s); -void eds_jpeg_read(SANE_Handle handle, SANE_Byte *data, SANE_Int max_length, SANE_Int *length); +void eds_decode_jpeg(epsonds_scanner*s, SANE_Byte *data, SANE_Int size, ring_buffer* ringBuffer, SANE_Int isBackSide, SANE_Int needToConvertBW); diff --git a/backend/epsonds-net.c b/backend/epsonds-net.c index 3c8be29..4f4c1e2 100644 --- a/backend/epsonds-net.c +++ b/backend/epsonds-net.c @@ -32,10 +32,19 @@ #include "sane/sanei_debug.h" + static ssize_t epsonds_net_read_raw(epsonds_scanner *s, unsigned char *buf, ssize_t wanted, SANE_Status *status) { + DBG(15, "%s: wanted: %ld\n", __func__, wanted); + + if (wanted == 0) + { + *status = SANE_STATUS_GOOD; + return 0; + } + int ready; ssize_t read = -1; fd_set readable; @@ -284,3 +293,228 @@ epsonds_net_unlock(struct epsonds_scanner *s) /* epsonds_net_read(s, buf, 1, &status); */ return status; } +#if WITH_AVAHI + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static AvahiSimplePoll *simple_poll = NULL; + +static struct timeval borowseEndTime; + +static int resolvedCount = 0; +static int browsedCount = 0; +static int waitResolver = 0; + +typedef struct { + AvahiClient* client; + Device_Found_CallBack callBack; +}EDSAvahiUserData; + +static int my_avahi_simple_poll_loop(AvahiSimplePoll *s) { + struct timeval currentTime; + + for (;;) + { + int r = avahi_simple_poll_iterate(s, 1); + if (r != 0) + { + if (r >= 0 || errno != EINTR) + { + DBG(10, "my_avahi_simple_poll_loop end\n"); + return r; + } + } + + if (waitResolver) { + gettimeofday(¤tTime, NULL); + + if ((currentTime.tv_sec - borowseEndTime.tv_sec) >= 3) + { + avahi_simple_poll_quit(simple_poll); + DBG(10, "resolve timeout\n"); + return 0; + } + } + } +} + +static void +epsonds_resolve_callback(AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIndex interface, + AVAHI_GCC_UNUSED AvahiProtocol protocol, + AvahiResolverEvent event, const char *name, + const char *type, + const char *domain, + const char *host_name, + const AvahiAddress *address, uint16_t port, AvahiStringList *txt, + AvahiLookupResultFlags flags, + void *userdata) +{ + // unused parameter + (void)r; + (void)type; + (void)domain; + (void)host_name; + (void)port; + (void)flags; + EDSAvahiUserData* data = userdata; + char ipAddr[AVAHI_ADDRESS_STR_MAX]; + + DBG(10, "epsonds_searchDevices resolve_callback\n"); + + + resolvedCount++; + + switch (event) { + case AVAHI_RESOLVER_FAILURE: + break; + case AVAHI_RESOLVER_FOUND: + avahi_address_snprint(ipAddr, sizeof(ipAddr), address); + DBG(10, "epsonds_searchDevices name = %s \n", name); + if (strlen(name) > 7) + { + if (strncmp(name, "EPSON", 5) == 0) + { + while(txt != NULL) + { + char* text = (char*)avahi_string_list_get_text(txt); + DBG(10, "avahi string = %s\n", text); + + if (strlen(text) > 4 && strncmp(text, "mdl=", 4) == 0) + { + if (data->callBack) + { + data->callBack(&text[4], ipAddr); + break; + } + } + txt = avahi_string_list_get_next(txt); + } + + } + } + break; + } +} + +static void +browse_callback(AvahiServiceBrowser *b, AvahiIfIndex interface, + AvahiProtocol protocol, AvahiBrowserEvent event, + const char *name, const char *type, + const char *domain, + AvahiLookupResultFlags flags, + void* userdata) +{ + DBG(10, "browse_callback event = %d\n", event); + + //unused parameter + (void)b; + (void)flags; + + EDSAvahiUserData *data = userdata; + switch (event) { + case AVAHI_BROWSER_FAILURE: + avahi_simple_poll_quit(simple_poll); + return; + case AVAHI_BROWSER_NEW: + DBG(10, "browse_callback name = %s\n", name); + browsedCount++; + if (!(avahi_service_resolver_new(data->client, interface, protocol, name, + type, domain, + AVAHI_PROTO_UNSPEC, 0, + epsonds_resolve_callback, data))) + { + DBG(10, "avahi_service_resolver_new fails\n"); + break; + } + case AVAHI_BROWSER_REMOVE: + break; + case AVAHI_BROWSER_ALL_FOR_NOW: + DBG(10, "AVAHI_BROWSER_ALL_FOR_NOW\n"); + gettimeofday(&borowseEndTime, NULL); + + if (browsedCount > resolvedCount) + { + DBG(10, "WAIT RESOLVER\n"); + waitResolver = 1; + }else{ + DBG(10, "QUIT POLL\n"); + avahi_simple_poll_quit(simple_poll); + } + break; + case AVAHI_BROWSER_CACHE_EXHAUSTED: + DBG(10, "AVAHI_BROWSER_CACHE_EXHAUSTED\n"); + break; + } +} + +static void +client_callback(AvahiClient *c, AvahiClientState state, + AVAHI_GCC_UNUSED void *userdata) +{ + assert(c); + if (state == AVAHI_CLIENT_FAILURE) + avahi_simple_poll_quit(simple_poll); +} + +SANE_Status epsonds_searchDevices(Device_Found_CallBack deviceFoundCallBack) +{ + int result = SANE_STATUS_GOOD; + + AvahiClient *client = NULL; + AvahiServiceBrowser *sb = NULL; + + EDSAvahiUserData data; + + resolvedCount = 0; + browsedCount = 0; + waitResolver = 0; + + + int error = 0; + DBG(10, "epsonds_searchDevices\n"); + + if (!(simple_poll = avahi_simple_poll_new())) { + DBG(10, "avahi_simple_poll_new failed\n"); + result = SANE_STATUS_INVAL; + goto fail; + } + client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, + client_callback, NULL, &error); + if (!client) { + DBG(10, "avahi_client_new failed %s\n", avahi_strerror(error)); + result = SANE_STATUS_INVAL; + goto fail; + } + data.client = client; + data.callBack = deviceFoundCallBack; + + if (!(sb = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, + AVAHI_PROTO_UNSPEC, "_scanner._tcp", + NULL, 0, browse_callback, &data))) { + DBG(10, "avahi_service_browser_new failed: %s\n", + avahi_strerror(avahi_client_errno(client))); + result = SANE_STATUS_INVAL; + goto fail; + } + my_avahi_simple_poll_loop(simple_poll); +fail: + if (sb) + avahi_service_browser_free(sb); + if (client) + avahi_client_free(client); + if (simple_poll) + avahi_simple_poll_free(simple_poll); + + DBG(10, "epsonds_searchDevices fin\n"); + + return result; +} +#endif diff --git a/backend/epsonds-net.h b/backend/epsonds-net.h index 107301b..2431c35 100644 --- a/backend/epsonds-net.h +++ b/backend/epsonds-net.h @@ -4,6 +4,8 @@ #include #include "../include/sane/sane.h" +typedef void (*Device_Found_CallBack) (const char* name, const char* ip); + extern ssize_t epsonds_net_read(struct epsonds_scanner *s, unsigned char *buf, ssize_t buf_size, SANE_Status *status); extern size_t epsonds_net_write(struct epsonds_scanner *s, unsigned int cmd, const unsigned char *buf, @@ -13,4 +15,8 @@ extern SANE_Status epsonds_net_lock(struct epsonds_scanner *s); extern SANE_Status epsonds_net_unlock(struct epsonds_scanner *s); extern SANE_Status epsonds_net_request_read(epsonds_scanner *s, size_t len); +#if WITH_AVAHI +extern SANE_Status epsonds_searchDevices(Device_Found_CallBack deviceFoundCallBack); +#endif + #endif diff --git a/backend/epsonds-ops.c b/backend/epsonds-ops.c index 8b9d115..56194c4 100644 --- a/backend/epsonds-ops.c +++ b/backend/epsonds-ops.c @@ -28,10 +28,9 @@ extern struct mode_param mode_params[]; /* Define the different scan sources */ - -#define FBF_STR SANE_I18N("Flatbed") -#define TPU_STR SANE_I18N("Transparency Unit") -#define ADF_STR SANE_I18N("Automatic Document Feeder") +#define STRING_FLATBED SANE_I18N("Flatbed") +#define STRING_ADFFRONT SANE_I18N("ADF Front") +#define STRING_ADFDUPLEX SANE_I18N("ADF Duplex") extern SANE_String_Const source_list[]; @@ -53,10 +52,13 @@ eds_dev_post_init(struct epsonds_device *dev) DBG(10, "%s\n", __func__); if (dev->has_fb) - *source_list_add++ = FBF_STR; + *source_list_add++ = STRING_FLATBED; if (dev->has_adf) - *source_list_add++ = ADF_STR; + *source_list_add++ = STRING_ADFFRONT; + + if (dev->adf_is_duplex) + *source_list_add++ = STRING_ADFDUPLEX; if (source_list[0] == 0 || (dev->res_list[0] == 0 && dev->dpi_range.min == 0) @@ -209,8 +211,6 @@ eds_init_parameters(epsonds_scanner *s) memset(&s->params, 0, sizeof(SANE_Parameters)); - s->dummy = 0; - /* setup depth according to our mode table */ if (mode_params[s->val[OPT_MODE].w].depth == 1) s->params.depth = 1; @@ -314,6 +314,7 @@ eds_init_parameters(epsonds_scanner *s) return SANE_STATUS_GOOD; } +#define min(A,B) (((A)<(B)) ? (A) : (B)) void eds_copy_image_from_ring(epsonds_scanner *s, SANE_Byte *data, SANE_Int max_length, @@ -322,17 +323,13 @@ eds_copy_image_from_ring(epsonds_scanner *s, SANE_Byte *data, SANE_Int max_lengt int lines, available; int hw_line_size = (s->params.bytes_per_line + s->dummy); - /* trim max_length to a multiple of hw_line_size */ - max_length -= (max_length % hw_line_size); - - /* check available data */ available = eds_ring_avail(s->current); if (max_length > available) max_length = available; - lines = max_length / hw_line_size; + lines = min(max_length / s->params.bytes_per_line, available / hw_line_size); - DBG(18, "copying %d lines (%d, %d)\n", lines, s->params.bytes_per_line, s->dummy); + DBG(18, "copying %d lines (%d, %d, %d)\n", lines, s->params.bytes_per_line, s->dummy, s->params.depth); /* need more data? */ if (lines == 0) { @@ -490,3 +487,12 @@ void eds_ring_flush(ring_buffer *ring) { eds_ring_skip(ring, ring->fill); } + +void eds_ring_destory(ring_buffer *ring) +{ + if (ring->ring) + { + free(ring->ring); + ring->ring = NULL; + } +} diff --git a/backend/epsonds-ops.h b/backend/epsonds-ops.h index fe503d6..108d544 100644 --- a/backend/epsonds-ops.h +++ b/backend/epsonds-ops.h @@ -38,3 +38,4 @@ extern SANE_Int eds_ring_read(ring_buffer *ring, SANE_Byte *buf, SANE_Int size); extern SANE_Int eds_ring_skip(ring_buffer *ring, SANE_Int size); extern SANE_Int eds_ring_avail(ring_buffer *ring); extern void eds_ring_flush(ring_buffer *ring) ; +extern void eds_ring_destory(ring_buffer *ring) ; diff --git a/backend/epsonds-usb.c b/backend/epsonds-usb.c index c7e514c..dacfd5f 100644 --- a/backend/epsonds-usb.c +++ b/backend/epsonds-usb.c @@ -12,22 +12,3 @@ */ #include "epsonds-usb.h" - -SANE_Word epsonds_usb_product_ids[] = { - 0x0145, /* DS-5500, DS-6500, DS-7500 */ - 0x0146, /* DS-50000, DS-60000, DS-70000 */ - 0x014c, /* DS-510 */ - 0x014d, /* DS-560 */ - 0x0150, /* DS-40 */ - 0x0152, /* DS-760, DS-860 */ - 0x0154, /* DS-520 */ - 0x08bc, /* PX-M7050 Series, WF-8510/8590 Series */ - 0x08cc, /* PX-M7050FX Series, WF-R8590 Series */ - 0 /* last entry - this is used for devices that are specified - in the config file as "usb " */ -}; - -int epsonds_get_number_of_ids(void) -{ - return sizeof (epsonds_usb_product_ids) / sizeof (SANE_Word); -} diff --git a/backend/epsonds-usb.h b/backend/epsonds-usb.h index 96c77b5..9baab70 100644 --- a/backend/epsonds-usb.h +++ b/backend/epsonds-usb.h @@ -18,7 +18,4 @@ #define SANE_EPSONDS_VENDOR_ID (0x4b8) -extern SANE_Word epsonds_usb_product_ids[]; -extern int epsonds_get_number_of_ids(void); - #endif diff --git a/backend/epsonds.c b/backend/epsonds.c index 1d557c9..0815535 100644 --- a/backend/epsonds.c +++ b/backend/epsonds.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "sane/saneopts.h" #include "sane/sanei_config.h" @@ -64,7 +65,8 @@ #include "epsonds-jpeg.h" #include "epsonds-net.h" - +static SANE_Status +setvalue(SANE_Handle handle, SANE_Int option, void *value, SANE_Int *info); /* * Definition of the mode_param struct, that is used to * specify the valid parameters for the different scan modes. @@ -72,6 +74,1234 @@ * The depth variable gets updated when the bit depth is modified. */ + +static unsigned char LUT[][256] = +{ + {// 0 + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, + 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, + 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, + 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, + 0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, + 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, + 0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, + 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, + 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, + 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97, + 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, + 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7, + 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, + 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, + 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, + 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, + 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, + 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7, + 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, + 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, + 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF + }, + { // 1 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x06,0x07,0x09,0x0B,0x0D, + 0x10,0x12,0x14,0x17,0x19,0x1B,0x1E,0x20, + 0x22,0x24,0x26,0x28,0x2A,0x2C,0x2E,0x30, + 0x32,0x33,0x35,0x37,0x39,0x3B,0x3C,0x3E, + 0x40,0x41,0x43,0x45,0x46,0x48,0x4A,0x4B, + 0x4D,0x4F,0x50,0x52,0x53,0x55,0x57,0x58, + 0x5A,0x5B,0x5D,0x5E,0x60,0x61,0x63,0x64, + 0x66,0x67,0x69,0x6A,0x6C,0x6D,0x6F,0x70, + 0x71,0x73,0x74,0x76,0x77,0x79,0x7A,0x7B, + 0x7D,0x7E,0x7F,0x81,0x82,0x84,0x85,0x86, + 0x88,0x89,0x8A,0x8C,0x8D,0x8E,0x90,0x91, + 0x92,0x94,0x95,0x96,0x98,0x99,0x9A,0x9C, + 0x9D,0x9E,0xA0,0xA1,0xA2,0xA3,0xA5,0xA6, + 0xA7,0xA8,0xAA,0xAB,0xAC,0xAE,0xAF,0xB0, + 0xB1,0xB3,0xB4,0xB5,0xB6,0xB8,0xB9,0xBA, + 0xBB,0xBC,0xBE,0xBF,0xC0,0xC1,0xC3,0xC4, + 0xC5,0xC6,0xC7,0xC9,0xCA,0xCB,0xCC,0xCD, + 0xCF,0xD0,0xD1,0xD2,0xD3,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDC,0xDD,0xDE,0xDF,0xE0, + 0xE1,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9, + 0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF3, + 0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFB,0xFC, + 0xFD,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF + }, + { // 2 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x05,0x07,0x08,0x0A,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x16,0x19,0x1B, + 0x1D,0x1F,0x21,0x23,0x25,0x27,0x28,0x2A, + 0x2C,0x2E,0x30,0x32,0x33,0x35,0x37,0x39, + 0x3A,0x3C,0x3E,0x40,0x41,0x43,0x45,0x46, + 0x48,0x4A,0x4B,0x4D,0x4F,0x50,0x52,0x53, + 0x55,0x57,0x58,0x5A,0x5B,0x5D,0x5F,0x60, + 0x62,0x63,0x65,0x66,0x68,0x69,0x6B,0x6C, + 0x6E,0x6F,0x71,0x72,0x74,0x75,0x77,0x78, + 0x7A,0x7B,0x7D,0x7E,0x80,0x81,0x83,0x84, + 0x86,0x87,0x88,0x8A,0x8B,0x8D,0x8E,0x90, + 0x91,0x92,0x94,0x95,0x97,0x98,0x99,0x9B, + 0x9C,0x9E,0x9F,0xA0,0xA2,0xA3,0xA5,0xA7, + 0xA9,0xAA,0xAB,0xAD,0xAE,0xB0,0xB1,0xB2, + 0xB4,0xB5,0xB6,0xB8,0xB9,0xBA,0xBC,0xBD, + 0xBE,0xC0,0xC1,0xC2,0xC4,0xC5,0xC6,0xC8, + 0xC9,0xCA,0xCC,0xCD,0xCE,0xD0,0xD1,0xD2, + 0xD4,0xD5,0xD6,0xD7,0xD9,0xDA,0xDB,0xDD, + 0xDE,0xDF,0xE1,0xE2,0xE3,0xE4,0xE6,0xE7, + 0xE8,0xE9,0xEB,0xEC,0xED,0xEF,0xF0,0xF1, + 0xF2,0xF4,0xF5,0xF6,0xF7,0xF9,0xFA,0xFB, + 0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { // 3 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x07, + 0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16, + 0x18,0x1A,0x1C,0x1E,0x20,0x22,0x24,0x26, + 0x28,0x2A,0x2B,0x2D,0x2F,0x31,0x33,0x34, + 0x36,0x38,0x39,0x3B,0x3D,0x3E,0x40,0x42, + 0x43,0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4F, + 0x50,0x52,0x53,0x55,0x56,0x58,0x59,0x5B, + 0x5D,0x5E,0x60,0x61,0x63,0x64,0x66,0x67, + 0x69,0x6A,0x6B,0x6D,0x6E,0x70,0x71,0x73, + 0x74,0x76,0x77,0x79,0x7A,0x7B,0x7D,0x7E, + 0x80,0x81,0x83,0x84,0x85,0x87,0x88,0x8A, + 0x8B,0x8C,0x8E,0x8F,0x90,0x92,0x93,0x95, + 0x96,0x97,0x99,0x9A,0x9B,0x9D,0x9E,0x9F, + 0xA1,0xA2,0xA3,0xA5,0xA6,0xA7,0xA9,0xAA, + 0xAB,0xAD,0xAE,0xAF,0xB1,0xB2,0xB3,0xB5, + 0xB6,0xB7,0xB9,0xBA,0xBB,0xBD,0xBE,0xBF, + 0xC0,0xC2,0xC3,0xC4,0xC6,0xC7,0xC8,0xC9, + 0xCB,0xCC,0xCD,0xCF,0xD0,0xD1,0xD2,0xD4, + 0xD5,0xD6,0xD7,0xD9,0xDA,0xDB,0xDC,0xDF, + 0xE0,0xE1,0xE3,0xE4,0xE5,0xE6,0xE8,0xE9, + 0xEA,0xEB,0xED,0xEE,0xEF,0xF0,0xF2,0xF3, + 0xF4,0xF5,0xF6,0xF8,0xF9,0xFA,0xFB,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { //4 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03, + 0x04,0x05,0x07,0x08,0x0A,0x0C,0x0E,0x10, + 0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E,0x20, + 0x22,0x24,0x26,0x28,0x2A,0x2B,0x2D,0x2F, + 0x31,0x33,0x34,0x36,0x38,0x39,0x3B,0x3D, + 0x3E,0x40,0x42,0x43,0x45,0x47,0x48,0x4A, + 0x4B,0x4D,0x4F,0x50,0x52,0x53,0x55,0x56, + 0x58,0x59,0x5B,0x5D,0x5E,0x60,0x61,0x63, + 0x64,0x66,0x67,0x69,0x6A,0x6B,0x6D,0x6E, + 0x70,0x71,0x73,0x74,0x76,0x77,0x79,0x7A, + 0x7B,0x7D,0x7E,0x80,0x81,0x83,0x84,0x85, + 0x87,0x88,0x8A,0x8B,0x8C,0x8E,0x8F,0x90, + 0x92,0x93,0x95,0x96,0x97,0x99,0x9A,0x9B, + 0x9D,0x9E,0x9F,0xA1,0xA2,0xA3,0xA5,0xA6, + 0xA7,0xA9,0xAA,0xAB,0xAD,0xAE,0xAF,0xB1, + 0xB2,0xB3,0xB5,0xB6,0xB7,0xB9,0xBA,0xBB, + 0xBD,0xBE,0xBF,0xC0,0xC2,0xC3,0xC4,0xC6, + 0xC7,0xC8,0xC9,0xCB,0xCC,0xCD,0xCF,0xD0, + 0xD1,0xD2,0xD4,0xD5,0xD6,0xD7,0xD9,0xDA, + 0xDB,0xDC,0xDE,0xDF,0xE0,0xE1,0xE3,0xE5, + 0xE6,0xE8,0xE9,0xEA,0xEB,0xED,0xEE,0xEF, + 0xF0,0xF2,0xF3,0xF4,0xF5,0xF6,0xF8,0xF9, + 0xFA,0xFB,0xFD,0xFE,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { // 5 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0x05,0x07,0x08,0x0A, + 0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A, + 0x1C,0x1E,0x20,0x22,0x24,0x26,0x28,0x2A, + 0x2B,0x2D,0x2F,0x31,0x33,0x34,0x36,0x38, + 0x39,0x3B,0x3D,0x3E,0x40,0x42,0x43,0x45, + 0x47,0x48,0x4A,0x4B,0x4D,0x4F,0x50,0x52, + 0x53,0x55,0x56,0x58,0x59,0x5B,0x5D,0x5E, + 0x60,0x61,0x63,0x64,0x66,0x67,0x69,0x6A, + 0x6B,0x6D,0x6E,0x70,0x71,0x73,0x74,0x76, + 0x77,0x79,0x7A,0x7B,0x7D,0x7E,0x80,0x81, + 0x83,0x84,0x85,0x87,0x88,0x8A,0x8B,0x8C, + 0x8E,0x8F,0x90,0x92,0x93,0x95,0x96,0x97, + 0x99,0x9A,0x9B,0x9D,0x9E,0x9F,0xA1,0xA2, + 0xA3,0xA5,0xA6,0xA7,0xA9,0xAA,0xAB,0xAD, + 0xAE,0xAF,0xB1,0xB2,0xB3,0xB5,0xB6,0xB7, + 0xB9,0xBA,0xBB,0xBD,0xBE,0xBF,0xC0,0xC2, + 0xC3,0xC4,0xC6,0xC7,0xC8,0xC9,0xCB,0xCC, + 0xCD,0xCF,0xD0,0xD1,0xD2,0xD4,0xD5,0xD6, + 0xD7,0xD9,0xDA,0xDB,0xDC,0xDE,0xDF,0xE0, + 0xE3,0xE4,0xE5,0xE6,0xE8,0xE9,0xEA,0xEB, + 0xED,0xEE,0xEF,0xF0,0xF2,0xF3,0xF4,0xF5, + 0xF6,0xF8,0xF9,0xFA,0xFB,0xFD,0xFE,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { // 6 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x03,0x04,0x05,0x07,0x08,0x0A,0x0C,0x0E, + 0x10,0x12,0x14,0x16,0x18,0x18,0x1A,0x1C, + 0x1E,0x20,0x22,0x24,0x26,0x27,0x29,0x2B, + 0x2C,0x2E,0x30,0x31,0x33,0x35,0x36,0x38, + 0x39,0x3B,0x3C,0x3E,0x40,0x41,0x43,0x44, + 0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4E,0x50, + 0x51,0x52,0x54,0x55,0x56,0x58,0x59,0x5B, + 0x5C,0x5D,0x5F,0x60,0x61,0x63,0x64,0x65, + 0x67,0x68,0x69,0x6A,0x6C,0x6D,0x6E,0x70, + 0x71,0x72,0x73,0x75,0x76,0x77,0x78,0x7A, + 0x7B,0x7C,0x7D,0x7E,0x80,0x81,0x82,0x83, + 0x85,0x86,0x87,0x88,0x89,0x8A,0x8C,0x8D, + 0x8E,0x8F,0x90,0x92,0x93,0x94,0x95,0x96, + 0x97,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, + 0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8, + 0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1, + 0xB2,0xB3,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA, + 0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC2,0xC4, + 0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC, + 0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD4,0xD5, + 0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD, + 0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5, + 0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED, + 0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5, + 0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { // 7 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x03,0x04,0x05,0x06,0x07,0x09,0x0B,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C, + 0x1E,0x20,0x21,0x23,0x25,0x27,0x28,0x2A, + 0x2C,0x2D,0x2F,0x31,0x32,0x34,0x36,0x37, + 0x39,0x3B,0x3C,0x3E,0x3F,0x41,0x42,0x44, + 0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4E,0x50, + 0x51,0x53,0x54,0x56,0x57,0x59,0x5A,0x5C, + 0x5D,0x5F,0x60,0x61,0x63,0x64,0x66,0x67, + 0x68,0x6A,0x6B,0x6D,0x6E,0x6F,0x71,0x72, + 0x73,0x75,0x76,0x78,0x79,0x7A,0x7C,0x7D, + 0x7E,0x80,0x81,0x82,0x84,0x85,0x86,0x88, + 0x89,0x8A,0x8B,0x8D,0x8E,0x8F,0x91,0x92, + 0x93,0x95,0x96,0x97,0x98,0x9A,0x9B,0x9C, + 0x9E,0x9F,0xA0,0xA1,0xA3,0xA4,0xA5,0xA6, + 0xA8,0xA9,0xAA,0xAB,0xAD,0xAE,0xAF,0xB0, + 0xB2,0xB3,0xB4,0xB5,0xB7,0xB8,0xB9,0xBA, + 0xBC,0xBD,0xBE,0xBF,0xC0,0xC2,0xC3,0xC4, + 0xC5,0xC7,0xC8,0xC9,0xCA,0xCB,0xCD,0xCE, + 0xCF,0xD0,0xD1,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xE0,0xE1, + 0xE2,0xE3,0xE4,0xE6,0xE7,0xE8,0xE9,0xEA, + 0xEB,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3, + 0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFC,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + } +}; + +static unsigned char LUT_R[][256] = +{ + { // 0 + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, + 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, + 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, + 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, + 0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, + 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, + 0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, + 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, + 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, + 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97, + 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, + 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7, + 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, + 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, + 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, + 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, + 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, + 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7, + 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, + 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, + 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF + }, + { // 1 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x06,0x07,0x09,0x0B,0x0D, + 0x10,0x12,0x14,0x17,0x19,0x1B,0x1E,0x20, + 0x22,0x24,0x26,0x28,0x2A,0x2C,0x2E,0x30, + 0x32,0x33,0x35,0x37,0x39,0x3B,0x3C,0x3E, + 0x40,0x41,0x43,0x45,0x46,0x48,0x4A,0x4B, + 0x4D,0x4F,0x50,0x52,0x53,0x55,0x57,0x58, + 0x5A,0x5B,0x5D,0x5E,0x60,0x61,0x63,0x64, + 0x66,0x67,0x69,0x6A,0x6C,0x6D,0x6F,0x70, + 0x71,0x73,0x74,0x76,0x77,0x79,0x7A,0x7B, + 0x7D,0x7E,0x7F,0x81,0x82,0x84,0x85,0x86, + 0x88,0x89,0x8A,0x8C,0x8D,0x8E,0x90,0x91, + 0x92,0x94,0x95,0x96,0x98,0x99,0x9A,0x9C, + 0x9D,0x9E,0xA0,0xA1,0xA2,0xA3,0xA5,0xA6, + 0xA7,0xA8,0xAA,0xAB,0xAC,0xAE,0xAF,0xB0, + 0xB1,0xB3,0xB4,0xB5,0xB6,0xB8,0xB9,0xBA, + 0xBB,0xBC,0xBE,0xBF,0xC0,0xC1,0xC3,0xC4, + 0xC5,0xC6,0xC7,0xC9,0xCA,0xCB,0xCC,0xCD, + 0xCF,0xD0,0xD1,0xD2,0xD3,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDC,0xDD,0xDE,0xDF,0xE0, + 0xE1,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9, + 0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF3, + 0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFB,0xFC, + 0xFD,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF + }, + { // 2 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x03,0x04,0x05,0x07,0x08,0x0A,0x0C,0x0E, + 0x10,0x12,0x14,0x16,0x19,0x1B,0x1D,0x1F, + 0x21,0x23,0x25,0x27,0x28,0x2A,0x2C,0x2E, + 0x30,0x32,0x33,0x35,0x37,0x39,0x3A,0x3C, + 0x3E,0x40,0x41,0x43,0x45,0x46,0x48,0x4A, + 0x4B,0x4D,0x4F,0x50,0x52,0x53,0x55,0x57, + 0x58,0x5A,0x5B,0x5D,0x5F,0x60,0x62,0x63, + 0x65,0x66,0x68,0x69,0x6B,0x6C,0x6E,0x6F, + 0x71,0x72,0x74,0x75,0x77,0x78,0x7A,0x7B, + 0x7D,0x7E,0x80,0x81,0x83,0x84,0x86,0x87, + 0x88,0x8A,0x8B,0x8D,0x8E,0x90,0x91,0x92, + 0x94,0x95,0x97,0x98,0x99,0x9B,0x9C,0x9E, + 0x9F,0xA0,0xA2,0xA3,0xA5,0xA6,0xA7,0xA9, + 0xAA,0xAB,0xAD,0xAE,0xB0,0xB1,0xB2,0xB4, + 0xB5,0xB6,0xB8,0xB9,0xBA,0xBC,0xBD,0xBE, + 0xC0,0xC1,0xC2,0xC4,0xC5,0xC6,0xC8,0xC9, + 0xCA,0xCC,0xCD,0xCE,0xD0,0xD1,0xD2,0xD4, + 0xD5,0xD6,0xD7,0xD9,0xDA,0xDB,0xDD,0xDE, + 0xDF,0xE1,0xE2,0xE3,0xE4,0xE6,0xE7,0xE8, + 0xE9,0xEB,0xEC,0xED,0xEF,0xF0,0xF1,0xF2, + 0xF4,0xF5,0xF6,0xF7,0xF9,0xFA,0xFB,0xFC, + 0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0x05,0x07,0x08,0x0A, + 0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A, + 0x1C,0x1E,0x20,0x22,0x24,0x26,0x28,0x2A, + 0x2B,0x2D,0x2F,0x31,0x33,0x34,0x36,0x38, + 0x39,0x3B,0x3D,0x3E,0x40,0x42,0x43,0x45, + 0x47,0x48,0x4A,0x4B,0x4D,0x4F,0x50,0x52, + 0x53,0x55,0x56,0x58,0x59,0x5B,0x5D,0x5E, + 0x60,0x61,0x63,0x64,0x66,0x67,0x69,0x6A, + 0x6B,0x6D,0x6E,0x70,0x71,0x73,0x74,0x76, + 0x77,0x79,0x7A,0x7B,0x7D,0x7E,0x80,0x81, + 0x83,0x84,0x85,0x87,0x88,0x8A,0x8B,0x8C, + 0x8E,0x8F,0x90,0x92,0x93,0x95,0x96,0x97, + 0x99,0x9A,0x9B,0x9D,0x9E,0x9F,0xA1,0xA2, + 0xA3,0xA5,0xA6,0xA7,0xA9,0xAA,0xAB,0xAD, + 0xAE,0xAF,0xB1,0xB2,0xB3,0xB5,0xB6,0xB7, + 0xB9,0xBA,0xBB,0xBD,0xBE,0xBF,0xC0,0xC2, + 0xC3,0xC4,0xC6,0xC7,0xC8,0xC9,0xCB,0xCC, + 0xCD,0xCF,0xD0,0xD1,0xD2,0xD4,0xD5,0xD6, + 0xD7,0xD9,0xDA,0xDB,0xDC,0xDE,0xDF,0xE0, + 0xE1,0xE3,0xE4,0xE5,0xE5,0xE6,0xE8,0xE9, + 0xEA,0xEB,0xED,0xEE,0xEF,0xF0,0xF2,0xF3, + 0xF4,0xF5,0xF6,0xF8,0xF9,0xFA,0xFB,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05, + 0x07,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14, + 0x16,0x18,0x1A,0x1C,0x1E,0x20,0x22,0x24, + 0x26,0x28,0x2A,0x2B,0x2D,0x2F,0x31,0x33, + 0x34,0x36,0x38,0x39,0x3B,0x3D,0x3E,0x40, + 0x42,0x43,0x45,0x47,0x48,0x4A,0x4B,0x4D, + 0x4F,0x50,0x52,0x53,0x55,0x56,0x58,0x59, + 0x5B,0x5D,0x5E,0x60,0x61,0x63,0x64,0x66, + 0x67,0x69,0x6A,0x6B,0x6D,0x6E,0x70,0x71, + 0x73,0x74,0x76,0x77,0x79,0x7A,0x7B,0x7D, + 0x7E,0x80,0x81,0x83,0x84,0x85,0x87,0x88, + 0x8A,0x8B,0x8C,0x8E,0x8F,0x90,0x92,0x93, + 0x95,0x96,0x97,0x99,0x9A,0x9B,0x9D,0x9E, + 0x9F,0xA1,0xA2,0xA3,0xA5,0xA6,0xA7,0xA9, + 0xAA,0xAB,0xAD,0xAE,0xAF,0xB1,0xB2,0xB3, + 0xB5,0xB6,0xB7,0xB9,0xBA,0xBB,0xBD,0xBE, + 0xBF,0xC0,0xC2,0xC3,0xC4,0xC6,0xC7,0xC8, + 0xC9,0xCB,0xCC,0xCD,0xCF,0xD0,0xD1,0xD2, + 0xD4,0xD5,0xD6,0xD7,0xD9,0xDA,0xDB,0xDC, + 0xDE,0xDF,0xE0,0xE1,0xE3,0xE4,0xE5,0xE6, + 0xE8,0xE9,0xEA,0xEB,0xEB,0xED,0xEE,0xEF, + 0xF0,0xF2,0xF3,0xF4,0xF5,0xF6,0xF8,0xF9, + 0xFA,0xFB,0xFD,0xFE,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x03,0x04,0x05,0x07,0x08,0x0A,0x0C,0x0E, + 0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E, + 0x20,0x22,0x24,0x26,0x28,0x2A,0x2B,0x2D, + 0x2F,0x31,0x33,0x34,0x36,0x38,0x39,0x3B, + 0x3D,0x3E,0x40,0x42,0x43,0x45,0x47,0x48, + 0x4A,0x4B,0x4D,0x4F,0x50,0x52,0x53,0x55, + 0x56,0x58,0x59,0x5B,0x5D,0x5E,0x60,0x61, + 0x63,0x64,0x66,0x67,0x69,0x6A,0x6B,0x6D, + 0x6E,0x70,0x71,0x73,0x74,0x76,0x77,0x79, + 0x7A,0x7B,0x7D,0x7E,0x80,0x81,0x83,0x84, + 0x85,0x87,0x88,0x8A,0x8B,0x8C,0x8E,0x8F, + 0x90,0x92,0x93,0x95,0x96,0x97,0x99,0x9A, + 0x9B,0x9D,0x9E,0x9F,0xA1,0xA2,0xA3,0xA5, + 0xA6,0xA7,0xA9,0xAA,0xAB,0xAD,0xAE,0xAF, + 0xB1,0xB2,0xB3,0xB5,0xB6,0xB7,0xB9,0xBA, + 0xBB,0xBD,0xBE,0xBF,0xC0,0xC2,0xC3,0xC4, + 0xC6,0xC7,0xC8,0xC9,0xCB,0xCC,0xCD,0xCF, + 0xD0,0xD1,0xD2,0xD4,0xD5,0xD6,0xD7,0xD9, + 0xDA,0xDB,0xDC,0xDE,0xDF,0xE0,0xE1,0xE3, + 0xE4,0xE5,0xE6,0xE8,0xE9,0xEA,0xEB,0xED, + 0xEE,0xEF,0xF0,0xF2,0xF3,0xF4,0xF5,0xF6, + 0xF8,0xF9,0xFA,0xFB,0xFD,0xFE,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x05,0x06,0x08,0x0A,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x19,0x1B,0x1D, + 0x1F,0x20,0x22,0x24,0x26,0x28,0x2A,0x2B, + 0x2D,0x2F,0x31,0x32,0x34,0x35,0x37,0x39, + 0x3A,0x3C,0x3D,0x3F,0x41,0x42,0x44,0x45, + 0x47,0x48,0x4A,0x4B,0x4D,0x4E,0x4F,0x51, + 0x52,0x54,0x55,0x57,0x58,0x59,0x5B,0x5C, + 0x5E,0x5F,0x60,0x62,0x63,0x64,0x66,0x67, + 0x68,0x6A,0x6B,0x6C,0x6E,0x6F,0x70,0x72, + 0x73,0x74,0x75,0x77,0x78,0x79,0x7B,0x7C, + 0x7D,0x7E,0x80,0x81,0x82,0x83,0x85,0x86, + 0x87,0x88,0x89,0x8B,0x8C,0x8D,0x8E,0x90, + 0x91,0x92,0x93,0x94,0x96,0x97,0x98,0x99, + 0x9A,0x9B,0x9D,0x9E,0x9F,0xA0,0xA1,0xA2, + 0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAB,0xAC, + 0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB4,0xB5, + 0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBD,0xBE, + 0xBF,0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6, + 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, + 0xD0,0xD1,0xD2,0xD3,0xD4,0xD6,0xD7,0xD8, + 0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0, + 0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xEA, + 0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2, + 0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA, + 0xFB,0xFC,0xFD,0xFE,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x03,0x04,0x05,0x06,0x07,0x09,0x0B,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C, + 0x1E,0x20,0x21,0x23,0x25,0x27,0x28,0x2A, + 0x2C,0x2D,0x2F,0x31,0x32,0x34,0x36,0x37, + 0x39,0x3B,0x3C,0x3E,0x3F,0x41,0x42,0x44, + 0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4E,0x50, + 0x51,0x53,0x54,0x56,0x57,0x59,0x5A,0x5C, + 0x5D,0x5F,0x60,0x61,0x63,0x64,0x66,0x67, + 0x68,0x6A,0x6B,0x6D,0x6E,0x6F,0x71,0x72, + 0x73,0x75,0x76,0x78,0x79,0x7A,0x7C,0x7D, + 0x7E,0x80,0x81,0x82,0x84,0x85,0x86,0x88, + 0x89,0x8A,0x8B,0x8D,0x8E,0x8F,0x91,0x92, + 0x93,0x95,0x96,0x97,0x98,0x9A,0x9B,0x9C, + 0x9E,0x9F,0xA0,0xA1,0xA3,0xA4,0xA5,0xA6, + 0xA8,0xA9,0xAA,0xAB,0xAD,0xAE,0xAF,0xB0, + 0xB2,0xB3,0xB4,0xB5,0xB7,0xB8,0xB9,0xBA, + 0xBC,0xBD,0xBE,0xBF,0xC0,0xC2,0xC3,0xC4, + 0xC5,0xC7,0xC8,0xC9,0xCA,0xCB,0xCD,0xCE, + 0xCF,0xD0,0xD1,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xE0,0xE1, + 0xE2,0xE3,0xE4,0xE6,0xE7,0xE8,0xE9,0xEA, + 0xEB,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3, + 0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFC,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF + } +}; + +static unsigned char LUT_G[][256] = +{ + { + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, + 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, + 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, + 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, + 0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, + 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, + 0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, + 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, + 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, + 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97, + 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, + 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7, + 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, + 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, + 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, + 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, + 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, + 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7, + 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, + 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, + 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x06,0x07,0x09,0x0B,0x0D, + 0x10,0x12,0x14,0x17,0x19,0x1B,0x1E,0x20, + 0x22,0x24,0x26,0x28,0x2A,0x2C,0x2E,0x30, + 0x32,0x33,0x35,0x37,0x39,0x3B,0x3C,0x3E, + 0x40,0x41,0x43,0x45,0x46,0x48,0x4A,0x4B, + 0x4D,0x4F,0x50,0x52,0x53,0x55,0x57,0x58, + 0x5A,0x5B,0x5D,0x5E,0x60,0x61,0x63,0x64, + 0x66,0x67,0x69,0x6A,0x6C,0x6D,0x6F,0x70, + 0x71,0x73,0x74,0x76,0x77,0x79,0x7A,0x7B, + 0x7D,0x7E,0x7F,0x81,0x82,0x84,0x85,0x86, + 0x88,0x89,0x8A,0x8C,0x8D,0x8E,0x90,0x91, + 0x92,0x94,0x95,0x96,0x98,0x99,0x9A,0x9C, + 0x9D,0x9E,0xA0,0xA1,0xA2,0xA3,0xA5,0xA6, + 0xA7,0xA8,0xAA,0xAB,0xAC,0xAE,0xAF,0xB0, + 0xB1,0xB3,0xB4,0xB5,0xB6,0xB8,0xB9,0xBA, + 0xBB,0xBC,0xBE,0xBF,0xC0,0xC1,0xC3,0xC4, + 0xC5,0xC6,0xC7,0xC9,0xCA,0xCB,0xCC,0xCD, + 0xCF,0xD0,0xD1,0xD2,0xD3,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDC,0xDD,0xDE,0xDF,0xE0, + 0xE1,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9, + 0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF3, + 0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFB,0xFC, + 0xFD,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x05,0x07,0x08,0x0A,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x16,0x19,0x1B, + 0x1D,0x1F,0x21,0x23,0x25,0x27,0x28,0x2A, + 0x2C,0x2E,0x30,0x32,0x33,0x35,0x37,0x39, + 0x3A,0x3C,0x3E,0x40,0x41,0x43,0x45,0x46, + 0x48,0x4A,0x4B,0x4D,0x4F,0x50,0x52,0x53, + 0x55,0x57,0x58,0x5A,0x5B,0x5D,0x5F,0x60, + 0x62,0x63,0x65,0x66,0x68,0x69,0x6B,0x6C, + 0x6E,0x6F,0x71,0x72,0x74,0x75,0x77,0x78, + 0x7A,0x7B,0x7D,0x7E,0x80,0x81,0x83,0x84, + 0x86,0x87,0x88,0x8A,0x8B,0x8D,0x8E,0x90, + 0x91,0x92,0x94,0x95,0x97,0x98,0x99,0x9B, + 0x9C,0x9E,0x9F,0xA0,0xA2,0xA3,0xA5,0xA7, + 0xA9,0xAA,0xAB,0xAD,0xAE,0xB0,0xB1,0xB2, + 0xB4,0xB5,0xB6,0xB8,0xB9,0xBA,0xBC,0xBD, + 0xBE,0xC0,0xC1,0xC2,0xC4,0xC5,0xC6,0xC8, + 0xC9,0xCA,0xCC,0xCD,0xCE,0xD0,0xD1,0xD2, + 0xD4,0xD5,0xD6,0xD7,0xD9,0xDA,0xDB,0xDD, + 0xDE,0xDF,0xE1,0xE2,0xE3,0xE4,0xE6,0xE7, + 0xE8,0xE9,0xEB,0xEC,0xED,0xEF,0xF0,0xF1, + 0xF2,0xF4,0xF5,0xF6,0xF7,0xF9,0xFA,0xFB, + 0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x07, + 0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16, + 0x18,0x1A,0x1C,0x1E,0x20,0x22,0x24,0x26, + 0x28,0x2A,0x2B,0x2D,0x2F,0x31,0x33,0x34, + 0x36,0x38,0x39,0x3B,0x3D,0x3E,0x40,0x42, + 0x43,0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4F, + 0x50,0x52,0x53,0x55,0x56,0x58,0x59,0x5B, + 0x5D,0x5E,0x60,0x61,0x63,0x64,0x66,0x67, + 0x69,0x6A,0x6B,0x6D,0x6E,0x70,0x71,0x73, + 0x74,0x76,0x77,0x79,0x7A,0x7B,0x7D,0x7E, + 0x80,0x81,0x83,0x84,0x85,0x87,0x88,0x8A, + 0x8B,0x8C,0x8E,0x8F,0x90,0x92,0x93,0x95, + 0x96,0x97,0x99,0x9A,0x9B,0x9D,0x9E,0x9F, + 0xA1,0xA2,0xA3,0xA5,0xA6,0xA7,0xA9,0xAA, + 0xAB,0xAD,0xAE,0xAF,0xB1,0xB2,0xB3,0xB5, + 0xB6,0xB7,0xB9,0xBA,0xBB,0xBD,0xBE,0xBF, + 0xC0,0xC2,0xC3,0xC4,0xC6,0xC7,0xC8,0xC9, + 0xCB,0xCC,0xCD,0xCF,0xD0,0xD1,0xD2,0xD4, + 0xD5,0xD6,0xD7,0xD9,0xDA,0xDB,0xDC,0xDF, + 0xE0,0xE1,0xE3,0xE4,0xE5,0xE6,0xE8,0xE9, + 0xEA,0xEB,0xED,0xEE,0xEF,0xF0,0xF2,0xF3, + 0xF4,0xF5,0xF6,0xF8,0xF9,0xFA,0xFB,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03, + 0x04,0x05,0x07,0x08,0x0A,0x0C,0x0E,0x10, + 0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E,0x20, + 0x22,0x24,0x26,0x28,0x2A,0x2B,0x2D,0x2F, + 0x31,0x33,0x34,0x36,0x38,0x39,0x3B,0x3D, + 0x3E,0x40,0x42,0x43,0x45,0x47,0x48,0x4A, + 0x4B,0x4D,0x4F,0x50,0x52,0x53,0x55,0x56, + 0x58,0x59,0x5B,0x5D,0x5E,0x60,0x61,0x63, + 0x64,0x66,0x67,0x69,0x6A,0x6B,0x6D,0x6E, + 0x70,0x71,0x73,0x74,0x76,0x77,0x79,0x7A, + 0x7B,0x7D,0x7E,0x80,0x81,0x83,0x84,0x85, + 0x87,0x88,0x8A,0x8B,0x8C,0x8E,0x8F,0x90, + 0x92,0x93,0x95,0x96,0x97,0x99,0x9A,0x9B, + 0x9D,0x9E,0x9F,0xA1,0xA2,0xA3,0xA5,0xA6, + 0xA7,0xA9,0xAA,0xAB,0xAD,0xAE,0xAF,0xB1, + 0xB2,0xB3,0xB5,0xB6,0xB7,0xB9,0xBA,0xBB, + 0xBD,0xBE,0xBF,0xC0,0xC2,0xC3,0xC4,0xC6, + 0xC7,0xC8,0xC9,0xCB,0xCC,0xCD,0xCF,0xD0, + 0xD1,0xD2,0xD4,0xD5,0xD6,0xD7,0xD9,0xDA, + 0xDB,0xDC,0xDE,0xDF,0xE0,0xE1,0xE3,0xE5, + 0xE6,0xE8,0xE9,0xEA,0xEB,0xED,0xEE,0xEF, + 0xF0,0xF2,0xF3,0xF4,0xF5,0xF6,0xF8,0xF9, + 0xFA,0xFB,0xFD,0xFE,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0x05,0x07,0x08,0x0A, + 0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A, + 0x1C,0x1E,0x20,0x22,0x24,0x26,0x28,0x2A, + 0x2B,0x2D,0x2F,0x31,0x33,0x34,0x36,0x38, + 0x39,0x3B,0x3D,0x3E,0x40,0x42,0x43,0x45, + 0x47,0x48,0x4A,0x4B,0x4D,0x4F,0x50,0x52, + 0x53,0x55,0x56,0x58,0x59,0x5B,0x5D,0x5E, + 0x60,0x61,0x63,0x64,0x66,0x67,0x69,0x6A, + 0x6B,0x6D,0x6E,0x70,0x71,0x73,0x74,0x76, + 0x77,0x79,0x7A,0x7B,0x7D,0x7E,0x80,0x81, + 0x83,0x84,0x85,0x87,0x88,0x8A,0x8B,0x8C, + 0x8E,0x8F,0x90,0x92,0x93,0x95,0x96,0x97, + 0x99,0x9A,0x9B,0x9D,0x9E,0x9F,0xA1,0xA2, + 0xA3,0xA5,0xA6,0xA7,0xA9,0xAA,0xAB,0xAD, + 0xAE,0xAF,0xB1,0xB2,0xB3,0xB5,0xB6,0xB7, + 0xB9,0xBA,0xBB,0xBD,0xBE,0xBF,0xC0,0xC2, + 0xC3,0xC4,0xC6,0xC7,0xC8,0xC9,0xCB,0xCC, + 0xCD,0xCF,0xD0,0xD1,0xD2,0xD4,0xD5,0xD6, + 0xD7,0xD9,0xDA,0xDB,0xDC,0xDE,0xDF,0xE0, + 0xE3,0xE4,0xE5,0xE6,0xE8,0xE9,0xEA,0xEB, + 0xED,0xEE,0xEF,0xF0,0xF2,0xF3,0xF4,0xF5, + 0xF6,0xF8,0xF9,0xFA,0xFB,0xFD,0xFE,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x03,0x04,0x05,0x07,0x08,0x0A,0x0C,0x0E, + 0x10,0x12,0x14,0x16,0x18,0x18,0x1A,0x1C, + 0x1E,0x20,0x22,0x24,0x26,0x27,0x29,0x2B, + 0x2C,0x2E,0x30,0x31,0x33,0x35,0x36,0x38, + 0x39,0x3B,0x3C,0x3E,0x40,0x41,0x43,0x44, + 0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4E,0x50, + 0x51,0x52,0x54,0x55,0x56,0x58,0x59,0x5B, + 0x5C,0x5D,0x5F,0x60,0x61,0x63,0x64,0x65, + 0x67,0x68,0x69,0x6A,0x6C,0x6D,0x6E,0x70, + 0x71,0x72,0x73,0x75,0x76,0x77,0x78,0x7A, + 0x7B,0x7C,0x7D,0x7E,0x80,0x81,0x82,0x83, + 0x85,0x86,0x87,0x88,0x89,0x8A,0x8C,0x8D, + 0x8E,0x8F,0x90,0x92,0x93,0x94,0x95,0x96, + 0x97,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, + 0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8, + 0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1, + 0xB2,0xB3,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA, + 0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC2,0xC4, + 0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC, + 0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD4,0xD5, + 0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD, + 0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5, + 0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED, + 0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5, + 0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { // 7 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x03,0x04,0x05,0x06,0x07,0x09,0x0B,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C, + 0x1E,0x20,0x21,0x23,0x25,0x27,0x28,0x2A, + 0x2C,0x2D,0x2F,0x31,0x32,0x34,0x36,0x37, + 0x39,0x3B,0x3C,0x3E,0x3F,0x41,0x42,0x44, + 0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4E,0x50, + 0x51,0x53,0x54,0x56,0x57,0x59,0x5A,0x5C, + 0x5D,0x5F,0x60,0x61,0x63,0x64,0x66,0x67, + 0x68,0x6A,0x6B,0x6D,0x6E,0x6F,0x71,0x72, + 0x73,0x75,0x76,0x78,0x79,0x7A,0x7C,0x7D, + 0x7E,0x80,0x81,0x82,0x84,0x85,0x86,0x88, + 0x89,0x8A,0x8B,0x8D,0x8E,0x8F,0x91,0x92, + 0x93,0x95,0x96,0x97,0x98,0x9A,0x9B,0x9C, + 0x9E,0x9F,0xA0,0xA1,0xA3,0xA4,0xA5,0xA6, + 0xA8,0xA9,0xAA,0xAB,0xAD,0xAE,0xAF,0xB0, + 0xB2,0xB3,0xB4,0xB5,0xB7,0xB8,0xB9,0xBA, + 0xBC,0xBD,0xBE,0xBF,0xC0,0xC2,0xC3,0xC4, + 0xC5,0xC7,0xC8,0xC9,0xCA,0xCB,0xCD,0xCE, + 0xCF,0xD0,0xD1,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xE0,0xE1, + 0xE2,0xE3,0xE4,0xE6,0xE7,0xE8,0xE9,0xEA, + 0xEB,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3, + 0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFC,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + } +}; + +static unsigned char LUT_B[][256] = +{ + { + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, + 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, + 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, + 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, + 0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, + 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, + 0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, + 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, + 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, + 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97, + 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, + 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7, + 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, + 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, + 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, + 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, + 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, + 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7, + 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, + 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, + 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x06,0x07,0x09,0x0B,0x0D, + 0x10,0x12,0x14,0x17,0x19,0x1B,0x1E,0x20, + 0x22,0x24,0x26,0x28,0x2A,0x2C,0x2E,0x30, + 0x32,0x33,0x35,0x37,0x39,0x3B,0x3C,0x3E, + 0x40,0x41,0x43,0x45,0x46,0x48,0x4A,0x4B, + 0x4D,0x4F,0x50,0x52,0x53,0x55,0x57,0x58, + 0x5A,0x5B,0x5D,0x5E,0x60,0x61,0x63,0x64, + 0x66,0x67,0x69,0x6A,0x6C,0x6D,0x6F,0x70, + 0x71,0x73,0x74,0x76,0x77,0x79,0x7A,0x7B, + 0x7D,0x7E,0x7F,0x81,0x82,0x84,0x85,0x86, + 0x88,0x89,0x8A,0x8C,0x8D,0x8E,0x90,0x91, + 0x92,0x94,0x95,0x96,0x98,0x99,0x9A,0x9C, + 0x9D,0x9E,0xA0,0xA1,0xA2,0xA3,0xA5,0xA6, + 0xA7,0xA8,0xAA,0xAB,0xAC,0xAE,0xAF,0xB0, + 0xB1,0xB3,0xB4,0xB5,0xB6,0xB8,0xB9,0xBA, + 0xBB,0xBC,0xBE,0xBF,0xC0,0xC1,0xC3,0xC4, + 0xC5,0xC6,0xC7,0xC9,0xCA,0xCB,0xCC,0xCD, + 0xCF,0xD0,0xD1,0xD2,0xD3,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDC,0xDD,0xDE,0xDF,0xE0, + 0xE1,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9, + 0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF3, + 0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFB,0xFC, + 0xFD,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x05,0x07,0x08,0x0A,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x16,0x19,0x1B, + 0x1D,0x1F,0x21,0x23,0x25,0x27,0x28,0x2A, + 0x2C,0x2E,0x30,0x32,0x33,0x35,0x37,0x39, + 0x3A,0x3C,0x3E,0x40,0x41,0x43,0x45,0x46, + 0x48,0x4A,0x4B,0x4D,0x4F,0x50,0x52,0x53, + 0x55,0x57,0x58,0x5A,0x5B,0x5D,0x5F,0x60, + 0x62,0x63,0x65,0x66,0x68,0x69,0x6B,0x6C, + 0x6E,0x6F,0x71,0x72,0x74,0x75,0x77,0x78, + 0x7A,0x7B,0x7D,0x7E,0x80,0x81,0x83,0x84, + 0x86,0x87,0x88,0x8A,0x8B,0x8D,0x8E,0x90, + 0x91,0x92,0x94,0x95,0x97,0x98,0x99,0x9B, + 0x9C,0x9E,0x9F,0xA0,0xA2,0xA3,0xA5,0xA7, + 0xA9,0xAA,0xAB,0xAD,0xAE,0xB0,0xB1,0xB2, + 0xB4,0xB5,0xB6,0xB8,0xB9,0xBA,0xBC,0xBD, + 0xBE,0xC0,0xC1,0xC2,0xC4,0xC5,0xC6,0xC8, + 0xC9,0xCA,0xCC,0xCD,0xCE,0xD0,0xD1,0xD2, + 0xD4,0xD5,0xD6,0xD7,0xD9,0xDA,0xDB,0xDD, + 0xDE,0xDF,0xE1,0xE2,0xE3,0xE4,0xE6,0xE7, + 0xE8,0xE9,0xEB,0xEC,0xED,0xEF,0xF0,0xF1, + 0xF2,0xF4,0xF5,0xF6,0xF7,0xF9,0xFA,0xFB, + 0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x02,0x03,0x04,0x05,0x07,0x08, + 0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18, + 0x1A,0x1C,0x1E,0x20,0x22,0x24,0x26,0x28, + 0x2A,0x2B,0x2D,0x2F,0x31,0x33,0x34,0x36, + 0x38,0x39,0x3B,0x3D,0x3E,0x40,0x42,0x43, + 0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4F,0x50, + 0x52,0x53,0x55,0x56,0x58,0x59,0x5B,0x5D, + 0x5E,0x60,0x61,0x63,0x64,0x66,0x67,0x69, + 0x6A,0x6B,0x6D,0x6E,0x70,0x71,0x73,0x74, + 0x76,0x77,0x79,0x7A,0x7B,0x7D,0x7E,0x80, + 0x81,0x83,0x84,0x85,0x87,0x88,0x8A,0x8B, + 0x8C,0x8E,0x8F,0x90,0x92,0x93,0x95,0x96, + 0x97,0x99,0x9A,0x9B,0x9D,0x9E,0x9F,0xA1, + 0xA2,0xA3,0xA5,0xA6,0xA7,0xA9,0xAA,0xAB, + 0xAD,0xAE,0xAF,0xB1,0xB2,0xB3,0xB5,0xB6, + 0xB7,0xB9,0xBA,0xBB,0xBD,0xBE,0xBF,0xC0, + 0xC2,0xC3,0xC4,0xC6,0xC7,0xC8,0xC9,0xCB, + 0xCC,0xCD,0xCF,0xD0,0xD1,0xD2,0xD4,0xD5, + 0xD6,0xD7,0xD9,0xDA,0xDB,0xDC,0xDE,0xDF, + 0xE0,0xE1,0xE3,0xE4,0xE5,0xE6,0xE8,0xE9, + 0xEA,0xEB,0xED,0xEE,0xEF,0xF0,0xF2,0xF3, + 0xF4,0xF5,0xF6,0xF8,0xF9,0xFA,0xFB,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04, + 0x05,0x07,0x08,0x0A,0x0C,0x0E,0x10,0x12, + 0x14,0x16,0x18,0x1A,0x1C,0x1E,0x20,0x22, + 0x24,0x26,0x28,0x2A,0x2B,0x2D,0x2F,0x31, + 0x33,0x34,0x36,0x38,0x39,0x3B,0x3D,0x3E, + 0x40,0x42,0x43,0x45,0x47,0x48,0x4A,0x4B, + 0x4D,0x4F,0x50,0x52,0x53,0x55,0x56,0x58, + 0x59,0x5B,0x5D,0x5E,0x60,0x61,0x63,0x64, + 0x66,0x67,0x69,0x6A,0x6B,0x6D,0x6E,0x70, + 0x71,0x73,0x74,0x76,0x77,0x79,0x7A,0x7B, + 0x7D,0x7E,0x80,0x81,0x83,0x84,0x85,0x87, + 0x88,0x8A,0x8B,0x8C,0x8E,0x8F,0x90,0x92, + 0x93,0x95,0x96,0x97,0x99,0x9A,0x9B,0x9D, + 0x9E,0x9F,0xA1,0xA2,0xA3,0xA5,0xA6,0xA7, + 0xA9,0xAA,0xAB,0xAD,0xAE,0xAF,0xB1,0xB2, + 0xB3,0xB5,0xB6,0xB7,0xB9,0xBA,0xBB,0xBD, + 0xBE,0xBF,0xC0,0xC2,0xC3,0xC4,0xC6,0xC7, + 0xC8,0xC9,0xCB,0xCC,0xCD,0xCF,0xD0,0xD1, + 0xD2,0xD4,0xD5,0xD6,0xD7,0xD9,0xDA,0xDB, + 0xDC,0xDE,0xDF,0xE0,0xE1,0xE3,0xE4,0xE5, + 0xE6,0xE8,0xE9,0xEA,0xEB,0xED,0xEE,0xEF, + 0xF0,0xF2,0xF3,0xF4,0xF5,0xF6,0xF8,0xF9, + 0xFA,0xFB,0xFD,0xFE,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x05,0x07,0x08,0x0A,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x16,0x18,0x1A, + 0x1C,0x1E,0x20,0x22,0x24,0x26,0x28,0x2A, + 0x2B,0x2D,0x2F,0x31,0x33,0x34,0x36,0x38, + 0x39,0x3B,0x3D,0x3E,0x40,0x42,0x43,0x45, + 0x47,0x48,0x4A,0x4B,0x4D,0x4F,0x50,0x52, + 0x53,0x55,0x56,0x58,0x59,0x5B,0x5D,0x5E, + 0x60,0x61,0x63,0x64,0x66,0x67,0x69,0x6A, + 0x6B,0x6D,0x6E,0x70,0x71,0x73,0x74,0x76, + 0x77,0x79,0x7A,0x7B,0x7D,0x7E,0x80,0x81, + 0x83,0x84,0x85,0x87,0x88,0x8A,0x8B,0x8C, + 0x8E,0x8F,0x90,0x92,0x93,0x95,0x96,0x97, + 0x99,0x9A,0x9B,0x9D,0x9E,0x9F,0xA1,0xA3, + 0xA5,0xA6,0xA7,0xA9,0xAA,0xAB,0xAD,0xAE, + 0xAF,0xB1,0xB2,0xB3,0xB5,0xB6,0xB7,0xB9, + 0xBA,0xBB,0xBD,0xBE,0xBF,0xC0,0xC2,0xC3, + 0xC4,0xC6,0xC7,0xC8,0xC9,0xCB,0xCC,0xCD, + 0xCF,0xD0,0xD1,0xD2,0xD4,0xD5,0xD6,0xD7, + 0xD9,0xDA,0xDB,0xDC,0xDE,0xDF,0xE0,0xE1, + 0xE3,0xE4,0xE5,0xE6,0xE8,0xE9,0xEA,0xEB, + 0xED,0xEE,0xEF,0xF0,0xF2,0xF3,0xF4,0xF5, + 0xF6,0xF8,0xF9,0xFA,0xFB,0xFD,0xFE,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03, + 0x04,0x05,0x07,0x08,0x0A,0x0C,0x0E,0x10, + 0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E,0x20, + 0x22,0x24,0x26,0x27,0x29,0x2B,0x2C,0x2E, + 0x30,0x31,0x33,0x35,0x36,0x38,0x39,0x3B, + 0x3C,0x3E,0x40,0x41,0x43,0x44,0x45,0x47, + 0x48,0x4B,0x4D,0x4E,0x50,0x51,0x52,0x54, + 0x55,0x56,0x58,0x59,0x5B,0x5C,0x5D,0x5F, + 0x60,0x61,0x63,0x64,0x65,0x67,0x68,0x69, + 0x6A,0x6C,0x6D,0x6E,0x70,0x71,0x72,0x73, + 0x75,0x76,0x77,0x78,0x7A,0x7B,0x7C,0x7D, + 0x7E,0x80,0x81,0x82,0x83,0x85,0x86,0x87, + 0x88,0x89,0x8A,0x8C,0x8D,0x8E,0x8F,0x90, + 0x92,0x93,0x94,0x95,0x96,0x96,0x97,0x99, + 0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xA1,0xA2, + 0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xAA,0xAB, + 0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3, + 0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC, + 0xBD,0xBE,0xBF,0xC0,0xC2,0xC3,0xC4,0xC5, + 0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD, + 0xCE,0xCF,0xD0,0xD1,0xD2,0xD4,0xD5,0xD6, + 0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE, + 0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6, + 0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE, + 0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6, + 0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + }, + { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x03,0x04,0x05,0x06,0x07,0x09,0x0B,0x0C, + 0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C, + 0x1E,0x20,0x21,0x23,0x25,0x27,0x28,0x2A, + 0x2C,0x2D,0x2F,0x31,0x32,0x34,0x36,0x37, + 0x39,0x3B,0x3C,0x3E,0x3F,0x41,0x42,0x44, + 0x45,0x47,0x48,0x4A,0x4B,0x4D,0x4E,0x50, + 0x51,0x53,0x54,0x56,0x57,0x59,0x5A,0x5C, + 0x5D,0x5F,0x60,0x61,0x63,0x64,0x66,0x67, + 0x68,0x6A,0x6B,0x6D,0x6E,0x6F,0x71,0x72, + 0x73,0x75,0x76,0x78,0x79,0x7A,0x7C,0x7D, + 0x7E,0x80,0x81,0x82,0x84,0x85,0x86,0x88, + 0x89,0x8A,0x8B,0x8D,0x8E,0x8F,0x91,0x92, + 0x93,0x95,0x96,0x97,0x98,0x9A,0x9B,0x9C, + 0x9E,0x9F,0xA0,0xA1,0xA3,0xA4,0xA5,0xA6, + 0xA8,0xA9,0xAA,0xAB,0xAD,0xAE,0xAF,0xB0, + 0xB2,0xB3,0xB4,0xB5,0xB7,0xB8,0xB9,0xBA, + 0xBC,0xBD,0xBE,0xBF,0xC0,0xC2,0xC3,0xC4, + 0xC5,0xC7,0xC8,0xC9,0xCA,0xCB,0xCD,0xCE, + 0xCF,0xD0,0xD1,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xE0,0xE1, + 0xE2,0xE3,0xE4,0xE6,0xE7,0xE8,0xE9,0xEA, + 0xEB,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3, + 0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFC,0xFD, + 0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + } +}; +//// profile array //// + +typedef struct +{ + int productID; // USB PID + char productName[50]; // ESCI/2 procduct name + char deviceID[50]; // device ID (same as bonjour mdl name) + int lutID; // look up table no +}epsonds_profile_map; + +const epsonds_profile_map epsonds_models_predefined[] = { + {0x0145, "DS-5500","DS-5500", 7}, + {0x0145, "DS-6500","DS-6500", 7}, + {0x0145, "DS-7500","DS-7500", 7}, + {0x0146, "DS-50000","DS-50000", 7}, + {0x0146, "DS-60000","DS-60000", 7}, + {0x0146, "DS-70000","DS-70000", 7}, + {0x014C, "DS-510","DS-510", 7}, + {0x0150, "DS-560","DS-560", 7}, + {0x0152, "DS-40","DS-40", 7}, + {0x014D, "DS-760","DS-760", 7}, + {0x014D, "DS-860","DS-860", 7}, + {0x0154, "DS-520","DS-520", 7}, + {0x08BC, "PID 08BC","PX-M7050 Series", 7}, + {0x08BC, "PID 08BC","WF-8510 Series", 7}, + {0x08BC, "PID 08BC","WF-8590 Series", 7}, + {0x08CC, "PID 08CC","PX-M7050FX Series", 7}, + {0x08CC, "PID 08CC","WF-R8590 Series", 7}, + {0x0165, "DS-410","DS-410", 7}, + {0x016C, "ES-50","ES-50", 6}, + {0x0160, "DS-70","DS-70", 6}, + {0x016D, "ES-55R","ES-55R", 6}, + {0x018C, "RR-60","RR-60", 6}, + {0x016E, "ES-60W","ES-60W", 6}, + {0x0166, "DS-80W","DS-80W", 6}, + {0x016F, "ES-65WR","ES-65WR", 6}, + {0x018B, "RR-70W","RR-70W", 6}, + {0x016E, "ES-60WW","ES-60WW", 6}, + {0x016E, "ES-60WB","ES-60WB", 6}, + {0x015C, "DS-1630","DS-1630", 4}, + {0x015D, "DS-1610","DS-1610", 4}, + {0x015E, "DS-1660W","DS-1660W", 4}, + {0x0159, "DS-310","DS-310", 5}, + {0x0159, "ES-200","ES-200", 5}, + {0x0162, "DS-320","DS-320", 5}, + {0x015A, "DS-360W","DS-360W", 5}, + {0x015A, "ES-300W","ES-300W", 5}, + {0x0177, "ES-300WR","ES-300WR", 5}, + {0x0181, "ES-400II","ES-400II", 2}, + {0x0183, "DS-535II","DS-535II", 2}, + {0x0184, "DS-531","DS-531", 2}, + {0x0182, "DS-530II","DS-530II", 2}, + {0x0185, "ES-500WII","ES-500WII", 2}, + {0x0188, "DS-571W","DS-571W", 2}, + {0x0187, "DS-575WII","DS-575WII", 2}, + {0x0186, "DS-570WII","DS-570WII", 2}, + {0x017F, "ES-580W","ES-580W", 2}, + {0x0180, "RR-600W","RR-600W", 2}, + {0x0167, "DS-535","DS-535", 2}, + {0x017A, "DS-535H","DS-535H", 2}, + {0x0156, "ES-400","ES-400", 2}, + {0x0155, "DS-530","DS-530", 2}, + {0x016B, "FF-680W","FF-680W", 2}, + {0x0157, "DS-570W","DS-570W", 2}, + {0x0157, "ES-500W","ES-500W", 2}, + {0x0169, "DS-575W","DS-575W", 2}, + {0x0176, "ES-500WR","ES-500WR", 2}, + {0x114E, "PID 114E","EW-052A Series", 7}, + {0x114E, "PID 114E","XP-2100 Series", 7}, + {0x1135, "PID 1135","ET-2700 Series", 7}, + {0x1135, "PID 1135","L4150 Series", 7}, + {0x114A, "PID 114A","ET-M2140 Series", 7}, + {0x114A, "PID 114A","M2140 Series", 7}, + {0x114F, "PID 114F","ET-M3140 Series", 7}, + {0x114F, "PID 114F","M3140 Series", 7}, + {0x1143, "PID 1143","L3150 Series", 7}, + {0x1143, "PID 1143","ET-2710 Series", 7}, + {0x118A, "PID 118A","ET-2810 Series", 7}, + {0x118A, "PID 118A","L3250 Series", 7}, + {0x119B, "PID 119B","XP-2150 Series", 7}, + {0x00, "","", 0x00 } +}; + +typedef struct +{ + epsonds_profile_map *array; + int used; + int size; +}epsonds_profile_map_array; + + +static epsonds_profile_map_array stProfileMapArray; + +static void insert_profile_map(epsonds_profile_map_array *a, epsonds_profile_map element); + +static void init_profile_maps(epsonds_profile_map_array *a, size_t initialSize) { + a->array = malloc(initialSize * sizeof(epsonds_profile_map)); + a->used = 0; + a->size = initialSize; + + for (int i = 0; epsonds_models_predefined[i].productID != 0; i++) { + + //DBG(6, "epsonds_models_predefined[i].productID = %x\n", epsonds_models_predefined[i].productID ); + + insert_profile_map(a, epsonds_models_predefined[i]); + } +} + +static void insert_profile_map(epsonds_profile_map_array *a, epsonds_profile_map element) { + if (a->used == a->size) { + a->size *= 2; + a->array = realloc(a->array, a->size * sizeof(epsonds_profile_map)); + } + a->array[a->used++] = element; +} + +static void free_profile_maps(epsonds_profile_map_array *a) { + free(a->array); + a->array = NULL; + a->used = a->size = 0; +} +///////////////////////// + + struct mode_param mode_params[] = { {0, 0x00, 0x30, 1}, {0, 0x00, 0x30, 8}, @@ -86,16 +1316,12 @@ static SANE_String_Const mode_list[] = { NULL }; -static const SANE_String_Const adf_mode_list[] = { - SANE_I18N("Simplex"), - SANE_I18N("Duplex"), - NULL -}; /* Define the different scan sources */ -#define FBF_STR SANE_I18N("Flatbed") -#define ADF_STR SANE_I18N("Automatic Document Feeder") +#define STRING_FLATBED SANE_I18N("Flatbed") +#define STRING_ADFFRONT SANE_I18N("ADF Front") +#define STRING_ADFDUPLEX SANE_I18N("ADF Duplex") /* order will be fixed: fb, adf, tpu */ SANE_String_Const source_list[] = { @@ -129,6 +1355,9 @@ max_string_size(const SANE_String_Const strings[]) static SANE_Status attach_one_usb(SANE_String_Const devname); static SANE_Status attach_one_net(SANE_String_Const devname); +static SANE_Status acquire_jpeg_data(epsonds_scanner* s); +static SANE_Status acquire_and_decode_jpeg_data(epsonds_scanner* s); +static SANE_Status acquire_raw_data(epsonds_scanner* s); static void print_params(const SANE_Parameters params) @@ -146,6 +1375,11 @@ close_scanner(epsonds_scanner *s) { DBG(7, "%s: fd = %d\n", __func__, s->fd); + if (s->scanning) + { + sane_cancel(s); + } + if (s->fd == -1) goto free; @@ -171,49 +1405,6 @@ free: DBG(7, "%s: ZZZ\n", __func__); } -static void -e2_network_discovery(void) -{ - fd_set rfds; - int fd, len; - SANE_Status status; - - char *ip, *query = "EPSONP\x00\xff\x00\x00\x00\x00\x00\x00\x00"; - unsigned char buf[76]; - - struct timeval to; - - status = sanei_udp_open_broadcast(&fd); - if (status != SANE_STATUS_GOOD) - return; - - sanei_udp_write_broadcast(fd, 3289, (unsigned char *) query, 15); - - DBG(5, "%s, sent discovery packet\n", __func__); - - to.tv_sec = 1; - to.tv_usec = 0; - - FD_ZERO(&rfds); - FD_SET(fd, &rfds); - - sanei_udp_set_nonblock(fd, SANE_TRUE); - while (select(fd + 1, &rfds, NULL, NULL, &to) > 0) { - if ((len = sanei_udp_recvfrom(fd, buf, 76, &ip)) == 76) { - DBG(5, " response from %s\n", ip); - - /* minimal check, protocol unknown */ - if (strncmp((char *) buf, "EPSON", 5) == 0) - attach_one_net(ip); - } - } - - DBG(5, "%s, end\n", __func__); - - sanei_udp_close(fd); -} - - static SANE_Status open_scanner(epsonds_scanner *s) { @@ -230,7 +1421,7 @@ open_scanner(epsonds_scanner *s) unsigned char buf[5]; /* device name has the form net:ipaddr */ - status = sanei_tcp_open(&s->hw->sane.name[4], 1865, &s->fd); + status = sanei_tcp_open(&s->hw->name[4], 1865, &s->fd); if (status == SANE_STATUS_GOOD) { ssize_t read; @@ -272,12 +1463,10 @@ open_scanner(epsonds_scanner *s) } } else if (s->hw->connection == SANE_EPSONDS_USB) { - status = sanei_usb_open(s->hw->sane.name, &s->fd); if (status == SANE_STATUS_GOOD) { sanei_usb_set_timeout(USB_TIMEOUT); - sanei_usb_clear_halt(s->fd); } } else { @@ -307,7 +1496,6 @@ static struct epsonds_scanner * scanner_create(struct epsonds_device *dev, SANE_Status *status) { struct epsonds_scanner *s; - s = malloc(sizeof(struct epsonds_scanner)); if (s == NULL) { *status = SANE_STATUS_NO_MEM; @@ -428,7 +1616,32 @@ device_detect(const char *name, int type, SANE_Status *status) DBG(1, "scanner model: %s\n", dev->model); - /* add this scanner to the device list */ + + s->hw->lut_id = 0; + + for (int i = 0; i < stProfileMapArray.used; i++) { + + epsonds_profile_map* map = &stProfileMapArray.array[i]; + + + if (strcmp(map->productName, dev->model) == 0) { + + {//Convert to user friendly model name + free(s->hw->model); + + char* deviceName = (char*)malloc(strlen(map->deviceID) + 1); + memset(deviceName, 0, strlen(map->deviceID) + 1); + strncpy(deviceName, map->deviceID, strlen(map->deviceID)); + s->hw->model = deviceName; + s->hw->sane.model = s->hw->model; + } + {// set lutid + s->hw->lut_id = map->lutID; + } + break; + } + } + DBG(1, "scanner lut_id: %d\n", s->hw->lut_id); num_devices++; dev->next = first_dev; @@ -479,6 +1692,67 @@ attach_one_net(const char *dev) return attach(name, SANE_EPSONDS_NET); } +static void found_net_device(const char* device_name, const char* ip) +{ + DBG(7, "Found %s: ip = %s\n", device_name, ip); + + int foundSupportedDevice = 0; + + // search models + for (int i = 0; i < stProfileMapArray.used; i++) { + if (strcmp(stProfileMapArray.array[i].deviceID, device_name) == 0) { + foundSupportedDevice = 1; + break; + } + } + + + if (foundSupportedDevice) + { + char name[39 + 4]; + + strcpy(name, "net:"); + strncat(name, ip, 39); + + int foundCache = 0; + // search cache and prents duplicated model + for (epsonds_device* dev = first_dev; dev; dev = dev->next) { + if (strcmp(dev->sane.name, name) == 0) { + foundCache = 1; + } + } + if (foundCache == 0) + { + attach(name, SANE_EPSONDS_NET); + } + } +} + +static void +splitProfileName(const char* input, int* outProductID, char *outProductName, char* outDeviceID, int* outLutID) +{ + char target[1024]; + strncpy(target, input, 1023); + + strtok(target, ":");//profile + + //productID + char* pid = strtok(NULL, ","); + sscanf(pid, "%x", (unsigned int*)outProductID); + + //productName + char* productName = strtok(NULL, ","); + strncpy(outProductName, productName, 49); + + //deviceID + char* deviceID = strtok(NULL, ","); + strncpy(outDeviceID, deviceID, 49); + + //lutID + char* lutID = strtok(NULL, ","); + sscanf(lutID, "%d", outLutID); +} + static SANE_Status attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, @@ -489,8 +1763,17 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, int len = strlen(line); DBG(7, "%s: len = %d, line = %s\n", __func__, len, line); + if (strncmp(line, "profile", 7) == 0 ) { + DBG(7, " found profile device profile\n"); + + epsonds_profile_map profle_map; + + splitProfileName(line, &profle_map.productID, profle_map.productName, profle_map.deviceID, &profle_map.lutID); - if (sscanf(line, "usb %i %i", &vendor, &product) == 2) { + DBG(7, "Found profile : %x %s %s %d\n", profle_map.productID, profle_map.productName, profle_map.deviceID, profle_map.lutID); + + insert_profile_map(&stProfileMapArray, profle_map); + }else if (sscanf(line, "usb %i %i", &vendor, &product) == 2) { DBG(7, " user configured device\n"); @@ -501,15 +1784,11 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, } else if (strncmp(line, "usb", 3) == 0 && len == 3) { - int i, numIds; - DBG(7, " probing usb devices\n"); - numIds = epsonds_get_number_of_ids(); - - for (i = 0; i < numIds; i++) { - sanei_usb_find_devices(SANE_EPSONDS_VENDOR_ID, - epsonds_usb_product_ids[i], attach_one_usb); + for (int i = 0; i < stProfileMapArray.used; i++) { + int usbPid = stProfileMapArray.array[i].productID; + sanei_usb_find_devices(SANE_EPSONDS_VENDOR_ID, usbPid, attach_one_usb); } } else if (strncmp(line, "net", 3) == 0) { @@ -520,11 +1799,17 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, sanei_config_skip_whitespace(line + 3); if (strncmp(name, "autodiscovery", 13) == 0) - e2_network_discovery(); + { + #if WITH_AVAHI + epsonds_searchDevices(found_net_device); + #else + // currently does not support + //e2_network_discovery(); + #endif + } else attach_one_net(name); } - } else { DBG(0, "unable to parse config line: %s\n", line); } @@ -564,13 +1849,16 @@ SANE_Status sane_init(SANE_Int *version_code, SANE_Auth_Callback __sane_unused__ authorize) { DBG_INIT(); + + init_profile_maps(&stProfileMapArray, 100); + DBG(2, "%s: " PACKAGE " " VERSION "\n", __func__); DBG(1, "epsonds backend, version %i.%i.%i\n", EPSONDS_VERSION, EPSONDS_REVISION, EPSONDS_BUILD); if (version_code != NULL) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, EPSONDS_BUILD); sanei_usb_init(); @@ -582,6 +1870,7 @@ void sane_exit(void) { DBG(5, "** %s\n", __func__); + free_profile_maps(&stProfileMapArray); free_devices(); } @@ -591,7 +1880,8 @@ sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only) int i; epsonds_device *dev; - DBG(5, "** %s\n", __func__); + DBG(5, "** %s local_only = %d \n", __func__, local_only); + probe_devices(local_only); @@ -612,12 +1902,14 @@ sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only) *device_list = devlist; + return SANE_STATUS_GOOD; } static SANE_Status init_options(epsonds_scanner *s) { + DBG(5, "init_options\n"); int i; for (i = 0; i < NUM_OPTIONS; i++) { @@ -632,11 +1924,11 @@ init_options(epsonds_scanner *s) s->val[OPT_NUM_OPTS].w = NUM_OPTIONS; /* "Scan Mode" group: */ - - s->opt[OPT_MODE_GROUP].title = SANE_I18N("Scan Mode"); - s->opt[OPT_MODE_GROUP].desc = ""; - s->opt[OPT_MODE_GROUP].type = SANE_TYPE_GROUP; - s->opt[OPT_MODE_GROUP].cap = 0; + s->opt[OPT_STANDARD_GROUP].name = SANE_NAME_STANDARD; + s->opt[OPT_STANDARD_GROUP].title = SANE_TITLE_STANDARD; + s->opt[OPT_STANDARD_GROUP].desc = SANE_DESC_STANDARD; + s->opt[OPT_STANDARD_GROUP].type = SANE_TYPE_GROUP; + s->opt[OPT_STANDARD_GROUP].cap = 0; /* scan mode */ s->opt[OPT_MODE].name = SANE_NAME_SCAN_MODE; @@ -761,18 +2053,6 @@ init_options(epsonds_scanner *s) if (!s->hw->adf_has_load) s->opt[OPT_LOAD].cap |= SANE_CAP_INACTIVE; - s->opt[OPT_ADF_MODE].name = "adf-mode"; - s->opt[OPT_ADF_MODE].title = SANE_I18N("ADF Mode"); - s->opt[OPT_ADF_MODE].desc = - SANE_I18N("Selects the ADF mode (simplex/duplex)"); - s->opt[OPT_ADF_MODE].type = SANE_TYPE_STRING; - s->opt[OPT_ADF_MODE].size = max_string_size(adf_mode_list); - s->opt[OPT_ADF_MODE].constraint_type = SANE_CONSTRAINT_STRING_LIST; - s->opt[OPT_ADF_MODE].constraint.string_list = adf_mode_list; - s->val[OPT_ADF_MODE].w = 0; /* simplex */ - - if (!s->hw->adf_is_duplex) - s->opt[OPT_ADF_MODE].cap |= SANE_CAP_INACTIVE; s->opt[OPT_ADF_SKEW].name = "adf-skew"; s->opt[OPT_ADF_SKEW].title = SANE_I18N("ADF Skew Correction"); @@ -781,8 +2061,26 @@ init_options(epsonds_scanner *s) s->opt[OPT_ADF_SKEW].type = SANE_TYPE_BOOL; s->val[OPT_ADF_SKEW].w = 0; + + s->opt[OPT_ADF_CRP].name = "adf-crp"; + s->opt[OPT_ADF_CRP].title = SANE_I18N("ADF CRP Correction"); + s->opt[OPT_ADF_CRP].desc = + SANE_I18N("Enables ADF auto cropping"); // + s->opt[OPT_ADF_CRP].type = SANE_TYPE_BOOL; + s->val[OPT_ADF_CRP].w = 0; + + if (!s->hw->adf_has_skew) + { + s->val[OPT_ADF_SKEW].w = 0; s->opt[OPT_ADF_SKEW].cap |= SANE_CAP_INACTIVE; + } + + if(!s->hw->adf_has_crp) + { + s->val[OPT_ADF_CRP].w = 0; + s->opt[OPT_ADF_CRP].cap |= SANE_CAP_INACTIVE; + } return SANE_STATUS_GOOD; } @@ -793,6 +2091,8 @@ sane_open(SANE_String_Const name, SANE_Handle *handle) SANE_Status status; epsonds_scanner *s = NULL; + + DBG(7, "** %s: name = '%s'\n", __func__, name); /* probe if empty device name provided */ @@ -848,6 +2148,8 @@ sane_open(SANE_String_Const name, SANE_Handle *handle) status = eds_lock(s); } + setvalue((SANE_Handle)s, OPT_MODE, (void*)SANE_VALUE_SCAN_MODE_COLOR, NULL); + return status; } @@ -881,24 +2183,6 @@ search_string_list(const SANE_String_Const *list, SANE_String value) return ((*list == NULL) ? NULL : list); } -static void -activateOption(epsonds_scanner *s, SANE_Int option, SANE_Bool *change) -{ - if (!SANE_OPTION_IS_ACTIVE(s->opt[option].cap)) { - s->opt[option].cap &= ~SANE_CAP_INACTIVE; - *change = SANE_TRUE; - } -} - -static void -deactivateOption(epsonds_scanner *s, SANE_Int option, SANE_Bool *change) -{ - if (SANE_OPTION_IS_ACTIVE(s->opt[option].cap)) { - s->opt[option].cap |= SANE_CAP_INACTIVE; - *change = SANE_TRUE; - } -} - /* * Handles setting the source (flatbed, transparency adapter (TPU), * or auto document feeder (ADF)). @@ -911,7 +2195,6 @@ static void change_source(epsonds_scanner *s, SANE_Int optindex, char *value) { int force_max = SANE_FALSE; - SANE_Bool dummy; DBG(1, "%s: optindex = %d, source = '%s'\n", __func__, optindex, value); @@ -928,26 +2211,17 @@ change_source(epsonds_scanner *s, SANE_Int optindex, char *value) force_max = SANE_TRUE; } - if (strcmp(ADF_STR, value) == 0) { - + if (strcmp(STRING_ADFFRONT, value) == 0 || strcmp(STRING_ADFDUPLEX, value) == 0) { s->hw->x_range = &s->hw->adf_x_range; s->hw->y_range = &s->hw->adf_y_range; s->hw->alignment = s->hw->adf_alignment; - if (s->hw->adf_is_duplex) { - activateOption(s, OPT_ADF_MODE, &dummy); - } else { - deactivateOption(s, OPT_ADF_MODE, &dummy); - s->val[OPT_ADF_MODE].w = 0; - } } else if (strcmp(TPU_STR, value) == 0) { s->hw->x_range = &s->hw->tpu_x_range; s->hw->y_range = &s->hw->tpu_y_range; - deactivateOption(s, OPT_ADF_MODE, &dummy); - } else { /* neither ADF nor TPU active, assume FB */ @@ -995,7 +2269,6 @@ getvalue(SANE_Handle handle, SANE_Int option, void *value) break; case OPT_MODE: - case OPT_ADF_MODE: case OPT_SOURCE: strcpy((char *) value, sopt->constraint.string_list[sval->w]); break; @@ -1045,12 +2318,9 @@ setvalue(SANE_Handle handle, SANE_Int option, void *value, SANE_Int *info) switch (option) { - case OPT_ADF_MODE: /* simple lists */ - sval->w = optindex; - break; - case OPT_ADF_SKEW: case OPT_RESOLUTION: + case OPT_ADF_CRP: sval->w = *((SANE_Word *) value); reload = SANE_TRUE; break; @@ -1064,9 +2334,29 @@ setvalue(SANE_Handle handle, SANE_Int option, void *value, SANE_Int *info) // fall through case OPT_TL_X: case OPT_TL_Y: + sval->w = *((SANE_Word *) value); if (NULL != info) *info |= SANE_INFO_RELOAD_PARAMS; + + if (option == OPT_BR_X) + { + DBG(17, "OPT_BR_X = %d\n", sval->w); + } + if (option == OPT_BR_Y) + { + DBG(17, "OPT_BR_Y = %d\n", sval->w); + } + if (option == OPT_TL_X) + { + DBG(17, "OPT_TL_X = %d\n", sval->w); + } + if (option == OPT_TL_Y) + { + DBG(17, "OPT_TL_Y = %d\n", sval->w); + } + // adf crop set to off + s->val[OPT_ADF_CRP].w = 0; break; case OPT_SOURCE: @@ -1076,6 +2366,8 @@ setvalue(SANE_Handle handle, SANE_Int option, void *value, SANE_Int *info) case OPT_MODE: { + DBG(17, " OPT_MODE = index %d\n", optindex); + /* use JPEG mode if RAW is not available when bpp > 1 */ if (optindex > 0 && !s->hw->has_raw) { s->mode_jpeg = 1; @@ -1152,6 +2444,183 @@ sane_control_option(SANE_Handle handle, SANE_Int option, SANE_Action action, return SANE_STATUS_INVAL; } + +static void setBit (SANE_Byte* bytes, SANE_Int bitIndex, SANE_Bool isTrue) +{ + SANE_Int octet = bitIndex / 8; + SANE_Byte bit = 7 - (bitIndex % 8); + + if (isTrue) { + bytes[octet] |= (1 << bit); + } else { + bytes[octet] &= ~(1 << bit); + } +} + +static SANE_Bool getBit (SANE_Byte* bytes, SANE_Int bitIndex) +{ + SANE_Int octet = bitIndex / 8; + SANE_Byte mask = 1 << (7 - (bitIndex % 8)); + + if( bytes[octet] & mask ){ + return SANE_TRUE; + } + + return SANE_FALSE; +} + +static void swapPixel1(SANE_Int x1, + SANE_Int y1, + SANE_Int x2, + SANE_Int y2, + SANE_Byte* bytes, + SANE_Byte bitsPerSample, + SANE_Int samplesPerPixel, + SANE_Int bytesPerRow) +{ + SANE_Int pixelBits = bitsPerSample * samplesPerPixel; + SANE_Int widthBits = bytesPerRow * 8; + + SANE_Byte temp = getBit(bytes, widthBits * y1 + x1 * pixelBits); + { + SANE_Byte right = getBit(bytes, widthBits * y2 + x2 * pixelBits); + setBit(bytes, widthBits * y1 + x1 * pixelBits, right); + } + setBit(bytes, widthBits * y2 + x2 * pixelBits, temp); +} + +static void swapPixel8(SANE_Int x1, + SANE_Int y1, + SANE_Int x2, + SANE_Int y2, + SANE_Byte* bytes, + SANE_Byte bitsPerSample, + SANE_Int samplesPerPixel, + SANE_Int bytesPerRow) +{ + SANE_Int pixelBytes = samplesPerPixel * bitsPerSample / 8; + + for (SANE_Byte i = 0; i < pixelBytes; i++) { + SANE_Byte temp = bytes[y1 * bytesPerRow + (pixelBytes * x1 + i)]; + bytes[y1 * bytesPerRow + (pixelBytes * x1 + i)] = bytes[y2 * bytesPerRow + (pixelBytes * x2 + i)]; + bytes[y2 * bytesPerRow + (pixelBytes * x2 + i)] = temp; + } +} + + + +static void swapPixel(SANE_Int x1, + SANE_Int y1, + SANE_Int x2, + SANE_Int y2, + SANE_Byte* bytes, + SANE_Byte bitsPerSample, + SANE_Int samplesPerPixel, + SANE_Int bytesPerRow) +{ + if (bitsPerSample == 1) { + swapPixel1(x1, y1, x2, y2, bytes, bitsPerSample, samplesPerPixel, bytesPerRow); + }else if(bitsPerSample == 8 || bitsPerSample == 16){ + swapPixel8(x1, y1, x2, y2, bytes, bitsPerSample, samplesPerPixel, bytesPerRow); + } +} + + +void +upside_down_backside_image(epsonds_scanner *s) +{ + // get all data from ring_buffer + if (eds_ring_avail(&s->back) && + (strcmp(s->hw->sane.model, (char*)"DS-1630") == 0 + || strcmp(s->hw->sane.model, (char*)"DS-1610") == 0 + || strcmp(s->hw->sane.model, (char*)"DS-1660W") == 0)) + { + SANE_Int bytesPerLine = s->params.bytes_per_line; + SANE_Int imageSize = bytesPerLine * s->height_back; + + SANE_Byte* workBuffer = malloc(imageSize); + // if there is not enough memory, do nothing. + if (workBuffer) + { + eds_ring_read(&s->back, workBuffer, imageSize); + SANE_Int samplesPerPxel = 3; + if (s->params.format == SANE_FRAME_RGB) + { + samplesPerPxel = 3; + } + else if (s->params.format == SANE_FRAME_GRAY) + { + samplesPerPxel = 1; + } + + SANE_Int half = (s->height_back / 2) - 1; + if (half < 0) { + half = 0; + } + + if((s->height_back % 2) == 1) { + SANE_Int ymid = ( (s->height_back - 1 ) / 2 ); + for(SANE_Int x = 0;x < (s->width_back / 2); x++) { + swapPixel(x, ymid, s->width_back - x - 1, ymid, workBuffer, s->params.depth, samplesPerPxel, s->params.bytes_per_line); + } + } + + if (s->height_back != 1) { + for(SANE_Int x = 0; x < s->width_back; x++) { + for(SANE_Int y = 0;y <= half; y++) { + swapPixel(x, y, s->width_back - x - 1, s->height_back - y -1, workBuffer, s->params.depth, samplesPerPxel, s->params.bytes_per_line); + } + } + } + + eds_ring_write(&s->back, workBuffer, imageSize); + free(workBuffer); + workBuffer = NULL; + + } + } + +} + + +SANE_Status +get_next_image(epsonds_scanner *s) +{ + SANE_Status status = SANE_STATUS_GOOD; + + if (s->acquirePage == 0 && s->current == &s->front) + { + DBG(20, "** %s: get_next_image\n", __func__); + + + /*page info will be updatted by pen*/ + s->width_back = 0; + s->width_front = 0; + s->height_back = 0; + s->height_front = 0; + + if (s->mode_jpeg) + { + status = acquire_and_decode_jpeg_data(s); + }else{ + status = acquire_raw_data(s); + } + if (status != SANE_STATUS_GOOD) + { + eds_ring_flush(&s->front); + eds_ring_flush(&s->back); + eds_ring_destory(&s->front); + eds_ring_destory(&s->back); + } + DBG(20," ringFront = %d ringBack = %d\n", eds_ring_avail(&s->front), eds_ring_avail(&s->back)); + + s->acquirePage = 1; + } + + return status; +} + + SANE_Status sane_get_parameters(SANE_Handle handle, SANE_Parameters *params) { @@ -1173,25 +2642,186 @@ sane_get_parameters(SANE_Handle handle, SANE_Parameters *params) eds_init_parameters(s); } + + SANE_Status status = SANE_STATUS_GOOD; + + status = get_next_image(s); + + // if size auto, update page size value + if(s->val[OPT_ADF_CRP].w) + { + // frontside + if (s->current == &s->front) + { + DBG(20, "front side \n"); + if (s->width_front != 0 && s->height_front != 0) + { + if (s->params.format == SANE_FRAME_RGB) + { + s->params.bytes_per_line = s->width_front * 3; + s->params.pixels_per_line = s->width_front; + } + + if (s->params.format == SANE_FRAME_GRAY && s->params.depth == 8) + { + s->params.bytes_per_line = s->width_front; + s->params.pixels_per_line = s->width_front; + } + + if (s->params.format == SANE_FRAME_GRAY && s->params.depth == 1) + { + s->params.bytes_per_line = (s->width_front + 7)/8; + s->params.pixels_per_line = s->width_front; + } + s->params.lines = s->height_front; + } + } + // backside + if (s->current == &s->back) + { + DBG(20, "back side \n"); + if (s->width_back != 0 && s->height_back != 0) + { + if (s->params.format == SANE_FRAME_RGB) + { + s->params.bytes_per_line = s->width_back * 3; + s->params.pixels_per_line = s->width_back; + } + + if (s->params.format == SANE_FRAME_GRAY && s->params.depth == 8) + { + s->params.bytes_per_line = s->width_back; + s->params.pixels_per_line = s->width_back; + } + + if (s->params.format == SANE_FRAME_GRAY && s->params.depth == 1) + { + s->params.bytes_per_line = (s->width_back + 7)/8; + s->params.pixels_per_line = s->width_back; + } + s->params.lines = s->height_back; + } + } + } if (params != NULL) *params = s->params; print_params(s->params); - return SANE_STATUS_GOOD; + DBG(20, "s->params.line = %d s->params.bytes_per_line = %d s->params.pixels_per_line = %d \n", s->params.lines, s->params.bytes_per_line , s->params.pixels_per_line ); + return status; +} + + + +typedef float ColorMatrix[3][3]; + +#define CCT_TABLE_SIZE 9 +static int get_roundup_index(double frac[], int n) +{ + int i, index = -1; + double max_val = 0.0; + + for (i=0; i0) continue; + if (min_val>frac[i]) { + index = i; + min_val = frac[i]; + } + } + return index; } + +void ESCIRoundColorCorrectionMatrix(int mult, double org_cct[], int rnd_cct[]) +{ + int i, j, index; + double mult_cct[CCT_TABLE_SIZE], frac[CCT_TABLE_SIZE]; + int sum[3]; + int loop; + + for (i=0; imult) { + index = get_rounddown_index(&frac[i*3], 3); + if (index!=-1) { + rnd_cct[i*3+index] --; + mult_cct[i*3+index] = rnd_cct[i*3+index]; + sum[i]--; + } + } + } + + } while ((++loop<2)&&((sum[0]!=mult)||(sum[1]!=mult)||(sum[2]!=mult))); +} + + + /* * This function is part of the SANE API and gets called from the front end to * start the scan process. */ - +#define CMD_BUF_SIZE 1000 SANE_Status sane_start(SANE_Handle handle) { epsonds_scanner *s = (epsonds_scanner *)handle; char buf[65]; /* add one more byte to correct buffer overflow issue */ - char cmd[100]; /* take care not to overflow */ + char cmd[CMD_BUF_SIZE]; /* take care not to overflow */ SANE_Status status = 0; s->pages++; @@ -1203,26 +2833,28 @@ sane_start(SANE_Handle handle) s->eof = 0; s->canceling = 0; + s->acquirePage = 0; if ((s->pages % 2) == 1) { s->current = &s->front; - eds_ring_flush(s->current); } else if (eds_ring_avail(&s->back)) { DBG(5, "back side\n"); s->current = &s->back; } - /* prepare the JPEG decompressor */ - if (s->mode_jpeg) { - status = eds_jpeg_start(s); - if (status != SANE_STATUS_GOOD) { - goto end; - } } - /* scan already in progress? (one pass adf) */ - if (s->scanning) { + if (s->scanning || eds_ring_avail(&s->back) > 0) { DBG(5, " scan in progress, returning early\n"); - return SANE_STATUS_GOOD; + return get_next_image(s); + } + if (strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFFRONT) == 0 || strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFDUPLEX) == 0) { + if (s->scanEnd) + { + s->scanEnd = 0; + return SANE_STATUS_NO_DOCS; + } + }else{ + s->scanEnd = 0; } /* calc scanning parameters */ @@ -1239,13 +2871,7 @@ sane_start(SANE_Handle handle) /* transfer buffer size, bsz */ /* XXX read value from scanner */ - s->bsz = (65536 * 4); - - /* ring buffer for front page */ - status = eds_ring_init(&s->front, s->bsz * 2); - if (status != SANE_STATUS_GOOD) { - return status; - } + s->bsz = (1048576 * 4); /* transfer buffer */ s->buf = realloc(s->buf, s->bsz); @@ -1256,29 +2882,34 @@ sane_start(SANE_Handle handle) /* set scanning parameters */ + s->isDuplexScan = 0; /* document source */ - if (strcmp(source_list[s->val[OPT_SOURCE].w], ADF_STR) == 0) { + if (strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFFRONT) == 0 || strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFDUPLEX) == 0) { - sprintf(buf, "#ADF%s%s", - s->val[OPT_ADF_MODE].w ? "DPLX" : "", - s->val[OPT_ADF_SKEW].w ? "SKEW" : ""); + SANE_Int status = esci2_stat(s); + if (status == SANE_STATUS_NO_DOCS) + { + return SANE_STATUS_NO_DOCS; + } - /* it seems that DFL only works in duplex mode, but it's - * also required to be enabled or duplex will be rejected. - */ + SANE_Int duplexMode = (strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFDUPLEX) == 0); - if (s->val[OPT_ADF_MODE].w) { + sprintf(buf, "#ADF%s%s%s", + duplexMode ? "DPLX" : "", + s->val[OPT_ADF_SKEW].w ? "SKEW" : "", + s->val[OPT_ADF_CRP].w ? "CRP " : "" + ); - if (s->hw->adf_has_dfd == 2) { - strcat(buf, "DFL2"); - } else if (s->hw->adf_has_dfd == 1) { - strcat(buf, "DFL1"); - } + if (duplexMode) + { + s->isDuplexScan = 1; } - - } else if (strcmp(source_list[s->val[OPT_SOURCE].w], FBF_STR) == 0) { + s->isflatbedScan = 0; + } + else if (strcmp(source_list[s->val[OPT_SOURCE].w], STRING_FLATBED) == 0) { strcpy(buf, "#FB "); + s->isflatbedScan = 1; } else { /* XXX */ @@ -1286,8 +2917,18 @@ sane_start(SANE_Handle handle) strcpy(cmd, buf); + s->needToConvertBW = 0; + if (s->params.format == SANE_FRAME_GRAY) { - sprintf(buf, "#COLM%03d", s->params.depth); + if (s->params.depth == 1 && s->hw->has_mono == 0) + { + sprintf(buf, "#COLM008"); + s->needToConvertBW = 1; + s->mode_jpeg = 1; + }else + { + sprintf(buf, "#COLM%03d", s->params.depth); + } } else if (s->params.format == SANE_FRAME_RGB) { sprintf(buf, "#COLC%03d", s->params.depth * 3); } @@ -1303,9 +2944,29 @@ sane_start(SANE_Handle handle) strcat(cmd, "#FMTJPG #JPGd090"); } + /* set GMM */ + if (s->params.depth == 1) + { + sprintf(buf, "#GMMUG10"); + } else + { + sprintf(buf, "#GMMUG18"); + } + strcat(cmd, buf); + /* resolution (RSMi not always supported) */ - if (s->val[OPT_RESOLUTION].w > 999) { + if (strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFFRONT) == 0 && s->val[OPT_RESOLUTION].w > 600) { + DBG(0, "Automatic Document Feeder supported resolution of 600dpi or less. \n"); + } else if (s->val[OPT_RESOLUTION].w > 999) { + sprintf(buf, "#RSMi%07d#RSSi%07d", s->val[OPT_RESOLUTION].w, s->val[OPT_RESOLUTION].w); + } else { + sprintf(buf, "#RSMd%03d#RSSd%03d", s->val[OPT_RESOLUTION].w, s->val[OPT_RESOLUTION].w); + } + + if (strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFDUPLEX) == 0 && s->val[OPT_RESOLUTION].w > 600) { + DBG(0, "Automatic Document Feeder supported resolution of 600dpi or less. \n"); + } else if (s->val[OPT_RESOLUTION].w > 999) { sprintf(buf, "#RSMi%07d#RSSi%07d", s->val[OPT_RESOLUTION].w, s->val[OPT_RESOLUTION].w); } else { sprintf(buf, "#RSMd%03d#RSSd%03d", s->val[OPT_RESOLUTION].w, s->val[OPT_RESOLUTION].w); @@ -1313,13 +2974,321 @@ sane_start(SANE_Handle handle) strcat(cmd, buf); + if (strcmp(s->hw->sane.model, (char*)"DS-70") == 0 || strcmp(s->hw->sane.model, (char*)"ES-65WR") == 0 || strcmp(s->hw->sane.model, (char*)"ES-60W") == 0 + || strcmp(s->hw->sane.model, (char*)"DS-80W") == 0 || strcmp(s->hw->sane.model, (char*)"ES-55R") == 0 || strcmp(s->hw->sane.model, (char*)"ES-50") == 0){ + sprintf(buf, "#BSZi0262144"); + strcat(cmd, buf); + } + else { + sprintf(buf, "#BSZi1048576"); + strcat(cmd, buf); + } + + /* scanning area */ + sprintf(buf, "#ACQi%07di%07di%07di%07d", s->left, s->top, s->params.pixels_per_line, s->params.lines); + + if (strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFFRONT) == 0 || strcmp(source_list[s->val[OPT_SOURCE].w], STRING_ADFDUPLEX) == 0) { + status = esci2_stat(s); + if (status != SANE_STATUS_GOOD) { + goto end; + } + } + strcat(cmd, buf); - status = esci2_para(s, cmd); + + int pos = 0; + + { + for (int i = 0; i < CMD_BUF_SIZE; i++) + { + // find end of string + if(cmd[i] == 0) + { + pos = i; + break; + } + } + + + if (s->params.format == SANE_FRAME_GRAY && s->params.depth == 8) { + DBG(10, "SANE_FRAME_GRAY\n"); + cmd[pos++] = '#'; + cmd[pos++] = 'G'; + cmd[pos++] = 'M'; + cmd[pos++] = 'T'; + cmd[pos++] = 'M'; + cmd[pos++] = 'O'; + cmd[pos++] = 'N'; + cmd[pos++] = 'O'; + cmd[pos++] = 'h'; + cmd[pos++] = '1'; + cmd[pos++] = '0'; + cmd[pos++] = '0'; + + for(int count = 0; count < 256; count++) { + cmd[pos++] = LUT[s->hw->lut_id][count]; + } + } + if (s->params.format == SANE_FRAME_GRAY && s->params.depth == 1) { + DBG(10, "SANE_FRAME_GRAY\n"); + cmd[pos++] = '#'; + cmd[pos++] = 'G'; + cmd[pos++] = 'M'; + cmd[pos++] = 'T'; + cmd[pos++] = 'M'; + cmd[pos++] = 'O'; + cmd[pos++] = 'N'; + cmd[pos++] = 'O'; + cmd[pos++] = 'h'; + cmd[pos++] = '1'; + cmd[pos++] = '0'; + cmd[pos++] = '0'; + + for(int count = 0; count < 256; count++) { + cmd[pos++] = LUT[0][count]; + } + } + else if (s->params.format == SANE_FRAME_RGB) { + DBG(10, "SANE_FRAME_RGB\n"); + cmd[pos++] = '#'; + cmd[pos++] = 'G'; + cmd[pos++] = 'M'; + cmd[pos++] = 'T'; + cmd[pos++] = 'R'; + cmd[pos++] = 'E'; + cmd[pos++] = 'D'; + cmd[pos++] = ' '; + cmd[pos++] = 'h'; + cmd[pos++] = '1'; + cmd[pos++] = '0'; + cmd[pos++] = '0'; + + for(int count = 0; count < 256; count++) { + cmd[pos++] = LUT_R[s->hw->lut_id][count]; + } + + cmd[pos++] = '#'; + cmd[pos++] = 'G'; + cmd[pos++] = 'M'; + cmd[pos++] = 'T'; + cmd[pos++] = 'G'; + cmd[pos++] = 'R'; + cmd[pos++] = 'N'; + cmd[pos++] = ' '; + cmd[pos++] = 'h'; + cmd[pos++] = '1'; + cmd[pos++] = '0'; + cmd[pos++] = '0'; + + for(int count = 0; count < 256; count++) { + cmd[pos++] = LUT_G[s->hw->lut_id][count]; + } + + cmd[pos++] = '#'; + cmd[pos++] = 'G'; + cmd[pos++] = 'M'; + cmd[pos++] = 'T'; + cmd[pos++] = 'B'; + cmd[pos++] = 'L'; + cmd[pos++] = 'U'; + cmd[pos++] = ' '; + cmd[pos++] = 'h'; + cmd[pos++] = '1'; + cmd[pos++] = '0'; + cmd[pos++] = '0'; + + for(int count = 0; count < 256; count++) { + cmd[pos++] = LUT_B[s->hw->lut_id][count]; + } + } + cmd[pos] = 0; + + } + {// Set Color Matrix + if (s->params.format == SANE_FRAME_RGB && s->hw->lut_id != 0 )/*Color Matrix Target devide and color Scan*/ + { + ColorMatrix matrix; + + // DS-530 + + if (s->hw->lut_id == 2) + { + // R + matrix[0][0] = 1.0229; + matrix[0][1] = 0.0009; + matrix[0][2] = -0.0238; + + // G + matrix[1][0] = 0.0031; + matrix[1][1] = 1.0287; + matrix[1][2] = -0.0318; + + //B + matrix[2][0] = 0.0044; + matrix[2][1] = -0.1150; + matrix[2][2] = 1.1106; + } + + // DS-1660W Flatbed + + if (s->hw->lut_id == 4) + { + // R + matrix[0][0] = 1.0229; + matrix[0][1] = 0.0009; + matrix[0][2] = -0.0238; + + // G + matrix[1][0] = 0.0031; + matrix[1][1] = 1.0287; + matrix[1][2] = -0.0318; + + //B + matrix[2][0] = 0.0044; + matrix[2][1] = -0.1150; + matrix[2][2] = 1.1106; + } + + + // DS-320 + + if (s->hw->lut_id == 5) + { + // R + matrix[0][0] = 1.0250; + matrix[0][1] = 0.0004; + matrix[0][2] = -0.0254; + + // G + matrix[1][0] = 0.0003; + matrix[1][1] = 1.0022; + matrix[1][2] = -0.0025; + + //B + matrix[2][0] = 0.0049; + matrix[2][1] = -0.0949; + matrix[2][2] = 1.0900; + } + + + // ES-50 + + if (s->hw->lut_id == 6) + { + // R + matrix[0][0] = 1.0383; + matrix[0][1] = -0.0021; + matrix[0][2] = -0.0362; + + // G + matrix[1][0] = 0.0046; + matrix[1][1] = 1.0576; + matrix[1][2] = -0.0622; + + //B + matrix[2][0] = 0.0235; + matrix[2][1] = -0.2396; + matrix[2][2] = 1.2161; + } + + + // R + matrix[0][0] = 0.9864; + matrix[0][1] = 0.0248; + matrix[0][2] = -0.0112; + + // G + matrix[1][0] = 0.0021; + matrix[1][1] = 1.0100; + matrix[1][2] = -0.0112; + + //B + matrix[2][0] = 0.0139; + matrix[2][1] = -0.1249; + matrix[2][2] = 1.1110; + + + // Set Matrix value + { + cmd[pos++] = '#'; + cmd[pos++] = 'C'; + cmd[pos++] = 'M'; + cmd[pos++] = 'X'; + cmd[pos++] = 'U'; + cmd[pos++] = 'M'; + cmd[pos++] = '0'; + cmd[pos++] = '8'; + cmd[pos++] = 'h'; + cmd[pos++] = '0'; + cmd[pos++] = '0'; + cmd[pos++] = '9'; + } + + + // Matrix to be sent to scanner must be following d1-d9 order: + // + // G R B + // G [d1 d4 d7] + // R [d2 d5 d8] + // B [d3 d6 d9] + // + // So, we will convert it with index table. + char index[9] = {4, 1, 7, 3, 0, 6, 5, 2, 8}; + + double flatten[9] = {0}; + for (int row = 0; row < 3; row++) { + for (int col = 0; col < 3; col++) { + flatten[row * 3 + col] = matrix[row][col]; + } + } + + int rounded[9] = {0}; + ESCIRoundColorCorrectionMatrix(32, flatten, rounded); + + + char ordered[9] = {0}; + for (int row = 0; row < 3; row++) { + for (int col = 0; col < 3; col++) { + int val = rounded[row * 3 + col]; + unsigned char oct = (unsigned char)abs(val); + oct |= ((val < 0) ? (1 << 7) : 0); + ordered[(signed char)index[row * 3 + col]] = oct; + } + } + { + cmd[pos++] = ordered[0]; + cmd[pos++] = ordered[1]; + cmd[pos++] = ordered[2]; + cmd[pos++] = ordered[3]; + cmd[pos++] = ordered[4]; + cmd[pos++] = ordered[5]; + cmd[pos++] = ordered[6]; + cmd[pos++] = ordered[7]; + cmd[pos++] = ordered[8]; + cmd[pos++] = 0; //padding + cmd[pos++] = 0; //padding + cmd[pos++] = 0; //padding + + + DBG(1, "color matrix\n"); + for (int i = 0; i < 9; i++) + { + DBG(1, "%d\n", ordered[i]); + } + + } + cmd[pos] = 0; + } + + } + + + status = esci2_para(s, cmd, pos); if (status != SANE_STATUS_GOOD) { goto end; } @@ -1336,7 +3305,8 @@ sane_start(SANE_Handle handle) /* first page is page 1 */ s->pages = 1; s->scanning = 1; - + s->dummy = 0; + s->scanEnd = 0; end: if (status != SANE_STATUS_GOOD) { DBG(1, "%s: start failed: %s\n", __func__, sane_strstatus(status)); @@ -1345,140 +3315,305 @@ end: return status; } -/* this moves data from our buffers to SANE */ - -SANE_Status -sane_read(SANE_Handle handle, SANE_Byte *data, SANE_Int max_length, - SANE_Int *length) +static SANE_Status acquire_jpeg_data(epsonds_scanner* s) { - SANE_Int read = 0, tries = 3; - SANE_Int available; - SANE_Status status = 0; - epsonds_scanner *s = (epsonds_scanner *)handle; - *length = read = 0; + SANE_Int read = 0; - DBG(20, "** %s: backside = %d\n", __func__, s->backside); - - /* sane_read called before sane_start? */ - if (s->current == NULL) { - DBG(0, "%s: buffer is NULL", __func__); - return SANE_STATUS_INVAL; + SANE_Int jpegBufSize = s->params.bytes_per_line * s->params.lines; + if (s->needToConvertBW) + { + jpegBufSize = s->params.pixels_per_line * s->params.lines; } - /* anything in the buffer? pass it to the frontend */ - available = eds_ring_avail(s->current); - if (available) { - DBG(18, "reading from ring buffer, %d left\n", available); + s->frontJpegBuf = malloc(jpegBufSize); + s->backJpegBuf = malloc(jpegBufSize); + s->frontJpegBufLen = 0; + s->backJpegBufLen = 0; + + // load all images, decode and fill buffer + SANE_Int status = SANE_STATUS_GOOD; - if (s->mode_jpeg && !s->jpeg_header_seen) { + int eofFront = 0; + int eofBack = 0; - status = eds_jpeg_read_header(s); - if (status != SANE_STATUS_GOOD && --tries) { - goto read_again; + + status = eds_ring_init(&s->front, (s->params.bytes_per_line) * s->params.lines); + if (status != SANE_STATUS_GOOD) { + return status; + } + + status = eds_ring_init(&s->back, (s->params.bytes_per_line) * s->params.lines); + if (status != SANE_STATUS_GOOD) { + return status; + } + + while (1) + { + status = esci2_img(s, &read); + DBG(20, "acquire_jpeg_data read: %d, eof: %d, backside: %d, status: %d\n", read, s->eof, s->backside, status); + if (read) + { + if (s->backside) + { + SANE_Byte* backBuffer = s->backJpegBuf + s->backJpegBufLen; + memcpy(backBuffer, s->buf, read); + s->backJpegBufLen += read; + }else{ + SANE_Byte* frontBuffer = s->frontJpegBuf + s->frontJpegBufLen ; + memcpy(frontBuffer, s->buf, read); + s->frontJpegBufLen += read; } } + if (status == SANE_STATUS_GOOD) + { - if (s->mode_jpeg) { - eds_jpeg_read(handle, data, max_length, &read); - } else { - eds_copy_image_from_ring(s, data, max_length, &read); + DBG(20, "continue acquire image\n"); + continue; } - - if (read == 0) { - goto read_again; + else if (status == SANE_STATUS_EOF) + { + if (s->backside) + { + DBG(20, "eofBack\n"); + eofBack = 1; + }else{ + DBG(20, "eofFront\n"); + eofFront = 1; + } + }else if (status == SANE_STATUS_CANCELLED) + { + // cancel cleanup + esci2_can(s); + + free(s->frontJpegBuf); + free(s->backJpegBuf); + s->frontJpegBuf = NULL; + s->backJpegBuf = NULL; + return status; + }else{ + // error occurs cleanup + free(s->frontJpegBuf); + free(s->backJpegBuf); + s->frontJpegBuf = NULL; + s->backJpegBuf = NULL; + return status; } - *length = read; - return SANE_STATUS_GOOD; + if (s->isDuplexScan) + { + DBG(20, "eofFront = %d eofBack = %d\n", eofFront, eofBack); + // acquire finish + if (eofFront && eofBack) + { + DBG(20, "eofFront && eofBack end\n"); + break; + } + }else{ + if (eofFront) + { + DBG(20, "eofFront end\n"); + break; + } + } + } + return SANE_STATUS_GOOD; +} - } else if (s->current == &s->back) { +static SANE_Status +acquire_raw_data(epsonds_scanner* s) +{ + SANE_Int read = 0; - /* finished reading the back page, next - * command should give us the EOF - */ - DBG(18, "back side ring buffer empty\n"); - } + // load all images, decode and fill buffer + SANE_Int status = SANE_STATUS_GOOD; - /* read until data or error */ + int eofFront = 0; + int eofBack = 0; + int firstWrite = 1; -read_again: + while (1) + { + DBG(20, "acquire_raw_data loop start\n"); + status = esci2_img(s, &read); + DBG(20, "acquire_raw_data read: %d, eof: %d, backside: %d, status: %d\n", read, s->eof, s->backside, status); + + if (read) + { + if (firstWrite) + { + status = eds_ring_init(&s->front, (s->params.bytes_per_line + s->dummy) * s->params.lines); + if (status != SANE_STATUS_GOOD) { + return status; + } + + status = eds_ring_init(&s->back, (s->params.bytes_per_line + s->dummy) * s->params.lines); + if (status != SANE_STATUS_GOOD) { + return status; + } + firstWrite = 0; + } - status = esci2_img(s, &read); - if (status != SANE_STATUS_GOOD) { - DBG(20, "read: %d, eof: %d, backside: %d, status: %d\n", read, s->eof, s->backside, status); - } + DBG(20, "eds_ring_write start\n"); + status = eds_ring_write(s->backside ? &s->back : &s->front, s->buf, read); + DBG(20, "eds_ring_write end\n"); + } + DBG(20, "acquire_raw_data3\n"); - /* just got a back side page, alloc ring buffer if necessary - * we didn't before because dummy was not known - */ - if (s->backside) { + if (status == SANE_STATUS_GOOD) + { + DBG(20, "contiune acquire image\n"); + continue; + } + else if (status == SANE_STATUS_EOF) + { + if (s->backside) + { + eofBack = 1; + }else{ + eofFront = 1; + } + } + else if (status == SANE_STATUS_CANCELLED) + { + esci2_can(s); + return status; + }else{ + // error occurs cleanup + return status; + } - int required = s->params.lines * (s->params.bytes_per_line + s->dummy); + if (s->isDuplexScan) + { + // acquire finish + if (eofFront && eofBack) + { + break; + } + }else{ + if (eofFront) + { + break; + } + } + } - if (s->back.size < required) { - DBG(20, "allocating buffer for the back side\n"); + int needBytes = (s->params.bytes_per_line + s->dummy) * s->params.lines; + { + int available = eds_ring_avail(&s->front); + if (available < needBytes) + { + int required = needBytes - available; + unsigned char* padding = (unsigned char*)malloc(required); + memset(padding, 255, required); + eds_ring_write(&s->front, padding, required); + free(padding); - status = eds_ring_init(&s->back, required); - if (status != SANE_STATUS_GOOD) { - return status; - } } - } - /* abort scanning when appropriate */ - if (status == SANE_STATUS_CANCELLED) { - esci2_can(s); - return status; } + { + int available = eds_ring_avail(&s->back); + if (available > 0 && available < needBytes) + { + int required = needBytes - available; + unsigned char* padding = (unsigned char*)malloc(required); + memset(padding, 255, required); + eds_ring_write(&s->back, padding, required); + free(padding); + } - if (s->eof && s->backside) { - DBG(18, "back side scan finished\n"); } - /* read again if no error and no data */ - if (read == 0 && status == SANE_STATUS_GOOD) { - goto read_again; + if (s->isDuplexScan) + { + upside_down_backside_image(s); } - /* got something, write to ring */ - if (read) { - - DBG(20, " %d bytes read, %d lines, eof: %d, canceling: %d, status: %d, backside: %d\n", - read, read / (s->params.bytes_per_line + s->dummy), - s->canceling, s->eof, status, s->backside); + DBG(20, "acquire_raw_data finish"); + return SANE_STATUS_GOOD; - /* move data to the appropriate ring */ - status = eds_ring_write(s->backside ? &s->back : &s->front, s->buf, read); +} - if (0 && s->mode_jpeg && !s->jpeg_header_seen - && status == SANE_STATUS_GOOD) { +static SANE_Status +acquire_and_decode_jpeg_data(epsonds_scanner* s) +{ + SANE_Int status = acquire_jpeg_data(s); + if (status == SANE_STATUS_GOOD) + { + DBG(20, "** %s: sane status = %d needToConvertBW = %d \n", __func__, status, s->needToConvertBW); + + // process front page + if (s->frontJpegBufLen > 0) + { + eds_decode_jpeg(s, s->frontJpegBuf, s->frontJpegBufLen, &s->front,0, s->needToConvertBW); + free(s->frontJpegBuf); + s->frontJpegBuf = NULL; + } + // process back page + if (s->backJpegBufLen > 0) + { + eds_decode_jpeg(s, s->backJpegBuf, s->backJpegBufLen, &s->back, 1, s->needToConvertBW); + free(s->backJpegBuf); + s->backJpegBuf = NULL; + } - status = eds_jpeg_read_header(s); - if (status != SANE_STATUS_GOOD && --tries) { - goto read_again; + if (s->isDuplexScan) + { + upside_down_backside_image(s); } + }else{ + DBG(20, "** %s: sane finish status = %d\n", __func__, status); + return status; } - } - - /* continue reading if appropriate */ - if (status == SANE_STATUS_GOOD) return status; +} - /* cleanup */ - DBG(5, "** %s: cleaning up\n", __func__); +int sumLength = 0; +/* this moves data from our buffers to SANE */ +SANE_Status +sane_read(SANE_Handle handle, SANE_Byte *data, SANE_Int max_length, SANE_Int *length) +{ + epsonds_scanner *s = (epsonds_scanner *)handle; + SANE_Int read = 0; - if (s->mode_jpeg) { - eds_jpeg_finish(s); + if (s->canceling) + { + esci2_can(s); + *length = 0; + return SANE_STATUS_CANCELLED; } - eds_ring_flush(s->current); + int available = eds_ring_avail(s->current); + /* anything in the buffer? pass it to the frontend */ + if (available > 0) { - return status; + DBG(18, "reading from ring buffer, %d left\n", available); + + eds_copy_image_from_ring(s, data, max_length, &read); + + // data is empty fin + if (read == 0) { + *length = 0; + eds_ring_flush(s->current); + eds_ring_destory(s->current); + DBG(18, "returns EOF 2\n"); + return SANE_STATUS_EOF; + } + *length = read; + + return SANE_STATUS_GOOD; + }else{ + *length = 0; + eds_ring_flush(s->current); + eds_ring_destory(s->current); + DBG(18, "returns EOF 1\n"); + return SANE_STATUS_EOF; + } } /* diff --git a/backend/epsonds.conf.in b/backend/epsonds.conf.in index 1967a00..e2880fa 100644 --- a/backend/epsonds.conf.in +++ b/backend/epsonds.conf.in @@ -10,7 +10,8 @@ usb # e.g.: # usb 0x4b8 0x14c -# Network (not yet supported!) +# +# Network # # net 192.168.1.123 -#net autodiscovery +net autodiscovery diff --git a/backend/epsonds.h b/backend/epsonds.h index 04cb724..7f1b650 100644 --- a/backend/epsonds.h +++ b/backend/epsonds.h @@ -66,9 +66,14 @@ #define TPU_STR SANE_I18N("Transparency Unit") #define ADF_STR SANE_I18N("Automatic Document Feeder") +#define STRING_FLATBED SANE_I18N("Flatbed") +#define STRING_ADFFRONT SANE_I18N("ADF Front") +#define STRING_ADFDUPLEX SANE_I18N("ADF Duplex") + enum { OPT_NUM_OPTS = 0, - OPT_MODE_GROUP, + OPT_STANDARD_GROUP, + OPT_SOURCE, OPT_MODE, OPT_DEPTH, OPT_RESOLUTION, @@ -78,11 +83,10 @@ enum { OPT_BR_X, OPT_BR_Y, OPT_EQU_GROUP, - OPT_SOURCE, OPT_EJECT, OPT_LOAD, - OPT_ADF_MODE, OPT_ADF_SKEW, + OPT_ADF_CRP, NUM_OPTIONS }; @@ -119,6 +123,8 @@ struct epsonds_device SANE_Bool has_raw; /* supports RAW format */ + SANE_Bool has_mono; /*supprt M001*/ + SANE_Bool has_fb; /* flatbed */ SANE_Range fbf_x_range; /* x range */ SANE_Range fbf_y_range; /* y range */ @@ -136,9 +142,13 @@ struct epsonds_device SANE_Byte adf_alignment; /* left, center, right */ SANE_Byte adf_has_dfd; /* supports double feed detection */ + SANE_Byte adf_has_crp; /* supports crp */ + SANE_Bool has_tpu; /* tpu */ SANE_Range tpu_x_range; /* transparency unit x range */ SANE_Range tpu_y_range; /* transparency unit y range */ + + SANE_Int lut_id; }; typedef struct epsonds_device epsonds_device; @@ -171,6 +181,10 @@ struct epsonds_scanner SANE_Int left, top, pages, dummy; + SANE_Int width_front, height_front; + SANE_Int width_back , height_back; + SANE_Int width_temp, height_temp; + /* jpeg stuff */ djpeg_dest_ptr jdst; @@ -181,7 +195,18 @@ struct epsonds_scanner /* network buffers */ unsigned char *netbuf, *netptr; size_t netlen; -}; + + SANE_Byte *frontJpegBuf, *backJpegBuf; + SANE_Int frontJpegBufLen, backJpegBufLen; + SANE_Int acquirePage; + + SANE_Int isflatbedScan; + SANE_Int isDuplexScan; + + SANE_Int needToConvertBW; + + SANE_Int scanEnd; + }; typedef struct epsonds_scanner epsonds_scanner; diff --git a/backend/escl.conf.in b/backend/escl.conf.in index 18ea516..8c6bb04 100644 --- a/backend/escl.conf.in +++ b/backend/escl.conf.in @@ -11,6 +11,11 @@ # You can also configure a device on a single line starting with 'device' # by writing a complete URL and an optional model name. + +# Name of the device not using the PDF format. Spaces are replaced by _. Please report the devices having this problem on sane-devel +# Uncomment the line to add your device +#pdfblacklist Brother_DCP-L2530DW_series + #device http://123.456.789.10:8080 OptionalModel1 #device https://123.456.789.10:443 "Optional Model 2" #device https://123.456.789.10:443 "HP Color LaserJet FlowMFP M578" "hack=localhost" diff --git a/backend/escl/escl.c b/backend/escl/escl.c index bb62219..5f02ec8 100644 --- a/backend/escl/escl.c +++ b/backend/escl/escl.c @@ -432,7 +432,8 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, int port = 0; SANE_Status status; static ESCL_Device *escl_device = NULL; - + if (*line == '#') return SANE_STATUS_GOOD; + if (!strncmp(line, "pdfblacklist", 12)) return SANE_STATUS_GOOD; if (strncmp(line, "device", 6) == 0) { char *name_str = NULL; char *opt_model = NULL; @@ -1135,6 +1136,37 @@ finish_hack: fclose(fp); } +static char* +_get_blacklist_pdf(void) +{ + FILE *fp; + char *blacklist = NULL; + SANE_Char line[PATH_MAX]; + + /* open configuration file */ + fp = sanei_config_open (ESCL_CONFIG_FILE); + if (!fp) + { + DBG (2, "_get_blacklit: couldn't access %s\n", ESCL_CONFIG_FILE); + DBG (3, "_get_blacklist: exit\n"); + } + + /* loop reading the configuration file, all line beginning by "option " are + * parsed for value to store in configuration structure, other line are + * used are device to try to attach + */ + while (sanei_config_read (line, PATH_MAX, fp)) + { + if (!strncmp(line, "pdfblacklist", 12)) { + blacklist = strdup(line); + goto finish_; + } + } +finish_: + DBG (3, "_get_blacklist_pdf: finish\n"); + fclose(fp); + return blacklist; +} /** @@ -1149,6 +1181,7 @@ finish_hack: SANE_Status sane_open(SANE_String_Const name, SANE_Handle *h) { + char *blacklist = NULL; DBG (10, "escl sane_open\n"); SANE_Status status; escl_sane_t *handler = NULL; @@ -1173,7 +1206,8 @@ sane_open(SANE_String_Const name, SANE_Handle *h) return (SANE_STATUS_NO_MEM); } handler->device = device; // Handler owns device now. - handler->scanner = escl_capabilities(device, &status); + blacklist = _get_blacklist_pdf(); + handler->scanner = escl_capabilities(device, blacklist, &status); if (status != SANE_STATUS_GOOD) { escl_free_handler(handler); return (status); @@ -1222,9 +1256,11 @@ sane_cancel(SANE_Handle h) } handler->scanner->work = SANE_FALSE; handler->cancel = SANE_TRUE; - escl_scanner(handler->device, handler->result); + escl_scanner(handler->device, handler->scanner->scanJob, handler->result); free(handler->result); handler->result = NULL; + free(handler->scanner->scanJob); + handler->scanner->scanJob = NULL; } /** @@ -1381,6 +1417,7 @@ sane_control_option(SANE_Handle h, SANE_Int n, SANE_Action a, void *v, SANE_Int break; case OPT_RESOLUTION: handler->val[n].w = _get_resolution(handler, (int)(*(SANE_Word *) v)); + handler->scanner->caps[handler->scanner->source].default_resolution = handler->val[n].w; if (i) *i |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS | SANE_INFO_INEXACT; break; @@ -1591,7 +1628,7 @@ sane_start(SANE_Handle h) return SANE_STATUS_NO_DOCS; } } - status = escl_scan(handler->scanner, handler->device, handler->result); + status = escl_scan(handler->scanner, handler->device, handler->scanner->scanJob, handler->result); if (status != SANE_STATUS_GOOD) return (status); if (!strcmp(handler->scanner->caps[handler->scanner->source].default_format, "image/jpeg")) diff --git a/backend/escl/escl.h b/backend/escl/escl.h index 67b11c7..142b4b4 100644 --- a/backend/escl/escl.h +++ b/backend/escl/escl.h @@ -156,6 +156,7 @@ typedef struct capabilities SANE_String_Const *Sources; int SourcesSize; FILE *tmp; + char *scanJob; unsigned char *img_data; long img_size; long img_read; @@ -230,6 +231,7 @@ SANE_Status escl_status(const ESCL_Device *device, SANE_Status *job); capabilities_t *escl_capabilities(ESCL_Device *device, + char *blacklist, SANE_Status *status); char *escl_newjob(capabilities_t *scanner, @@ -238,9 +240,11 @@ char *escl_newjob(capabilities_t *scanner, SANE_Status escl_scan(capabilities_t *scanner, const ESCL_Device *device, + char *scanJob, char *result); void escl_scanner(const ESCL_Device *device, + char *scanJob, char *result); typedef void CURL; diff --git a/backend/escl/escl_capabilities.c b/backend/escl/escl_capabilities.c index db194f9..7422896 100644 --- a/backend/escl/escl_capabilities.c +++ b/backend/escl/escl_capabilities.c @@ -40,6 +40,25 @@ struct cap size_t size; }; +static size_t +header_callback(void *str, size_t size, size_t nmemb, void *userp) +{ + struct cap *header = (struct cap *)userp; + size_t realsize = size * nmemb; + char *content = realloc(header->memory, header->size + realsize + 1); + + if (content == NULL) { + DBG( 1, "Not enough memory (realloc returned NULL)\n"); + return (0); + } + header->memory = content; + memcpy(&(header->memory[header->size]), str, realsize); + header->size = header->size + realsize; + header->memory[header->size] = 0; + return (realsize); +} + + /** * \fn static SANE_String_Const convert_elements(SANE_String_Const str) * \brief Function that converts the 'color modes' of the scanner (color/gray) to be understood by SANE. @@ -182,10 +201,10 @@ find_valor_of_array_variables(xmlNode *node, capabilities_t *scanner, int type) { const char *name = (const char *)node->name; if (strcmp(name, "ColorMode") == 0) { - const char *color = (SANE_String_Const)xmlNodeGetContent(node); - if (type == PLATEN || strcmp(color, "BlackAndWhite1")) + const char *color = (SANE_String_Const)xmlNodeGetContent(node); + if (type == PLATEN || strcmp(color, "BlackAndWhite1")) scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes, &scanner->caps[type].ColorModesSize, (SANE_String_Const)xmlNodeGetContent(node), 1); - } + } else if (strcmp(name, "ContentType") == 0) scanner->caps[type].ContentTypes = char_to_array(scanner->caps[type].ContentTypes, &scanner->caps[type].ContentTypesSize, (SANE_String_Const)xmlNodeGetContent(node), 0); else if (strcmp(name, "DocumentFormat") == 0) @@ -385,6 +404,16 @@ find_true_variables(xmlNode *node, capabilities_t *scanner, int type) return (0); } +static char* +replace_char(char* str, char find, char replace){ + char *current_pos = strchr(str,find); + while (current_pos) { + *current_pos = replace; + current_pos = strchr(current_pos,find); + } + return str; +} + /** * \fn static int print_xml_c(xmlNode *node, capabilities_t *scanner) * \brief Function that browses the xml file, node by node. @@ -454,6 +483,37 @@ _reduce_color_modes(capabilities_t *scanner) } } +static void +_delete_pdf(capabilities_t *scanner) +{ + int type = 0; + for (type = 0; type < 3; type++) { + if (scanner->caps[type].ColorModesSize) { + if (scanner->caps[type].default_format) { + scanner->caps[type].have_pdf = -1; + if (!strcmp(scanner->caps[type].default_format, "application/pdf")) { + free(scanner->caps[type].default_format); + if (scanner->caps[type].have_tiff > -1) + scanner->caps[type].default_format = strdup("image/tiff"); + else if (scanner->caps[type].have_png > -1) + scanner->caps[type].default_format = strdup("image/png"); + else if (scanner->caps[type].have_jpeg > -1) + scanner->caps[type].default_format = strdup("image/jpeg"); + } + free(scanner->caps[type].ColorModes); + scanner->caps[type].ColorModes = NULL; + scanner->caps[type].ColorModesSize = 0; + scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes, + &scanner->caps[type].ColorModesSize, + (SANE_String_Const)SANE_VALUE_SCAN_MODE_GRAY, 0); + scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes, + &scanner->caps[type].ColorModesSize, + (SANE_String_Const)SANE_VALUE_SCAN_MODE_COLOR, 0); + } + } + } +} + /** * \fn capabilities_t *escl_capabilities(const ESCL_Device *device, SANE_Status *status) * \brief Function that finally recovers all the capabilities of the scanner, using curl. @@ -463,15 +523,17 @@ _reduce_color_modes(capabilities_t *scanner) * \return scanner (the structure that stocks all the capabilities elements) */ capabilities_t * -escl_capabilities(ESCL_Device *device, SANE_Status *status) +escl_capabilities(ESCL_Device *device, char *blacklist, SANE_Status *status) { capabilities_t *scanner = (capabilities_t*)calloc(1, sizeof(capabilities_t)); CURL *curl_handle = NULL; struct cap *var = NULL; + struct cap *header = NULL; xmlDoc *data = NULL; xmlNode *node = NULL; int i = 0; const char *scanner_capabilities = "/eSCL/ScannerCapabilities"; + SANE_Bool use_pdf = SANE_TRUE; *status = SANE_STATUS_GOOD; if (device == NULL) @@ -481,11 +543,22 @@ escl_capabilities(ESCL_Device *device, SANE_Status *status) *status = SANE_STATUS_NO_MEM; var->memory = malloc(1); var->size = 0; + header = (struct cap *)calloc(1, sizeof(struct cap)); + if (header == NULL) + *status = SANE_STATUS_NO_MEM; + header->memory = malloc(1); + header->size = 0; curl_handle = curl_easy_init(); escl_curl_url(curl_handle, device, scanner_capabilities); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, memory_callback_c); curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)var); + curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, header_callback); + curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)header); + curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L); CURLcode res = curl_easy_perform(curl_handle); + if (res == CURLE_OK) + DBG( 1, "Create NewJob : the scanner header responded : [%s]\n", header->memory); if (res != CURLE_OK) { DBG( 1, "The scanner didn't respond: %s\n", curl_easy_strerror(res)); *status = SANE_STATUS_INVAL; @@ -503,18 +576,46 @@ escl_capabilities(ESCL_Device *device, SANE_Status *status) goto clean; } + if (device->hack && + header && + header->memory && + strstr(header->memory, "Server: HP_Compact_Server")) + device->hack = curl_slist_append(NULL, "Host: localhost"); + scanner->source = 0; scanner->Sources = (SANE_String_Const *)malloc(sizeof(SANE_String_Const) * 4); for (i = 0; i < 4; i++) scanner->Sources[i] = NULL; print_xml_c(node, device, scanner, -1); - _reduce_color_modes(scanner); + DBG (3, "1-blacklist_pdf: %s\n", (use_pdf ? "TRUE" : "FALSE") ); + if (device->model_name != NULL) { + if (strcasestr(device->model_name, "MFC-J985DW")) { + DBG (3, "blacklist_pdf: device not support PDF\n"); + use_pdf = SANE_FALSE; + } + else if (blacklist) { + char *model = strdup(device->model_name); + replace_char(model, ' ', '_'); + if (strcasestr(blacklist, model)) { + use_pdf = SANE_FALSE; + } + free(model); + } + } + DBG (3, "1-blacklist_pdf: %s\n", (use_pdf ? "TRUE" : "FALSE") ); + if (use_pdf) + _reduce_color_modes(scanner); + else + _delete_pdf(scanner); clean: xmlFreeDoc(data); clean_data: xmlCleanupParser(); xmlMemoryDump(); curl_easy_cleanup(curl_handle); + if (header) + free(header->memory); + free(header); if (var) free(var->memory); free(var); diff --git a/backend/escl/escl_devices.c b/backend/escl/escl_devices.c index 3ca28de..92e064b 100644 --- a/backend/escl/escl_devices.c +++ b/backend/escl/escl_devices.c @@ -74,6 +74,7 @@ resolve_callback(AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIndex interfac avahi_address_snprint(a, sizeof(a), address); t = avahi_string_list_to_string(txt); if (strstr(t, "\"rs=eSCL\"") || strstr(t, "\"rs=/eSCL\"")) { + char ip_add[PATH_MAX] = {0}; s = avahi_string_list_find(txt, "is"); if (s && s->size > 3) is = (const char*)s->text + 3; @@ -84,7 +85,14 @@ resolve_callback(AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIndex interfac uuid = (const char*)s->text + 5; else uuid = (const char*)NULL; - escl_device_add(port, name, a, is, uuid, (char*)type); + DBG (10, "resolve_callback [%s]\n", a); + if (strstr(a, "127.0.0.1") != NULL) { + snprintf(ip_add, sizeof(ip_add), "%s", "localhost"); + DBG (10,"resolve_callback fix redirect [localhost]\n"); + } + else + snprintf(ip_add, sizeof(ip_add), "%s", a); + escl_device_add(port, name, ip_add, is, uuid, (char*)type); } } } diff --git a/backend/escl/escl_jpeg.c b/backend/escl/escl_jpeg.c index 651e7c5..1dd3ec9 100644 --- a/backend/escl/escl_jpeg.c +++ b/backend/escl/escl_jpeg.c @@ -192,34 +192,41 @@ get_JPEG_data(capabilities_t *scanner, int *width, int *height, int *bps) cinfo.out_color_space = JCS_RGB; cinfo.quantize_colors = FALSE; jpeg_calc_output_dimensions(&cinfo); - if (cinfo.output_width < (unsigned int)scanner->caps[scanner->source].width) - scanner->caps[scanner->source].width = cinfo.output_width; - if (scanner->caps[scanner->source].pos_x < 0) - scanner->caps[scanner->source].pos_x = 0; - - if (cinfo.output_height < (unsigned int)scanner->caps[scanner->source].height) - scanner->caps[scanner->source].height = cinfo.output_height; - if (scanner->caps[scanner->source].pos_y < 0) - scanner->caps[scanner->source].pos_y = 0; + double ratio = (double)cinfo.output_width / (double)scanner->caps[scanner->source].width; + int rw = (int)((double)scanner->caps[scanner->source].width * ratio); + int rh = (int)((double)scanner->caps[scanner->source].height * ratio); + int rx = (int)((double)scanner->caps[scanner->source].pos_x * ratio); + int ry = (int)((double)scanner->caps[scanner->source].pos_y * ratio); + + + if (cinfo.output_width < (unsigned int)rw) + rw = cinfo.output_width; + if (rx < 0) + rx = 0; + + if (cinfo.output_height < (unsigned int)rh) + rh = cinfo.output_height; + if (ry < 0) + ry = 0; DBG(10, "1-JPEF Geometry [%dx%d|%dx%d]\n", - scanner->caps[scanner->source].pos_x, - scanner->caps[scanner->source].pos_y, - scanner->caps[scanner->source].width, - scanner->caps[scanner->source].height); - x_off = scanner->caps[scanner->source].pos_x; - if (x_off > (unsigned int)scanner->caps[scanner->source].width) { - w = scanner->caps[scanner->source].width; + rx, + ry, + rw, + rh); + x_off = rx; + if (x_off > (unsigned int)rw) { + w = rw; x_off = 0; } else - w = scanner->caps[scanner->source].width - x_off; - y_off = scanner->caps[scanner->source].pos_y; - if(y_off > (unsigned int)scanner->caps[scanner->source].height) { - h = scanner->caps[scanner->source].height; + w = rw - x_off; + y_off = ry; + if(y_off > (unsigned int)rh) { + h = rh; y_off = 0; } else - h = scanner->caps[scanner->source].height - y_off; + h = rh - y_off; DBG(10, "2-JPEF Geometry [%dx%d|%dx%d]\n", x_off, y_off, @@ -242,7 +249,7 @@ get_JPEG_data(capabilities_t *scanner, int *width, int *height, int *bps) if (y_off > 0) jpeg_skip_scanlines(&cinfo, y_off); pos = 0; - while (cinfo.output_scanline < (unsigned int)scanner->caps[scanner->source].height) { + while (cinfo.output_scanline < (unsigned int)rh) { rowptr[0] = (JSAMPROW)surface + (lineSize * pos); // ..cinfo.output_scanline); jpeg_read_scanlines(&cinfo, rowptr, (JDIMENSION) 1); pos++; @@ -253,7 +260,7 @@ get_JPEG_data(capabilities_t *scanner, int *width, int *height, int *bps) *width = w; *height = h; *bps = cinfo.output_components; - jpeg_finish_decompress(&cinfo); + // jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); fclose(scanner->tmp); scanner->tmp = NULL; diff --git a/backend/escl/escl_newjob.c b/backend/escl/escl_newjob.c index 24bfbc9..98a953f 100644 --- a/backend/escl/escl_newjob.c +++ b/backend/escl/escl_newjob.c @@ -277,6 +277,8 @@ wake_up_device: curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, upload->size); curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, download_callback); curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)download); + curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L); CURLcode res = curl_easy_perform(curl_handle); if (res != CURLE_OK) { DBG( 1, "Create NewJob : the scanner responded incorrectly: %s\n", curl_easy_strerror(res)); @@ -296,7 +298,17 @@ wake_up_device: result = strdup(location); DBG( 1, "Create NewJob : %s\n", result); *temporary = '\n'; + *location = '\0'; + location = strrchr(tmp_location,'/'); wakup_count = 0; + if (location) { + location++; + scanner->scanJob = strdup(location); + DBG( 1, "Full location header [%s]\n", scanner->scanJob); + } + else + scanner->scanJob = strdup("ScanJobs"); + *location = '/'; } } if (result == NULL) { diff --git a/backend/escl/escl_reset.c b/backend/escl/escl_reset.c index 7494dda..95e3f2d 100644 --- a/backend/escl/escl_reset.c +++ b/backend/escl/escl_reset.c @@ -44,10 +44,10 @@ write_callback(void __sane_unused__*str, * This function is called in the 'sane_cancel' function. */ void -escl_scanner(const ESCL_Device *device, char *result) +escl_scanner(const ESCL_Device *device, char *scanJob, char *result) { CURL *curl_handle = NULL; - const char *scan_jobs = "/eSCL/ScanJobs"; + const char *scan_jobs = "/eSCL/"; const char *scanner_start = "/NextDocument"; char scan_cmd[PATH_MAX] = { 0 }; int i = 0; @@ -58,10 +58,12 @@ escl_scanner(const ESCL_Device *device, char *result) CURL_CALL: curl_handle = curl_easy_init(); if (curl_handle != NULL) { - snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s", - scan_jobs, result, scanner_start); + snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s%s", + scan_jobs, scanJob, result, scanner_start); escl_curl_url(curl_handle, device, scan_cmd); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback); + curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L); if (curl_easy_perform(curl_handle) == CURLE_OK) { curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &answer); i++; diff --git a/backend/escl/escl_scan.c b/backend/escl/escl_scan.c index 53bd438..3350c83 100644 --- a/backend/escl/escl_scan.c +++ b/backend/escl/escl_scan.c @@ -57,10 +57,10 @@ write_callback(void *str, size_t size, size_t nmemb, void *userp) * \return status (if everything is OK, status = SANE_STATUS_GOOD, otherwise, SANE_STATUS_NO_MEM/SANE_STATUS_INVAL) */ SANE_Status -escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *result) +escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *scanJob, char *result) { CURL *curl_handle = NULL; - const char *scan_jobs = "/eSCL/ScanJobs"; + const char *scan_jobs = "/eSCL/"; const char *scanner_start = "/NextDocument"; char scan_cmd[PATH_MAX] = { 0 }; SANE_Status status = SANE_STATUS_GOOD; @@ -70,10 +70,12 @@ escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *result) scanner->real_read = 0; curl_handle = curl_easy_init(); if (curl_handle != NULL) { - snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s", - scan_jobs, result, scanner_start); + snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s%s", + scan_jobs, scanJob, result, scanner_start); escl_curl_url(curl_handle, device, scan_cmd); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback); + curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L); if (scanner->tmp) fclose(scanner->tmp); scanner->tmp = tmpfile(); diff --git a/backend/escl/escl_status.c b/backend/escl/escl_status.c index a68f6ea..1f848a2 100644 --- a/backend/escl/escl_status.c +++ b/backend/escl/escl_status.c @@ -220,6 +220,8 @@ reload: escl_curl_url(curl_handle, device, scanner_status); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, memory_callback_s); curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)var); + curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L); CURLcode res = curl_easy_perform(curl_handle); if (res != CURLE_OK) { DBG( 1, "The scanner didn't respond: %s\n", curl_easy_strerror(res)); diff --git a/backend/fujitsu.c b/backend/fujitsu.c index 6c1c8f6..d17e015 100644 --- a/backend/fujitsu.c +++ b/backend/fujitsu.c @@ -6,7 +6,7 @@ Copyright (C) 2000 Randolph Bentson Copyright (C) 2001 Frederik Ramm Copyright (C) 2001-2004 Oliver Schirrmeister - Copyright (C) 2003-2019 m. allan noah + Copyright (C) 2003-2021 m. allan noah JPEG output and low memory usage support funded by: Archivista GmbH, www.archivista.ch @@ -770,10 +770,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (10, "sane_init: start\n"); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (5, "sane_init: fujitsu backend %d.%d.%d, from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); sanei_magic_init(); diff --git a/backend/fujitsu.conf.in b/backend/fujitsu.conf.in index 8e2115f..1645e87 100644 --- a/backend/fujitsu.conf.in +++ b/backend/fujitsu.conf.in @@ -264,3 +264,6 @@ usb 0x04c5 0x160a #fi-7800 usb 0x04c5 0x160b + +#ScanSnap iX1600 +usb 0x04c5 0x1632 diff --git a/backend/genesys.conf.in b/backend/genesys.conf.in index 21506f6..d9c596a 100644 --- a/backend/genesys.conf.in +++ b/backend/genesys.conf.in @@ -131,6 +131,9 @@ usb 0x07b3 0x0900 # Plustek OpticFilm 7200 usb 0x07b3 0x0807 +# Plustek OpticFilm 7200 V2 +usb 0x07b3 0x0c07 + # Plustek OpticFilm 7200i usb 0x07b3 0x0c04 diff --git a/backend/genesys/calibration.h b/backend/genesys/calibration.h index fc82850..fd0f627 100644 --- a/backend/genesys/calibration.h +++ b/backend/genesys/calibration.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_CALIBRATION_H diff --git a/backend/genesys/command_set.h b/backend/genesys/command_set.h index 47bdfbd..b031a8c 100644 --- a/backend/genesys/command_set.h +++ b/backend/genesys/command_set.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_COMMAND_SET_H diff --git a/backend/genesys/device.cpp b/backend/genesys/device.cpp index 4b1940b..5411d7b 100644 --- a/backend/genesys/device.cpp +++ b/backend/genesys/device.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/device.h b/backend/genesys/device.h index f998714..842856b 100644 --- a/backend/genesys/device.h +++ b/backend/genesys/device.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_DEVICE_H diff --git a/backend/genesys/enums.cpp b/backend/genesys/enums.cpp index ce0ad10..460e73f 100644 --- a/backend/genesys/enums.cpp +++ b/backend/genesys/enums.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -279,6 +258,7 @@ std::ostream& operator<<(std::ostream& out, GpioId id) case GpioId::CANON_8600F: out << "CANON_8600F"; break; case GpioId::DP665: out << "DP665"; break; case GpioId::DP685: out << "DP685"; break; + case GpioId::G4010: out << "G4010"; break; case GpioId::G4050: out << "G4050"; break; case GpioId::HP2300: out << "HP2300"; break; case GpioId::HP2400: out << "HP2400"; break; diff --git a/backend/genesys/enums.h b/backend/genesys/enums.h index ae5dedd..88fc9c3 100644 --- a/backend/genesys/enums.h +++ b/backend/genesys/enums.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_ENUMS_H @@ -372,6 +351,7 @@ enum class GpioId : unsigned DP665, DP685, G4050, + G4010, HP2300, HP2400, HP3670, @@ -525,6 +505,9 @@ enum class ModelFlag : unsigned // disable fast feeding mode on this scanner DISABLE_FAST_FEEDING = 1 << 14, + // scan gray scans as color and combine on host side + HOST_SIDE_GRAY = 1 << 15, + // the scanner uses multi-segment sensors that must be handled during calibration SIS_SENSOR = 1 << 16, diff --git a/backend/genesys/error.cpp b/backend/genesys/error.cpp index e302e22..6f892de 100644 --- a/backend/genesys/error.cpp +++ b/backend/genesys/error.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/error.h b/backend/genesys/error.h index e95313f..93a428b 100644 --- a/backend/genesys/error.h +++ b/backend/genesys/error.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_ERROR_H diff --git a/backend/genesys/fwd.h b/backend/genesys/fwd.h index 89ca150..9937654 100644 --- a/backend/genesys/fwd.h +++ b/backend/genesys/fwd.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_FWD_H diff --git a/backend/genesys/genesys.cpp b/backend/genesys/genesys.cpp index 9552fa9..5aba58c 100644 --- a/backend/genesys/genesys.cpp +++ b/backend/genesys/genesys.cpp @@ -29,27 +29,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ /* @@ -674,9 +653,9 @@ void scanner_setup_sensor(Genesys_Device& dev, const Genesys_Sensor& sensor, regs.set8(custom_reg.address, custom_reg.value); } - if (dev.model->asic_type != AsicType::GL841 && - dev.model->asic_type != AsicType::GL843) + if (dev.model->asic_type != AsicType::GL843) { + // FIXME: remove the above check regs_set_exposure(dev.model->asic_type, regs, sensor.exposure); } @@ -795,6 +774,8 @@ void scanner_move(Genesys_Device& dev, ScanMethod scan_method, unsigned steps, D session.params.scan_method = scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::GREEN; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | @@ -959,6 +940,8 @@ void scanner_move_back_home(Genesys_Device& dev, bool wait_until_home) session.params.scan_method = dev.settings.scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::GREEN; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | @@ -1100,6 +1083,8 @@ void scanner_move_back_home_ta(Genesys_Device& dev) session.params.scan_method = scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::GREEN; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | @@ -1210,6 +1195,8 @@ void scanner_search_strip(Genesys_Device& dev, bool forward, bool black) session.params.scan_method = dev.settings.scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA; if (dev.model->asic_type != AsicType::GL841 && !forward) { @@ -1506,6 +1493,8 @@ void scanner_offset_calibration(Genesys_Device& dev, const Genesys_Sensor& senso session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev.model->asic_type == AsicType::GL843 ? ColorFilter::RED : dev.settings.color_filter; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = flags; compute_session(&dev, session, *calib_sensor); @@ -1815,6 +1804,8 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor& session.params.scan_method = dev.settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev.settings.color_filter; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = flags; compute_session(&dev, session, *calib_sensor); @@ -1873,7 +1864,8 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor& float curr_output = 0; float target_value = 0; - if (dev.model->asic_type == AsicType::GL842 || + if (dev.model->asic_type == AsicType::GL841 || + dev.model->asic_type == AsicType::GL842 || dev.model->asic_type == AsicType::GL843) { std::vector values; @@ -1889,18 +1881,6 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor& curr_output = static_cast(values[unsigned((values.size() - 1) * 0.95)]); target_value = calib_sensor->gain_white_ref * coeff; - } else if (dev.model->asic_type == AsicType::GL841) { - // FIXME: use the GL843 approach - unsigned max = 0; - for (std::size_t x = 0; x < image.get_width(); x++) { - auto value = image.get_raw_channel(x, 0, ch); - if (value > max) { - max = value; - } - } - - curr_output = max; - target_value = 65535.0f; } else { // FIXME: use the GL843 approach auto width = image.get_width(); @@ -1998,7 +1978,8 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor const auto& calib_sensor = sanei_genesys_find_sensor(&dev, resolution, channels, dev.settings.scan_method); - if (dev.model->asic_type == AsicType::GL845 || + if (dev.model->asic_type == AsicType::GL841 || + dev.model->asic_type == AsicType::GL845 || dev.model->asic_type == AsicType::GL846 || dev.model->asic_type == AsicType::GL847 || dev.model->asic_type == AsicType::GL124) @@ -2006,14 +1987,9 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor regs = dev.reg; // FIXME: apply this to all ASICs } - unsigned yres = resolution; - if (dev.model->asic_type == AsicType::GL841) { - yres = dev.settings.yres; // FIXME: remove this - } - ScanSession session; session.params.xres = resolution; - session.params.yres = yres; + session.params.yres = resolution; session.params.startx = 0; session.params.starty = 0; session.params.pixels = dev.model->x_size_calib_mm * resolution / MM_PER_INCH; @@ -2023,6 +1999,8 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor session.params.scan_method = dev.settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev.settings.color_filter; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::SINGLE_LINE | @@ -2032,27 +2010,14 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor dev.cmd_set->init_regs_for_scan_session(&dev, calib_sensor, ®s, session); - if (dev.model->asic_type == AsicType::GL841) { - dev.interface->write_registers(regs); // FIXME: remove this - } - std::uint16_t exp[3]; - if (dev.model->asic_type == AsicType::GL841) { - exp[0] = sensor.exposure.red; - exp[1] = sensor.exposure.green; - exp[2] = sensor.exposure.blue; - } else { - exp[0] = calib_sensor.exposure.red; - exp[1] = calib_sensor.exposure.green; - exp[2] = calib_sensor.exposure.blue; - } + exp[0] = calib_sensor.exposure.red; + exp[1] = calib_sensor.exposure.green; + exp[2] = calib_sensor.exposure.blue; std::uint16_t target = sensor.gain_white_ref * 256; - std::uint16_t min_exposure = 500; // only gl841 - std::uint16_t max_exposure = ((exp[0] + exp[1] + exp[2]) / 3) * 2; // only gl841 - std::uint16_t top[3] = {}; std::uint16_t bottom[3] = {}; @@ -2088,16 +2053,6 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor for (unsigned i_test = 0; i_test < 100 && !acceptable; ++i_test) { regs_set_exposure(dev.model->asic_type, regs, { exp[0], exp[1], exp[2] }); - if (dev.model->asic_type == AsicType::GL841) { - // FIXME: remove - dev.interface->write_register(0x10, (exp[0] >> 8) & 0xff); - dev.interface->write_register(0x11, exp[0] & 0xff); - dev.interface->write_register(0x12, (exp[1] >> 8) & 0xff); - dev.interface->write_register(0x13, exp[1] & 0xff); - dev.interface->write_register(0x14, (exp[2] >> 8) & 0xff); - dev.interface->write_register(0x15, exp[2] & 0xff); - } - dev.interface->write_registers(regs); dbg.log(DBG_info, "starting line reading"); @@ -2108,15 +2063,13 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor if (dev.model->asic_type == AsicType::GL841) { scanner_stop_action(dev); dev.cmd_set->move_back_home(&dev, true); - return { exp[0], exp[1], exp[2] }; } else if (dev.model->asic_type == AsicType::GL124) { scanner_stop_action(dev); - return calib_sensor.exposure; } else { scanner_stop_action(dev); dev.cmd_set->move_back_home(&dev, true); - return calib_sensor.exposure; } + return { exp[0], exp[1], exp[2] }; } auto image = read_unshuffled_image_from_scanner(&dev, session, session.output_line_bytes); @@ -2142,57 +2095,8 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor acceptable = true; - if (dev.model->asic_type == AsicType::GL841) { - if (avg[0] < avg[1] * 0.95 || avg[1] < avg[0] * 0.95 || - avg[0] < avg[2] * 0.95 || avg[2] < avg[0] * 0.95 || - avg[1] < avg[2] * 0.95 || avg[2] < avg[1] * 0.95) - { - acceptable = false; - } - - // led exposure is not acceptable if white level is too low. - // ~80 hardcoded value for white level - if (avg[0] < 20000 || avg[1] < 20000 || avg[2] < 20000) { - acceptable = false; - } - - // for scanners using target value - if (target > 0) { - acceptable = true; - for (unsigned i = 0; i < 3; i++) { - // we accept +- 2% delta from target - if (std::abs(avg[i] - target) > target / 50) { - exp[i] = (exp[i] * target) / avg[i]; - acceptable = false; - } - } - } else { - if (!acceptable) { - unsigned avga = (avg[0] + avg[1] + avg[2]) / 3; - exp[0] = (exp[0] * avga) / avg[0]; - exp[1] = (exp[1] * avga) / avg[1]; - exp[2] = (exp[2] * avga) / avg[2]; - /* Keep the resulting exposures below this value. Too long exposure drives - the ccd into saturation. We may fix this by relying on the fact that - we get a striped scan without shading, by means of statistical calculation - */ - unsigned avge = (exp[0] + exp[1] + exp[2]) / 3; - - if (avge > max_exposure) { - exp[0] = (exp[0] * max_exposure) / avge; - exp[1] = (exp[1] * max_exposure) / avge; - exp[2] = (exp[2] * max_exposure) / avge; - } - if (avge < min_exposure) { - exp[0] = (exp[0] * min_exposure) / avge; - exp[1] = (exp[1] * min_exposure) / avge; - exp[2] = (exp[2] * min_exposure) / avge; - } - - } - } - } else if (dev.model->asic_type == AsicType::GL845 || - dev.model->asic_type == AsicType::GL846) + if (dev.model->asic_type == AsicType::GL845 || + dev.model->asic_type == AsicType::GL846) { for (unsigned i = 0; i < 3; i++) { if (avg[i] < bottom[i]) { @@ -2225,7 +2129,9 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor acceptable = false; } } - } else if (dev.model->asic_type == AsicType::GL124) { + } else if (dev.model->asic_type == AsicType::GL841 || + dev.model->asic_type == AsicType::GL124) + { for (unsigned i = 0; i < 3; i++) { // we accept +- 2% delta from target if (std::abs(avg[i] - target) > target / 50) { @@ -4366,12 +4272,6 @@ static Genesys_Settings calculate_scan_settings(Genesys_Scanner* s) settings.color_filter = ColorFilter::NONE; } - if (s->color_filter == "None") { - settings.true_gray = 1; - } else { - settings.true_gray = 0; - } - // brightness and contrast only for for 8 bit scans if (s->bit_depth == 8) { settings.contrast = (s->contrast * 127) / 100; @@ -4992,16 +4892,28 @@ static void init_options(Genesys_Scanner* s) s->opt[OPT_POWER_SW].cap = SANE_CAP_INACTIVE; /* extra button */ - s->opt[OPT_EXTRA_SW].name = "extra"; - s->opt[OPT_EXTRA_SW].title = SANE_I18N ("Extra button"); - s->opt[OPT_EXTRA_SW].desc = SANE_I18N ("Extra button"); - s->opt[OPT_EXTRA_SW].type = SANE_TYPE_BOOL; - s->opt[OPT_EXTRA_SW].unit = SANE_UNIT_NONE; - if (model->buttons & GENESYS_HAS_EXTRA_SW) - s->opt[OPT_EXTRA_SW].cap = - SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED; - else - s->opt[OPT_EXTRA_SW].cap = SANE_CAP_INACTIVE; + s->opt[OPT_EXTRA_SW].name = "extra"; + s->opt[OPT_EXTRA_SW].title = SANE_I18N("Extra button"); + s->opt[OPT_EXTRA_SW].desc = SANE_I18N("Extra button"); + s->opt[OPT_EXTRA_SW].type = SANE_TYPE_BOOL; + s->opt[OPT_EXTRA_SW].unit = SANE_UNIT_NONE; + if (model->buttons & GENESYS_HAS_EXTRA_SW) { + s->opt[OPT_EXTRA_SW].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED; + } else { + s->opt[OPT_EXTRA_SW].cap = SANE_CAP_INACTIVE; + } + + // transparency/scan_film button + s->opt[OPT_TRANSP_SW].name = "transparency"; + s->opt[OPT_TRANSP_SW].title = SANE_I18N ("Transparency button"); + s->opt[OPT_TRANSP_SW].desc = SANE_I18N ("Transparency button"); + s->opt[OPT_TRANSP_SW].type = SANE_TYPE_BOOL; + s->opt[OPT_TRANSP_SW].unit = SANE_UNIT_NONE; + if (model->buttons & GENESYS_HAS_TRANSP_SW) { + s->opt[OPT_TRANSP_SW].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED; + } else { + s->opt[OPT_TRANSP_SW].cap = SANE_CAP_INACTIVE; + } /* calibration needed */ s->opt[OPT_NEED_CALIBRATION_SW].name = "need-calibration"; @@ -5231,7 +5143,7 @@ static void probe_genesys_devices() of Genesys_Calibration_Cache as is. */ static const char* CALIBRATION_IDENT = "sane_genesys"; -static const int CALIBRATION_VERSION = 31; +static const int CALIBRATION_VERSION = 32; bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration, const std::string& path) @@ -5821,6 +5733,7 @@ static void get_option_value(Genesys_Scanner* s, int option, void* val) case OPT_OCR_SW: case OPT_POWER_SW: case OPT_EXTRA_SW: + case OPT_TRANSP_SW: s->dev->cmd_set->update_hardware_sensors(s); *reinterpret_cast(val) = s->buttons[genesys_option_to_button(option)].read(); break; @@ -6456,6 +6369,7 @@ GenesysButtonName genesys_option_to_button(int option) case OPT_OCR_SW: return BUTTON_OCR_SW; case OPT_POWER_SW: return BUTTON_POWER_SW; case OPT_EXTRA_SW: return BUTTON_EXTRA_SW; + case OPT_TRANSP_SW: return BUTTON_TRANSP_SW; default: throw std::runtime_error("Unknown option to convert to button index"); } } diff --git a/backend/genesys/genesys.h b/backend/genesys/genesys.h index 19d6feb..272beaa 100644 --- a/backend/genesys/genesys.h +++ b/backend/genesys/genesys.h @@ -19,27 +19,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef GENESYS_H @@ -124,6 +103,7 @@ enum Genesys_Option OPT_OCR_SW, OPT_POWER_SW, OPT_EXTRA_SW, + OPT_TRANSP_SW, OPT_NEED_CALIBRATION_SW, OPT_BUTTON_GROUP, OPT_CALIBRATE, @@ -144,6 +124,7 @@ enum GenesysButtonName : unsigned { BUTTON_OCR_SW, BUTTON_POWER_SW, BUTTON_EXTRA_SW, + BUTTON_TRANSP_SW, NUM_BUTTONS }; diff --git a/backend/genesys/gl124.cpp b/backend/genesys/gl124.cpp index ed733b8..1fa4d99 100644 --- a/backend/genesys/gl124.cpp +++ b/backend/genesys/gl124.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -113,7 +92,7 @@ gl124_init_registers (Genesys_Device * dev) dev->reg.init_reg(0x09, 0x00); dev->reg.init_reg(0x0a, 0xc0); dev->reg.init_reg(0x0b, 0x2a); - dev->reg.init_reg(0x0c, 0x12); + dev->reg.init_reg(0x0c, 0x12); // SENSOR_DEF dev->reg.init_reg(0x11, 0x00); dev->reg.init_reg(0x12, 0x00); dev->reg.init_reg(0x13, 0x0f); @@ -453,7 +432,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, ScanFlag flags) { DBG_HELPER(dbg); - int use_fast_fed; unsigned int lincnt, fast_dpi; unsigned int feedl,dist; uint32_t z1, z2; @@ -467,9 +445,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, feed_steps, static_cast(scan_mode), static_cast(flags)); - /* we never use fast fed since we do manual feed for the scans */ - use_fast_fed=0; - /* enforce motor minimal scan speed * @TODO extend motor struct for this value */ if (scan_mode == ScanColorMode::COLOR_SINGLE_PASS) @@ -516,12 +491,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, /* compute register 02 value */ uint8_t r02 = REG_0x02_NOTHOME; - if (use_fast_fed) { - r02 |= REG_0x02_FASTFED; - } else { - r02 &= ~REG_0x02_FASTFED; - } - if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) { r02 |= REG_0x02_AGOHOME; } @@ -573,9 +542,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, if (has_flag(flags, ScanFlag::FEEDING)) { dist *= 2; } - if (use_fast_fed) { - dist += fast_table.table.size() * 2; - } /* get sure we don't use insane value */ if (dist < feedl) { @@ -587,7 +553,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, reg->set24(REG_FEEDL, feedl); /* doesn't seem to matter that much */ - sanei_genesys_calculate_zmod(use_fast_fed, + sanei_genesys_calculate_zmod(false, scan_exposure_time, scan_table.table, scan_table.table.size(), @@ -815,6 +781,8 @@ ScanSession CommandSetGl124::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::NONE; compute_session(dev, session, sensor); @@ -983,6 +951,8 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::DISABLE_BUFFER_FULL_MOVE; @@ -1116,6 +1086,8 @@ void move_to_calibration_area(Genesys_Device* dev, const Genesys_Sensor& sensor, session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::SINGLE_LINE | @@ -1202,6 +1174,8 @@ void CommandSetGl124::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, sensor); diff --git a/backend/genesys/gl124.h b/backend/genesys/gl124.h index b722e67..02b733b 100644 --- a/backend/genesys/gl124.h +++ b/backend/genesys/gl124.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL124_H diff --git a/backend/genesys/gl124_registers.h b/backend/genesys/gl124_registers.h index 66c5fda..dfc25f6 100644 --- a/backend/genesys/gl124_registers.h +++ b/backend/genesys/gl124_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL124_REGISTERS_H diff --git a/backend/genesys/gl646.cpp b/backend/genesys/gl646.cpp index acc1a4b..bdde703 100644 --- a/backend/genesys/gl646.cpp +++ b/backend/genesys/gl646.cpp @@ -23,27 +23,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -605,7 +584,9 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene } /* true CIS gray if needed */ - if (dev->model->is_cis && session.params.channels == 1 && dev->settings.true_gray) { + if (dev->model->is_cis && session.params.channels == 1 && + session.params.color_filter == ColorFilter::NONE) + { regs->find_reg(0x05).value |= REG_0x05_LEDADD; } else { regs->find_reg(0x05).value &= ~REG_0x05_LEDADD; @@ -1707,6 +1688,8 @@ void CommandSetGl646::move_back_home(Genesys_Device* dev, bool wait_until_home) session.params.scan_method = dev->model->default_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::REVERSE | ScanFlag::AUTO_GO_HOME | ScanFlag::DISABLE_GAMMA; @@ -1823,6 +1806,8 @@ void CommandSetGl646::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::IGNORE_COLOR_OFFSET | @@ -1931,6 +1916,8 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = scan_mode; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; @@ -2110,6 +2097,8 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor& session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; @@ -2222,6 +2211,8 @@ void CommandSetGl646::offset_calibration(Genesys_Device* dev, const Genesys_Sens session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; @@ -2373,6 +2364,8 @@ void CommandSetGl646::coarse_gain_calibration(Genesys_Device* dev, const Genesys session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; @@ -2485,6 +2478,8 @@ void CommandSetGl646::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = 0; + session.params.brightness_adjustment = 0; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { @@ -2966,6 +2961,8 @@ ScanSession CommandSetGl646::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; session.params.flags = ScanFlag::AUTO_GO_HOME; if (settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; diff --git a/backend/genesys/gl646.h b/backend/genesys/gl646.h index e4c8d6b..04e5fb2 100644 --- a/backend/genesys/gl646.h +++ b/backend/genesys/gl646.h @@ -19,27 +19,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL646_H diff --git a/backend/genesys/gl646_registers.h b/backend/genesys/gl646_registers.h index 1c50888..b20bdbd 100644 --- a/backend/genesys/gl646_registers.h +++ b/backend/genesys/gl646_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL646_REGISTERS_H diff --git a/backend/genesys/gl841.cpp b/backend/genesys/gl841.cpp index 62e0e9d..27a6a36 100644 --- a/backend/genesys/gl841.cpp +++ b/backend/genesys/gl841.cpp @@ -25,27 +25,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -149,15 +128,6 @@ gl841_init_registers (Genesys_Device * dev) dev->reg.init_reg(0x13, 0x00); // SENSOR_DEF dev->reg.init_reg(0x14, 0x00); // SENSOR_DEF dev->reg.init_reg(0x15, 0x00); // SENSOR_DEF - if (dev->model->model_id == ModelId::CANON_LIDE_80) { - dev->reg.init_reg(0x10, 0x40); - dev->reg.init_reg(0x11, 0x00); - dev->reg.init_reg(0x12, 0x40); - dev->reg.init_reg(0x13, 0x00); - dev->reg.init_reg(0x14, 0x40); - dev->reg.init_reg(0x15, 0x00); - } - dev->reg.init_reg(0x16, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below dev->reg.init_reg(0x17, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below dev->reg.init_reg(0x18, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below @@ -184,36 +154,21 @@ gl841_init_registers (Genesys_Device * dev) dev->reg.init_reg(0x27, 0x00); dev->reg.init_reg(0x29, 0xff); - dev->reg.init_reg(0x2c, 0x00); - dev->reg.init_reg(0x2d, 0x00); - if (dev->model->model_id == ModelId::CANON_LIDE_80) { - dev->reg.init_reg(0x2c, sensor.full_resolution >> 8); - dev->reg.init_reg(0x2d, sensor.full_resolution & 0xff); - } + dev->reg.init_reg(0x2c, 0x02); // DPISET: overwritten during scanner setup + dev->reg.init_reg(0x2d, 0x58); // DPISET: overwritten during scanner setup dev->reg.init_reg(0x2e, 0x80); dev->reg.init_reg(0x2f, 0x80); - dev->reg.init_reg(0x30, 0x00); - dev->reg.init_reg(0x31, 0x00); - dev->reg.init_reg(0x32, 0x00); - dev->reg.init_reg(0x33, 0x00); - dev->reg.init_reg(0x34, 0x00); - dev->reg.init_reg(0x35, 0x00); - dev->reg.init_reg(0x36, 0x00); - dev->reg.init_reg(0x37, 0x00); - dev->reg.init_reg(0x38, 0x4f); - dev->reg.init_reg(0x39, 0xc1); - if (dev->model->model_id == ModelId::CANON_LIDE_80) { - dev->reg.init_reg(0x31, 0x10); - dev->reg.init_reg(0x32, 0x15); - dev->reg.init_reg(0x33, 0x0e); - dev->reg.init_reg(0x34, 0x40); - dev->reg.init_reg(0x35, 0x00); - dev->reg.init_reg(0x36, 0x2a); - dev->reg.init_reg(0x37, 0x30); - dev->reg.init_reg(0x38, 0x2a); - dev->reg.init_reg(0x39, 0xf8); - } + dev->reg.init_reg(0x30, 0x00); // STRPIXEL: overwritten during scanner setup + dev->reg.init_reg(0x31, 0x00); // STRPIXEL: overwritten during scanner setup + dev->reg.init_reg(0x32, 0x00); // ENDPIXEL: overwritten during scanner setup + dev->reg.init_reg(0x33, 0x00); // ENDPIXEL: overwritten during scanner setup + dev->reg.init_reg(0x34, 0x00); // DUMMY: overwritten during scanner setup + dev->reg.init_reg(0x35, 0x00); // MAXWD: overwritten during scanner setup + dev->reg.init_reg(0x36, 0x00); // MAXWD: overwritten during scanner setup + dev->reg.init_reg(0x37, 0x00); // MAXWD: overwritten during scanner setup + dev->reg.init_reg(0x38, 0x4f); // LPERIOD: overwritten during scanner setup + dev->reg.init_reg(0x39, 0xc1); // LPERIOD: overwritten during scanner setup dev->reg.init_reg(0x3d, 0x00); dev->reg.init_reg(0x3e, 0x00); @@ -330,11 +285,6 @@ gl841_init_registers (Genesys_Device * dev) dev->interface->write_0x8c(0x10, 0x94); dev->interface->write_register(0x09, 0x10); - - // FIXME: the following code originally changed 0x6b, but due to bug the 0x6c register was - // effectively changed. The current behavior matches the old code, but should probably be fixed. - dev->reg.find_reg(0x6c).value |= REG_0x6B_GPO18; - dev->reg.find_reg(0x6c).value &= ~REG_0x6B_GPO17; } } @@ -541,7 +491,6 @@ static void gl841_init_motor_regs_feed(Genesys_Device* dev, const Genesys_Sensor { DBG_HELPER_ARGS(dbg, "feed_steps=%d, flags=%x", feed_steps, static_cast(flags)); unsigned step_multiplier = 2; - int use_fast_fed = 0; unsigned int feedl; /*number of scan lines to add in a scan_lines line*/ @@ -572,10 +521,6 @@ static void gl841_init_motor_regs_feed(Genesys_Device* dev, const Genesys_Sensor // BUG: fast table is counted in base_ydpi / 4 feedl = feed_steps - fast_table.table.size() * 2; - use_fast_fed = 1; - if (has_flag(dev->model->flags, ModelFlag::DISABLE_FAST_FEEDING)) { - use_fast_fed = false; - } reg->set8(0x3d, (feedl >> 16) & 0xf); reg->set8(0x3e, (feedl >> 8) & 0xff); @@ -590,10 +535,6 @@ static void gl841_init_motor_regs_feed(Genesys_Device* dev, const Genesys_Sensor reg->find_reg(0x02).value &= ~0x80; /*NOT_HOME OFF*/ reg->find_reg(0x02).value |= REG_0x02_MTRPWR; - - if (use_fast_fed) - reg->find_reg(0x02).value |= 0x08; - else reg->find_reg(0x02).value &= ~0x08; if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) { @@ -640,9 +581,6 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor unsigned step_multiplier = 2; - int use_fast_fed = 0; - unsigned int fast_time; - unsigned int slow_time; unsigned int feedl; unsigned int min_restep = 0x20; @@ -679,54 +617,11 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor fast_table.slice_steps(max_fast_slope_steps_count, step_multiplier); } - /* fast fed special cases handling */ - if (dev->model->gpio_id == GpioId::XP300 - || dev->model->gpio_id == GpioId::DP685) - { - /* quirk: looks like at least this scanner is unable to use - 2-feed mode */ - use_fast_fed = 0; - } - else if (feed_steps < fast_table.table.size() * 2 + - (slow_table.table.size() >> static_cast(motor_profile.step_type))) - { - use_fast_fed = 0; - DBG(DBG_info, "%s: feed too short, slow move forced.\n", __func__); - } else { -/* for deciding whether we should use fast mode we need to check how long we - need for (fast)accelerating, moving, decelerating, (TODO: stopping?) - (slow)accelerating again versus (slow)accelerating and moving. we need - fast and slow tables here. -*/ -/*NOTE: scan_exposure_time is per scan_yres*/ -/*NOTE: fast_exposure is per base_ydpi/4*/ -/*we use full steps as base unit here*/ - fast_time = - (fast_table.table.back() << static_cast(fast_profile->step_type)) / 4 * - (feed_steps - fast_table.table.size()*2 - - (slow_table.table.size() >> static_cast(motor_profile.step_type))) - + fast_table.pixeltime_sum() * 2 + slow_table.pixeltime_sum(); - slow_time = - (scan_exposure_time * scan_yres) / dev->motor.base_ydpi * - (feed_steps - (slow_table.table.size() >> static_cast(motor_profile.step_type))) - + slow_table.pixeltime_sum(); - - use_fast_fed = fast_time < slow_time; - } - - if (has_flag(dev->model->flags, ModelFlag::DISABLE_FAST_FEEDING)) { - use_fast_fed = false; - } - - if (use_fast_fed) { - feedl = feed_steps - fast_table.table.size() * 2 - - (slow_table.table.size() >> static_cast(motor_profile.step_type)); - } else if ((feed_steps << static_cast(motor_profile.step_type)) < slow_table.table.size()) { + if ((feed_steps << static_cast(motor_profile.step_type)) < slow_table.table.size()) { feedl = 0; } else { feedl = (feed_steps << static_cast(motor_profile.step_type)) - slow_table.table.size(); } - DBG(DBG_info, "%s: Decided to use %s mode\n", __func__, use_fast_fed?"fast feed":"slow feed"); reg->set8(0x3d, (feedl >> 16) & 0xf); reg->set8(0x3e, (feedl >> 8) & 0xff); @@ -743,9 +638,6 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor reg->find_reg(0x02).value &= ~REG_0x02_MTRREV; } - if (use_fast_fed) - reg->find_reg(0x02).value |= 0x08; - else reg->find_reg(0x02).value &= ~0x08; if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) @@ -819,8 +711,6 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens const ScanSession& session) { DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time); - uint16_t expavg, expr, expb, expg; - dev->cmd_set->set_fe(dev, sensor, AFE_SET); /* gpio part.*/ @@ -876,11 +766,7 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens /* AFEMOD should depend on FESET, and we should set these * bits separately */ reg->find_reg(0x04).value &= ~(REG_0x04_FILTER | REG_0x04_AFEMOD); - if (has_flag(session.params.flags, ScanFlag::ENABLE_LEDADD)) { - reg->find_reg(0x04).value |= 0x10; /* no filter */ - } - else if (session.params.channels == 1) - { + if (session.params.channels == 1) { switch (session.params.color_filter) { case ColorFilter::RED: @@ -910,23 +796,6 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens /* CIS scanners can do true gray by setting LEDADD */ reg->find_reg(0x87).value &= ~REG_0x87_LEDADD; - if (has_flag(session.params.flags, ScanFlag::ENABLE_LEDADD)) { - reg->find_reg(0x87).value |= REG_0x87_LEDADD; - expr = reg->get16(REG_EXPR); - expg = reg->get16(REG_EXPG); - expb = reg->get16(REG_EXPB); - - /* use minimal exposure for best image quality */ - expavg = expg; - if (expr < expg) - expavg = expr; - if (expb < expavg) - expavg = expb; - - dev->reg.set16(REG_EXPR, expavg); - dev->reg.set16(REG_EXPG, expavg); - dev->reg.set16(REG_EXPB, expavg); - } // enable gamma tables if (should_enable_gamma(session, sensor)) { @@ -946,27 +815,6 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens reg->set8(0x34, sensor.dummy_pixel); } -static int -gl841_get_led_exposure(Genesys_Device * dev, const Genesys_Sensor& sensor) -{ - int d,r,g,b,m; - if (!dev->model->is_cis) - return 0; - d = dev->reg.find_reg(0x19).value; - - r = sensor.exposure.red; - g = sensor.exposure.green; - b = sensor.exposure.blue; - - m = r; - if (m < g) - m = g; - if (m < b) - m = b; - - return m + d; -} - /** @brief compute exposure time * Compute exposure time for the device and the given scan resolution */ @@ -975,9 +823,13 @@ static int gl841_exposure_time(Genesys_Device *dev, const Genesys_Sensor& sensor int start, int used_pixels) { -int led_exposure; - - led_exposure=gl841_get_led_exposure(dev, sensor); + int led_exposure = 0; + if (dev->model->is_cis) { + unsigned dummy = dev->reg.find_reg(0x19).value; + unsigned max_sensor_exposure = std::max({sensor.exposure.red, sensor.exposure.green, + sensor.exposure.blue}); + led_exposure = dummy + max_sensor_exposure; + } return sanei_genesys_exposure_time2(dev, profile, slope_dpi, start + used_pixels,/*+tgtime? currently done in sanei_genesys_exposure_time2 with tgtime = 32 pixel*/ led_exposure); @@ -1069,6 +921,9 @@ dummy \ scanned lines dev->total_bytes_read = 0; dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; + if (session.use_host_side_gray) { + dev->total_bytes_to_read /= 3; + } DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read); } @@ -1106,19 +961,6 @@ ScanSession CommandSetGl841::calculate_scan_session(const Genesys_Device* dev, start += dev->settings.tl_x; start = static_cast((start * dev->settings.xres) / MM_PER_INCH); - // we enable true gray for cis scanners only, and just when doing - // scan since color calibration is OK for this mode - ScanFlag flags = ScanFlag::NONE; - - // true gray (led add for cis scanners) - if (dev->model->is_cis && dev->settings.true_gray && - dev->settings.scan_mode != ScanColorMode::COLOR_SINGLE_PASS && - dev->model->sensor_id != SensorId::CIS_CANON_LIDE_80) - { - // on Lide 80 the LEDADD bit results in only red LED array being lit - flags |= ScanFlag::ENABLE_LEDADD; - } - ScanSession session; session.params.xres = dev->settings.xres; session.params.yres = dev->settings.yres; @@ -1132,7 +974,9 @@ ScanSession CommandSetGl841::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = dev->settings.scan_mode; session.params.color_filter = dev->settings.color_filter; - session.params.flags = flags; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; + session.params.flags = ScanFlag::NONE; compute_session(dev, session, sensor); return session; @@ -1613,6 +1457,8 @@ void CommandSetGl841::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA; compute_session(dev, session, calib_sensor); @@ -1690,6 +1536,8 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor& session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::SINGLE_LINE | @@ -1760,14 +1608,10 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor& turn++; } while ((top-bottom)>1 && turn < 100); - // FIXME: don't overwrite the calibrated values - dev->frontend.set_offset(0, 0); - dev->frontend.set_offset(1, 0); - dev->frontend.set_offset(2, 0); - DBG(DBG_info, "%s: offset=(%d,%d,%d)\n", __func__, - dev->frontend.get_offset(0), - dev->frontend.get_offset(1), - dev->frontend.get_offset(2)); + DBG(DBG_info, "%s: offset=(%d,%d,%d)\n", __func__, + dev->frontend.get_offset(0), + dev->frontend.get_offset(1), + dev->frontend.get_offset(2)); } /* this function does the offset calibration by scanning one line of the calibration @@ -1811,6 +1655,8 @@ void CommandSetGl841::offset_calibration(Genesys_Device* dev, const Genesys_Sens session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::SINGLE_LINE | @@ -2160,6 +2006,8 @@ void CommandSetGl841::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = 0; + session.params.brightness_adjustment = 0; session.params.flags = flags; compute_session(dev, session, sensor); diff --git a/backend/genesys/gl841.h b/backend/genesys/gl841.h index dbe2e59..64b23c8 100644 --- a/backend/genesys/gl841.h +++ b/backend/genesys/gl841.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #include "genesys.h" diff --git a/backend/genesys/gl841_registers.h b/backend/genesys/gl841_registers.h index a8d924d..0a59aac 100644 --- a/backend/genesys/gl841_registers.h +++ b/backend/genesys/gl841_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL841_REGISTERS_H diff --git a/backend/genesys/gl842.cpp b/backend/genesys/gl842.cpp index 9d3da67..a593040 100644 --- a/backend/genesys/gl842.cpp +++ b/backend/genesys/gl842.cpp @@ -17,9 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. */ #define DEBUG_DECLARE_ONLY @@ -629,6 +626,8 @@ ScanSession CommandSetGl842::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; session.params.flags = flags; compute_session(dev, session, sensor); @@ -823,6 +822,8 @@ void CommandSetGl842::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = dev->settings.scan_mode; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, calib_sensor); @@ -916,6 +917,8 @@ void CommandSetGl842::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = 0; + session.params.brightness_adjustment = 0; session.params.flags = flags; compute_session(dev, session, calib_sensor); diff --git a/backend/genesys/gl842.h b/backend/genesys/gl842.h index b20ef5e..3636bac 100644 --- a/backend/genesys/gl842.h +++ b/backend/genesys/gl842.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #include "genesys.h" diff --git a/backend/genesys/gl842_registers.h b/backend/genesys/gl842_registers.h index ceb540b..7c5957a 100644 --- a/backend/genesys/gl842_registers.h +++ b/backend/genesys/gl842_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_gl842_REGISTERS_H diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index e768ac0..6180bf9 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -1122,6 +1101,8 @@ ScanSession CommandSetGl843::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; session.params.flags = flags; compute_session(dev, session, sensor); @@ -1240,6 +1221,7 @@ void CommandSetGl843::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens dev->interface->write_register(0x7e, 0x04); break; case GpioId::G4050: + case GpioId::G4010: dev->interface->write_register(REG_0xA7, 0xfe); dev->interface->write_register(REG_0xA8, 0x3e); dev->interface->write_register(REG_0xA9, 0x06); @@ -1432,6 +1414,8 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = dev->settings.scan_mode; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, calib_sensor); @@ -1535,6 +1519,8 @@ void CommandSetGl843::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = 0; + session.params.brightness_adjustment = 0; session.params.flags = flags; compute_session(dev, session, calib_sensor); @@ -1680,6 +1666,7 @@ void CommandSetGl843::update_hardware_sensors(Genesys_Scanner* s) const */ uint8_t val = s->dev->interface->read_register(REG_0x6D); + DBG(DBG_io, "%s: read buttons_gpio value=0x%x\n", __func__, (int)val); switch (s->dev->model->gpio_id) { @@ -1692,6 +1679,12 @@ void CommandSetGl843::update_hardware_sensors(Genesys_Scanner* s) const s->buttons[BUTTON_EMAIL_SW].write((val & 0x04) == 0); s->buttons[BUTTON_COPY_SW].write((val & 0x08) == 0); break; + case GpioId::G4010: + s->buttons[BUTTON_FILE_SW].write((val & 0x01) == 0); + s->buttons[BUTTON_COPY_SW].write((val & 0x04) == 0); + s->buttons[BUTTON_TRANSP_SW].write((val & 0x40) == 0); + s->buttons[BUTTON_SCAN_SW].write((val & 0x08) == 0); + break; case GpioId::CANON_4400F: case GpioId::CANON_8400F: default: diff --git a/backend/genesys/gl843.h b/backend/genesys/gl843.h index fe2814d..ac845bd 100644 --- a/backend/genesys/gl843.h +++ b/backend/genesys/gl843.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #include "genesys.h" diff --git a/backend/genesys/gl843_registers.h b/backend/genesys/gl843_registers.h index ab1f4c7..a1fe156 100644 --- a/backend/genesys/gl843_registers.h +++ b/backend/genesys/gl843_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL843_REGISTERS_H diff --git a/backend/genesys/gl846.cpp b/backend/genesys/gl846.cpp index c8907b2..b427376 100644 --- a/backend/genesys/gl846.cpp +++ b/backend/genesys/gl846.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ /** @file @@ -374,25 +353,13 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev, unsigned step_multiplier = gl846_get_step_multiplier(reg); - bool use_fast_fed = false; - if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, ScanFlag::FEEDING)) { - use_fast_fed = true; - } - if (has_flag(dev->model->flags, ModelFlag::DISABLE_FAST_FEEDING)) { - use_fast_fed = false; - } - reg->set24(REG_LINCNT, scan_lines); reg->set8(REG_0x02, 0); sanei_genesys_set_motor_power(*reg, true); std::uint8_t reg02 = reg->get8(REG_0x02); - if (use_fast_fed) { - reg02 |= REG_0x02_FASTFED; - } else { - reg02 &= ~REG_0x02_FASTFED; - } + reg02 &= ~REG_0x02_FASTFED; if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) { reg02 |= REG_0x02_AGOHOME | REG_0x02_NOTHOME; @@ -446,18 +413,11 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev, unsigned feedl = feed_steps; unsigned dist = 0; - if (use_fast_fed) { - feedl <<= static_cast(fast_profile->step_type); - dist = (scan_table.table.size() + 2 * fast_table.table.size()); - // TODO read and decode REG_0xAB - dist += (reg->get8(0x5e) & 31); - dist += reg->get8(REG_FEDCNT); - } else { - feedl <<= static_cast(motor_profile.step_type); - dist = scan_table.table.size(); - if (has_flag(flags, ScanFlag::FEEDING)) { - dist *= 2; - } + + feedl <<= static_cast(motor_profile.step_type); + dist = scan_table.table.size(); + if (has_flag(flags, ScanFlag::FEEDING)) { + dist *= 2; } // check for overflow @@ -513,7 +473,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev, reg->set8(REG_BWDSTEP, min_restep); std::uint32_t z1, z2; - sanei_genesys_calculate_zmod(use_fast_fed, + sanei_genesys_calculate_zmod(false, scan_exposure_time * ccdlmt * tgtime, scan_table.table, scan_table.table.size(), @@ -759,6 +719,8 @@ ScanSession CommandSetGl846::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; // backtracking isn't handled well, so don't enable it session.params.flags = flags; @@ -882,6 +844,8 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, calib_sensor); diff --git a/backend/genesys/gl846.h b/backend/genesys/gl846.h index d06b337..f1d396d 100644 --- a/backend/genesys/gl846.h +++ b/backend/genesys/gl846.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #include "genesys.h" diff --git a/backend/genesys/gl846_registers.h b/backend/genesys/gl846_registers.h index df45e4f..8e3c655 100644 --- a/backend/genesys/gl846_registers.h +++ b/backend/genesys/gl846_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL846_REGISTERS_H diff --git a/backend/genesys/gl847.cpp b/backend/genesys/gl847.cpp index 91ac4eb..13f9dd9 100644 --- a/backend/genesys/gl847.cpp +++ b/backend/genesys/gl847.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -338,25 +317,13 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev, unsigned step_multiplier = gl847_get_step_multiplier (reg); - bool use_fast_fed = false; - if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, ScanFlag::FEEDING)) { - use_fast_fed = true; - } - if (has_flag(dev->model->flags, ModelFlag::DISABLE_FAST_FEEDING)) { - use_fast_fed = false; - } - reg->set24(REG_LINCNT, scan_lines); reg->set8(REG_0x02, 0); sanei_genesys_set_motor_power(*reg, true); std::uint8_t reg02 = reg->get8(REG_0x02); - if (use_fast_fed) { - reg02 |= REG_0x02_FASTFED; - } else { - reg02 &= ~REG_0x02_FASTFED; - } + reg02 &= ~REG_0x02_FASTFED; if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) { reg02 |= REG_0x02_AGOHOME | REG_0x02_NOTHOME; @@ -402,19 +369,11 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev, // correct move distance by acceleration and deceleration amounts unsigned feedl = feed_steps; unsigned dist = 0; - if (use_fast_fed) - { - feedl <<= static_cast(fast_step_type); - dist = (scan_table.table.size() + 2 * fast_table.table.size()); - // TODO read and decode REG_0xAB - dist += (reg->get8(0x5e) & 31); - dist += reg->get8(REG_FEDCNT); - } else { - feedl <<= static_cast(motor_profile.step_type); - dist = scan_table.table.size(); - if (has_flag(flags, ScanFlag::FEEDING)) { - dist *= 2; - } + + feedl <<= static_cast(motor_profile.step_type); + dist = scan_table.table.size(); + if (has_flag(flags, ScanFlag::FEEDING)) { + dist *= 2; } // check for overflow @@ -456,7 +415,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev, reg->set8(REG_BWDSTEP, min_restep); std::uint32_t z1, z2; - sanei_genesys_calculate_zmod(use_fast_fed, + sanei_genesys_calculate_zmod(false, scan_exposure_time * ccdlmt * tgtime, scan_table.table, scan_table.table.size(), @@ -735,6 +694,8 @@ ScanSession CommandSetGl847::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; session.params.flags = flags; compute_session(dev, session, sensor); @@ -900,6 +861,8 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, calib_sensor); diff --git a/backend/genesys/gl847.h b/backend/genesys/gl847.h index 2cb3a9f..4b98b7a 100644 --- a/backend/genesys/gl847.h +++ b/backend/genesys/gl847.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL847_H diff --git a/backend/genesys/gl847_registers.h b/backend/genesys/gl847_registers.h index 66fda4b..3497c69 100644 --- a/backend/genesys/gl847_registers.h +++ b/backend/genesys/gl847_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL847_REGISTERS_H diff --git a/backend/genesys/image.cpp b/backend/genesys/image.cpp index 3ea6ef6..431f996 100644 --- a/backend/genesys/image.cpp +++ b/backend/genesys/image.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/image.h b/backend/genesys/image.h index 0ad344e..07d3be3 100644 --- a/backend/genesys/image.h +++ b/backend/genesys/image.h @@ -15,28 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. + along with this program. If not, see .s */ #ifndef BACKEND_GENESYS_IMAGE_H diff --git a/backend/genesys/image_buffer.cpp b/backend/genesys/image_buffer.cpp index 46ca292..ed01252 100644 --- a/backend/genesys/image_buffer.cpp +++ b/backend/genesys/image_buffer.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/image_buffer.h b/backend/genesys/image_buffer.h index 516e828..15af742 100644 --- a/backend/genesys/image_buffer.h +++ b/backend/genesys/image_buffer.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_IMAGE_BUFFER_H diff --git a/backend/genesys/image_pipeline.cpp b/backend/genesys/image_pipeline.cpp index 4161e95..f53680f 100644 --- a/backend/genesys/image_pipeline.cpp +++ b/backend/genesys/image_pipeline.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -304,8 +283,8 @@ bool ImagePipelineNodeInvert::get_next_row_data(std::uint8_t* out_data) return got_data; } -ImagePipelineNodeMergeMonoLines::ImagePipelineNodeMergeMonoLines(ImagePipelineNode& source, - ColorOrder color_order) : +ImagePipelineNodeMergeMonoLinesToColor::ImagePipelineNodeMergeMonoLinesToColor( + ImagePipelineNode& source, ColorOrder color_order) : source_(source), buffer_(source_.get_row_bytes()) { @@ -314,7 +293,7 @@ ImagePipelineNodeMergeMonoLines::ImagePipelineNodeMergeMonoLines(ImagePipelineNo output_format_ = get_output_format(source_.get_format(), color_order); } -bool ImagePipelineNodeMergeMonoLines::get_next_row_data(std::uint8_t* out_data) +bool ImagePipelineNodeMergeMonoLinesToColor::get_next_row_data(std::uint8_t* out_data) { bool got_data = true; @@ -341,8 +320,8 @@ bool ImagePipelineNodeMergeMonoLines::get_next_row_data(std::uint8_t* out_data) return got_data; } -PixelFormat ImagePipelineNodeMergeMonoLines::get_output_format(PixelFormat input_format, - ColorOrder order) +PixelFormat ImagePipelineNodeMergeMonoLinesToColor::get_output_format(PixelFormat input_format, + ColorOrder order) { switch (input_format) { case PixelFormat::I1: { @@ -417,6 +396,75 @@ PixelFormat ImagePipelineNodeSplitMonoLines::get_output_format(PixelFormat input throw SaneException("Unsupported input format %d", static_cast(input_format)); } + +ImagePipelineNodeMergeColorToGray::ImagePipelineNodeMergeColorToGray(ImagePipelineNode& source) : + source_(source) +{ + + output_format_ = get_output_format(source_.get_format()); + float red_mult = 0.2125f; + float green_mult = 0.7154f; + float blue_mult = 0.0721f; + + switch (get_pixel_format_color_order(source_.get_format())) { + case ColorOrder::RGB: { + ch0_mult_ = red_mult; + ch1_mult_ = green_mult; + ch2_mult_ = blue_mult; + break; + } + case ColorOrder::BGR: { + ch0_mult_ = blue_mult; + ch1_mult_ = green_mult; + ch2_mult_ = red_mult; + break; + } + case ColorOrder::GBR: { + ch0_mult_ = green_mult; + ch1_mult_ = blue_mult; + ch2_mult_ = red_mult; + break; + } + default: + throw SaneException("Unknown color order"); + } + temp_buffer_.resize(source_.get_row_bytes()); +} + +bool ImagePipelineNodeMergeColorToGray::get_next_row_data(std::uint8_t* out_data) +{ + auto* src_data = temp_buffer_.data(); + + bool got_data = source_.get_next_row_data(src_data); + + auto src_format = source_.get_format(); + + for (std::size_t x = 0, width = get_width(); x < width; ++x) { + std::uint16_t ch0 = get_raw_channel_from_row(src_data, x, 0, src_format); + std::uint16_t ch1 = get_raw_channel_from_row(src_data, x, 1, src_format); + std::uint16_t ch2 = get_raw_channel_from_row(src_data, x, 2, src_format); + float mono = ch0 * ch0_mult_ + ch1 * ch1_mult_ + ch2 * ch2_mult_; + set_raw_channel_to_row(out_data, x, 0, static_cast(mono), output_format_); + } + return got_data; +} + +PixelFormat ImagePipelineNodeMergeColorToGray::get_output_format(PixelFormat input_format) +{ + switch (input_format) { + case PixelFormat::RGB111: + return PixelFormat::I1; + case PixelFormat::RGB888: + case PixelFormat::BGR888: + return PixelFormat::I8; + case PixelFormat::RGB161616: + case PixelFormat::BGR161616: + return PixelFormat::I16; + default: break; + } + throw SaneException("Unsupported format %d", static_cast(input_format)); +} + ImagePipelineNodeComponentShiftLines::ImagePipelineNodeComponentShiftLines( ImagePipelineNode& source, unsigned shift_r, unsigned shift_g, unsigned shift_b) : source_(source), @@ -712,7 +760,7 @@ ImagePipelineNodeCalibrate::ImagePipelineNodeCalibrate(ImagePipelineNode& source const std::vector& bottom, const std::vector& top, std::size_t x_start) : - source_{source} + source_(source) { std::size_t size = 0; if (bottom.size() >= x_start && top.size() >= x_start) { diff --git a/backend/genesys/image_pipeline.h b/backend/genesys/image_pipeline.h index 3632b36..39aed71 100644 --- a/backend/genesys/image_pipeline.h +++ b/backend/genesys/image_pipeline.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_IMAGE_PIPELINE_H @@ -295,11 +274,11 @@ private: }; // A pipeline node that merges 3 mono lines into a color channel -class ImagePipelineNodeMergeMonoLines : public ImagePipelineNode +class ImagePipelineNodeMergeMonoLinesToColor : public ImagePipelineNode { public: - ImagePipelineNodeMergeMonoLines(ImagePipelineNode& source, - ColorOrder color_order); + ImagePipelineNodeMergeMonoLinesToColor(ImagePipelineNode& source, + ColorOrder color_order); std::size_t get_width() const override { return source_.get_width(); } std::size_t get_height() const override { return source_.get_height() / 3; } @@ -342,6 +321,33 @@ private: unsigned next_channel_ = 0; }; + +// A pipeline node that merges 3 mono lines into a gray channel +class ImagePipelineNodeMergeColorToGray : public ImagePipelineNode +{ +public: + ImagePipelineNodeMergeColorToGray(ImagePipelineNode& source); + + std::size_t get_width() const override { return source_.get_width(); } + std::size_t get_height() const override { return source_.get_height(); } + PixelFormat get_format() const override { return output_format_; } + + bool eof() const override { return source_.eof(); } + + bool get_next_row_data(std::uint8_t* out_data) override; + +private: + static PixelFormat get_output_format(PixelFormat input_format); + + ImagePipelineNode& source_; + PixelFormat output_format_ = PixelFormat::UNKNOWN; + float ch0_mult_ = 0; + float ch1_mult_ = 0; + float ch2_mult_ = 0; + + std::vector temp_buffer_; +}; + // A pipeline node that shifts colors across lines by the given offsets class ImagePipelineNodeComponentShiftLines : public ImagePipelineNode { diff --git a/backend/genesys/image_pixel.cpp b/backend/genesys/image_pixel.cpp index 011a086..02ef782 100644 --- a/backend/genesys/image_pixel.cpp +++ b/backend/genesys/image_pixel.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/image_pixel.h b/backend/genesys/image_pixel.h index 4b16083..e414cfb 100644 --- a/backend/genesys/image_pixel.h +++ b/backend/genesys/image_pixel.h @@ -15,28 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. + along with this program. If not, see .s */ #ifndef BACKEND_GENESYS_IMAGE_PIXEL_H diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index ddd2c88..a6da2c1 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -442,7 +421,11 @@ Image read_unshuffled_image_from_scanner(Genesys_Device* dev, const ScanSession& } if (dev->model->is_cis && session.params.channels == 3) { - pipeline.push_node(dev->model->line_mode_color_order); + pipeline.push_node(dev->model->line_mode_color_order); + } + + if (session.use_host_side_gray) { + pipeline.push_node(); } if (pipeline.get_output_format() == PixelFormat::BGR888) { @@ -540,7 +523,7 @@ Image read_shuffled_image_from_scanner(Genesys_Device* dev, const ScanSession& s } if (dev->model->is_cis && session.params.channels == 3) { - pipeline.push_node(dev->model->line_mode_color_order); + pipeline.push_node(dev->model->line_mode_color_order); } if (pipeline.get_output_format() == PixelFormat::BGR888) { @@ -638,11 +621,16 @@ bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& senso if ((session.params.flags & ScanFlag::DISABLE_GAMMA) != ScanFlag::NONE) { return false; } - if (sensor.gamma[0] == 1.0f || sensor.gamma[1] == 1.0f || sensor.gamma[2] == 1.0f) { + if (session.params.depth == 16) { return false; } - if (session.params.depth == 16) + if (session.params.brightness_adjustment != 0 || session.params.contrast_adjustment != 0) { + return true; + } + + if (sensor.gamma[0] == 1.0f || sensor.gamma[1] == 1.0f || sensor.gamma[2] == 1.0f) { return false; + } return true; } @@ -949,6 +937,14 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se s.output_startx = static_cast( static_cast(s.params.startx) + sensor.output_pixel_offset); + if (has_flag(dev->model->flags, ModelFlag::HOST_SIDE_GRAY) && s.params.channels == 1 && + s.params.color_filter == ColorFilter::NONE) + { + s.use_host_side_gray = true; + s.params.channels = 3; + s.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; + } + s.stagger_x = sensor.stagger_x; s.stagger_y = sensor.stagger_y; @@ -1114,7 +1110,8 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se dev->model->asic_type == AsicType::GL845 || dev->model->asic_type == AsicType::GL846) { - s.enable_ledadd = (s.params.channels == 1 && dev->model->is_cis && dev->settings.true_gray); + s.enable_ledadd = (s.params.channels == 1 && dev->model->is_cis && + s.params.color_filter == ColorFilter::NONE); } s.use_host_side_calib = sensor.use_host_side_calib; @@ -1212,7 +1209,7 @@ ImagePipelineStack build_image_pipeline(const Genesys_Device& dev, const ScanSes } if (dev.model->is_cis && session.params.channels == 3) { - pipeline.push_node(dev.model->line_mode_color_order); + pipeline.push_node(dev.model->line_mode_color_order); if (log_image_data) { pipeline.push_node(debug_prefix + "_4_after_merge_mono.tiff"); @@ -1274,6 +1271,14 @@ ImagePipelineStack build_image_pipeline(const Genesys_Device& dev, const ScanSes } } + if (session.use_host_side_gray) { + pipeline.push_node(); + + if (log_image_data) { + pipeline.push_node(debug_prefix + "_10_after_nogray.tiff"); + } + } + if (pipeline.get_output_width() != session.params.get_requested_pixels()) { pipeline.push_node(session.params.get_requested_pixels()); } diff --git a/backend/genesys/low.h b/backend/genesys/low.h index ac149b5..b0d23fe 100644 --- a/backend/genesys/low.h +++ b/backend/genesys/low.h @@ -23,27 +23,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef GENESYS_LOW_H @@ -116,6 +95,7 @@ #define GENESYS_HAS_POWER_SW (1 << 6) /**< scanner has power button */ #define GENESYS_HAS_CALIBRATE (1 << 7) /**< scanner has 'calibrate' software button to start calibration */ #define GENESYS_HAS_EXTRA_SW (1 << 8) /**< scanner has extra function button */ +#define GENESYS_HAS_TRANSP_SW (1 << 9) /**< scanner has TRANSPARCY/SCAN_FILM button */ /* USB control message values */ #define REQUEST_TYPE_IN (USB_TYPE_VENDOR | USB_DIR_IN) diff --git a/backend/genesys/motor.cpp b/backend/genesys/motor.cpp index 8450fea..1dfe64f 100644 --- a/backend/genesys/motor.cpp +++ b/backend/genesys/motor.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -136,7 +115,8 @@ MotorSlopeTable create_slope_table_for_speed(const MotorSlope& slope, unsigned t unsigned max_speed_shifted_w = slope.max_speed_w >> step_shift; if (target_speed_shifted_w < max_speed_shifted_w) { - dbg.log(DBG_warn, "failed to reach target speed"); + dbg.vlog(DBG_warn, "failed to reach target speed %d %d", target_speed_w, + slope.max_speed_w); } if (target_speed_shifted_w >= std::numeric_limits::max()) { diff --git a/backend/genesys/motor.h b/backend/genesys/motor.h index e5fd695..1981e80 100644 --- a/backend/genesys/motor.h +++ b/backend/genesys/motor.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_MOTOR_H diff --git a/backend/genesys/register.h b/backend/genesys/register.h index cee9adf..8ac549d 100644 --- a/backend/genesys/register.h +++ b/backend/genesys/register.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_REGISTER_H diff --git a/backend/genesys/register_cache.h b/backend/genesys/register_cache.h index c7e5c41..0538529 100644 --- a/backend/genesys/register_cache.h +++ b/backend/genesys/register_cache.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_REGISTER_CACHE_H diff --git a/backend/genesys/row_buffer.h b/backend/genesys/row_buffer.h index a4b9e42..d7f071c 100644 --- a/backend/genesys/row_buffer.h +++ b/backend/genesys/row_buffer.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_LINE_BUFFER_H diff --git a/backend/genesys/scanner_interface.cpp b/backend/genesys/scanner_interface.cpp index 5363f0e..485270e 100644 --- a/backend/genesys/scanner_interface.cpp +++ b/backend/genesys/scanner_interface.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/scanner_interface.h b/backend/genesys/scanner_interface.h index 8258117..3aa9d6b 100644 --- a/backend/genesys/scanner_interface.h +++ b/backend/genesys/scanner_interface.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_SCANNER_INTERFACE_H diff --git a/backend/genesys/scanner_interface_usb.cpp b/backend/genesys/scanner_interface_usb.cpp index 117297c..da8823b 100644 --- a/backend/genesys/scanner_interface_usb.cpp +++ b/backend/genesys/scanner_interface_usb.cpp @@ -16,34 +16,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY #include "scanner_interface_usb.h" #include "low.h" -#include namespace genesys { @@ -481,7 +459,7 @@ void ScannerInterfaceUsb::sleep_us(unsigned microseconds) if (sanei_usb_is_replay_mode_enabled()) { return; } - std::this_thread::sleep_for(std::chrono::microseconds{microseconds}); + usleep(microseconds); } void ScannerInterfaceUsb::record_progress_message(const char* msg) diff --git a/backend/genesys/scanner_interface_usb.h b/backend/genesys/scanner_interface_usb.h index 569d634..d6408df 100644 --- a/backend/genesys/scanner_interface_usb.h +++ b/backend/genesys/scanner_interface_usb.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_SCANNER_INTERFACE_USB_H diff --git a/backend/genesys/sensor.cpp b/backend/genesys/sensor.cpp index b09745f..d3cdda1 100644 --- a/backend/genesys/sensor.cpp +++ b/backend/genesys/sensor.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/sensor.h b/backend/genesys/sensor.h index 6f87607..2902b0d 100644 --- a/backend/genesys/sensor.h +++ b/backend/genesys/sensor.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_SENSOR_H diff --git a/backend/genesys/serialize.h b/backend/genesys/serialize.h index 138ff08..ed67ea3 100644 --- a/backend/genesys/serialize.h +++ b/backend/genesys/serialize.h @@ -15,28 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. + along with this program. If not, see .s */ #ifndef BACKEND_GENESYS_SERIALIZE_H diff --git a/backend/genesys/settings.cpp b/backend/genesys/settings.cpp index 7f64798..d409683 100644 --- a/backend/genesys/settings.cpp +++ b/backend/genesys/settings.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -86,6 +65,8 @@ std::ostream& operator<<(std::ostream& out, const SetupParams& params) << " channels: " << params.channels << '\n' << " scan_mode: " << params.scan_mode << '\n' << " color_filter: " << params.color_filter << '\n' + << " contrast_adjustment: " << params.contrast_adjustment << '\n' + << " brightness_adjustment: " << params.brightness_adjustment << '\n' << " flags: " << params.flags << '\n' << "}"; return out; @@ -127,7 +108,8 @@ bool ScanSession::operator==(const ScanSession& other) const shading_pixel_offset == other.shading_pixel_offset && buffer_size_read == other.buffer_size_read && enable_ledadd == other.enable_ledadd && - use_host_side_calib == other.use_host_side_calib; + use_host_side_calib == other.use_host_side_calib && + use_host_side_gray == other.use_host_side_gray; } std::ostream& operator<<(std::ostream& out, const ScanSession& session) @@ -164,6 +146,7 @@ std::ostream& operator<<(std::ostream& out, const ScanSession& session) << " buffer_size_read: " << session.buffer_size_read << '\n' << " enable_ledadd: " << session.enable_ledadd << '\n' << " use_host_side_calib: " << session.use_host_side_calib << '\n' + << " use_host_side_gray: " << session.use_host_side_gray << '\n' << " params: " << format_indent_braced_list(4, session.params) << '\n' << "}"; return out; diff --git a/backend/genesys/settings.h b/backend/genesys/settings.h index 4c834fa..d404941 100644 --- a/backend/genesys/settings.h +++ b/backend/genesys/settings.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_SETTINGS_H @@ -76,9 +55,6 @@ struct Genesys_Settings ColorFilter color_filter = ColorFilter::NONE; - // true if scan is true gray, false if monochrome scan - int true_gray = 0; - // value for contrast enhancement in the [-100..100] range int contrast = 0; @@ -102,6 +78,7 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Settings& settings); struct SetupParams { static constexpr unsigned NOT_SET = std::numeric_limits::max(); + static constexpr unsigned NOT_SET_I = std::numeric_limits::max(); // resolution in x direction unsigned xres = NOT_SET; @@ -136,6 +113,10 @@ struct SetupParams { ColorFilter color_filter = static_cast(NOT_SET); + // the values for contrast and brightness adjustment in the range of [-100..100] + int contrast_adjustment = NOT_SET_I; + int brightness_adjustment = NOT_SET_I; + ScanFlag flags = ScanFlag::NONE; unsigned get_requested_pixels() const @@ -152,7 +133,8 @@ struct SetupParams { pixels == NOT_SET || lines == NOT_SET ||depth == NOT_SET || channels == NOT_SET || scan_method == static_cast(NOT_SET) || scan_mode == static_cast(NOT_SET) || - color_filter == static_cast(NOT_SET)) + color_filter == static_cast(NOT_SET) || + contrast_adjustment == NOT_SET_I || brightness_adjustment == NOT_SET_I) { throw std::runtime_error("SetupParams are not valid"); } @@ -172,6 +154,8 @@ struct SetupParams { scan_method == other.scan_method && scan_mode == other.scan_mode && color_filter == other.color_filter && + contrast_adjustment == other.contrast_adjustment && + brightness_adjustment == other.brightness_adjustment && flags == other.flags; } }; @@ -193,6 +177,8 @@ void serialize(Stream& str, SetupParams& x) serialize(str, x.scan_method); serialize(str, x.scan_mode); serialize(str, x.color_filter); + serialize(str, x.contrast_adjustment); + serialize(str, x.brightness_adjustment); serialize(str, x.flags); } @@ -317,6 +303,9 @@ struct ScanSession { // whether calibration should be performed host-side bool use_host_side_calib = false; + // whether gray scanning should be performed host-side (scan as color and merge to gray) + bool use_host_side_gray = false; + void assert_computed() const { if (!computed) { @@ -368,6 +357,7 @@ void serialize(Stream& str, ScanSession& x) serialize(str, x.buffer_size_read); serialize(str, x.enable_ledadd); serialize(str, x.use_host_side_calib); + serialize(str, x.use_host_side_gray); } std::ostream& operator<<(std::ostream& out, const SANE_Parameters& params); diff --git a/backend/genesys/static_init.cpp b/backend/genesys/static_init.cpp index 5ed3b50..2d463ee 100644 --- a/backend/genesys/static_init.cpp +++ b/backend/genesys/static_init.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -57,12 +36,15 @@ void add_function_to_run_at_backend_exit(const std::function& function) void run_functions_at_backend_exit() { - for (auto it = s_functions_run_at_backend_exit->rbegin(); - it != s_functions_run_at_backend_exit->rend(); ++it) + if (s_functions_run_at_backend_exit) { - (*it)(); + for (auto it = s_functions_run_at_backend_exit->rbegin(); + it != s_functions_run_at_backend_exit->rend(); ++it) + { + (*it)(); + } + s_functions_run_at_backend_exit.reset(); } - s_functions_run_at_backend_exit.reset(); } } // namespace genesys diff --git a/backend/genesys/static_init.h b/backend/genesys/static_init.h index e0b39c8..63c242e 100644 --- a/backend/genesys/static_init.h +++ b/backend/genesys/static_init.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_STATIC_INIT_H diff --git a/backend/genesys/status.cpp b/backend/genesys/status.cpp index 170bcd7..b95bcd6 100644 --- a/backend/genesys/status.cpp +++ b/backend/genesys/status.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/status.h b/backend/genesys/status.h index f1a3695..5983bf2 100644 --- a/backend/genesys/status.h +++ b/backend/genesys/status.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_STATUS_H diff --git a/backend/genesys/tables_frontend.cpp b/backend/genesys/tables_frontend.cpp index 02e9998..65fc7f4 100644 --- a/backend/genesys/tables_frontend.cpp +++ b/backend/genesys/tables_frontend.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/tables_gpo.cpp b/backend/genesys/tables_gpo.cpp index 075cafb..f129262 100644 --- a/backend/genesys/tables_gpo.cpp +++ b/backend/genesys/tables_gpo.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -257,6 +236,21 @@ void genesys_init_gpo_tables() s_gpo->push_back(gpo); + gpo = Genesys_Gpo(); + gpo.id = GpioId::G4010; + gpo.regs = { + { 0x6c, 0x20 }, + { 0x6d, 0x00 }, + { 0x6e, 0xfc }, + { 0x6f, 0x00 }, + { 0xa6, 0x08 }, + { 0xa7, 0x1e }, + { 0xa8, 0x3e }, + { 0xa9, 0x06 }, + }; + s_gpo->push_back(gpo); + + gpo = Genesys_Gpo(); gpo.id = GpioId::HP_N6310; gpo.regs = { diff --git a/backend/genesys/tables_model.cpp b/backend/genesys/tables_model.cpp index 6998a51..d139334 100644 --- a/backend/genesys/tables_model.cpp +++ b/backend/genesys/tables_model.cpp @@ -27,27 +27,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -191,6 +170,7 @@ void genesys_init_usb_device_tables() model.gpio_id = GpioId::CANON_LIDE_35; model.motor_id = MotorId::CANON_LIDE_35; model.flags = ModelFlag::DARK_WHITE_CALIBRATION | + ModelFlag::HOST_SIDE_GRAY | ModelFlag::CUSTOM_GAMMA; model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | @@ -342,12 +322,12 @@ void genesys_init_usb_device_tables() model.is_sheetfed = false; model.sensor_id = SensorId::CCD_G4050; model.adc_id = AdcId::G4050; - model.gpio_id = GpioId::G4050; + model.gpio_id = GpioId::G4010; model.motor_id = MotorId::G4050; model.flags = ModelFlag::WARMUP | ModelFlag::DARK_CALIBRATION | ModelFlag::CUSTOM_GAMMA; - model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_COPY_SW; + model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_COPY_SW | GENESYS_HAS_TRANSP_SW; model.search_lines = 100; s_usb_devices->emplace_back(0x03f0, 0x4505, model); @@ -619,8 +599,8 @@ void genesys_init_usb_device_tables() model.resolutions = { { { ScanMethod::FLATBED }, - { 2400, 1200, 600, 300, 200, 150, 100, 75 }, - { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }, + { 2400, 1200, 600, 300, 200, 150 }, + { 4800, 2400, 1200, 600, 300, 200, 150 }, } }; @@ -1020,8 +1000,8 @@ void genesys_init_usb_device_tables() model.resolutions = { { { ScanMethod::FLATBED }, - { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }, - { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }, + { 4800, 2400, 1200, 600, 300, 200, 150 }, + { 4800, 2400, 1200, 600, 300, 200, 150 }, } }; @@ -1110,6 +1090,7 @@ void genesys_init_usb_device_tables() model.gpio_id = GpioId::CANON_LIDE_35; model.motor_id = MotorId::CANON_LIDE_60; model.flags = ModelFlag::DARK_WHITE_CALIBRATION | + ModelFlag::HOST_SIDE_GRAY | ModelFlag::CUSTOM_GAMMA; model.buttons = GENESYS_HAS_COPY_SW | @@ -1165,6 +1146,7 @@ void genesys_init_usb_device_tables() model.gpio_id = GpioId::CANON_LIDE_80; model.motor_id = MotorId::CANON_LIDE_80; model.flags = ModelFlag::DARK_WHITE_CALIBRATION | + ModelFlag::HOST_SIDE_GRAY | ModelFlag::CUSTOM_GAMMA; model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | diff --git a/backend/genesys/tables_motor.cpp b/backend/genesys/tables_motor.cpp index e8e89c5..3cc576f 100644 --- a/backend/genesys/tables_motor.cpp +++ b/backend/genesys/tables_motor.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -472,7 +451,7 @@ void genesys_init_motor_tables() motor.base_ydpi = 4800; motor.profiles.push_back({MotorSlope::create_from_steps(62496, 864, 127), StepType::FULL, 4608}); - motor.profiles.push_back({MotorSlope::create_from_steps(62496, 2010, 63), + motor.profiles.push_back({MotorSlope::create_from_steps(62496, 1338, 63), StepType::HALF, 5360}); motor.profiles.push_back({MotorSlope::create_from_steps(62464, 2632, 3), StepType::QUARTER, 10528}); diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 8383287..fb18abc 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -471,8 +450,8 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 87; sensor.dummy_pixel = 87; - sensor.fau_gain_white_ref = 0; - sensor.gain_white_ref = 0; + sensor.fau_gain_white_ref = 100; + sensor.gain_white_ref = 100; sensor.exposure = { 0x0400, 0x0400, 0x0400 }; sensor.custom_regs = { { 0x16, 0x00 }, { 0x17, 0x02 }, { 0x18, 0x00 }, { 0x19, 0x50 }, @@ -519,8 +498,8 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 87; sensor.dummy_pixel = 87; - sensor.fau_gain_white_ref = 0; - sensor.gain_white_ref = 0; + sensor.fau_gain_white_ref = 100; + sensor.gain_white_ref = 100; sensor.exposure = { 0x0400, 0x0400, 0x0400 }; sensor.custom_regs = { { 0x16, 0x00 }, { 0x17, 0x01 }, { 0x18, 0x00 }, { 0x19, 0x50 }, @@ -1057,30 +1036,6 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) - { { 75 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 8, 40, 5136, - std::vector{}, { - { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, - { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, - { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, - { 0x56, 0x00 }, { 0x57, 0x00 }, { 0x58, 0x2a }, { 0x59, 0xe1 }, { 0x5a, 0x55 }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x3c }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - } - }, - // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) - { { 100 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 6, 53, 5136, - std::vector{}, { - { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, - { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, - { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, - { 0x56, 0x00 }, { 0x57, 0x00 }, { 0x58, 0x2a }, { 0x59, 0xe1 }, { 0x5a, 0x55 }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x3c }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - } - }, // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) { { 150 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 4, 80, 5136, std::vector{}, { @@ -1361,28 +1316,6 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 8, 40, 5136, - std::vector{}, { - { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, - { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, - { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, - { 0x56, 0x00 }, { 0x57, 0x00 }, { 0x58, 0x2a }, { 0x59, 0xe1 }, { 0x5a, 0x55 }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x3c }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - } - }, - { { 100 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 6, 53, 5136, - std::vector{}, { - { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, - { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, - { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, - { 0x56, 0x00 }, { 0x57, 0x00 }, { 0x58, 0x2a }, { 0x59, 0xe1 }, { 0x5a, 0x55 }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x3c }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - } - }, { { 150 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 4, 80, 5136, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, @@ -2635,6 +2568,13 @@ void genesys_init_sensor_tables() sensor.shading_factor = setting.shading_factor; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; + + sensor.channels = { 1 }; + sensor.custom_regs.set_value(0x0c, 0x10); + s_sensors->push_back(sensor); + + sensor.channels = { 3 }; + sensor.custom_regs.set_value(0x0c, 0x12); s_sensors->push_back(sensor); } } @@ -2805,6 +2745,13 @@ void genesys_init_sensor_tables() sensor.shading_factor = setting.shading_factor; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; + + sensor.channels = { 1 }; + sensor.custom_regs.set_value(0x0c, 0x10); + s_sensors->push_back(sensor); + + sensor.channels = { 3 }; + sensor.custom_regs.set_value(0x0c, 0x12); s_sensors->push_back(sensor); } } @@ -3000,6 +2947,13 @@ void genesys_init_sensor_tables() sensor.shading_factor = setting.shading_factor; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; + + sensor.channels = { 1 }; + sensor.custom_regs.set_value(0x0c, 0x10); + s_sensors->push_back(sensor); + + sensor.channels = { 3 }; + sensor.custom_regs.set_value(0x0c, 0x12); s_sensors->push_back(sensor); } } @@ -3196,6 +3150,13 @@ void genesys_init_sensor_tables() sensor.shading_factor = setting.shading_factor; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; + + sensor.channels = { 1 }; + sensor.custom_regs.set_value(0x0c, 0x10); + s_sensors->push_back(sensor); + + sensor.channels = { 3 }; + sensor.custom_regs.set_value(0x0c, 0x12); s_sensors->push_back(sensor); } } diff --git a/backend/genesys/test_scanner_interface.cpp b/backend/genesys/test_scanner_interface.cpp index 5d0dcd3..412176e 100644 --- a/backend/genesys/test_scanner_interface.cpp +++ b/backend/genesys/test_scanner_interface.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/test_scanner_interface.h b/backend/genesys/test_scanner_interface.h index c1a3b76..9a5f412 100644 --- a/backend/genesys/test_scanner_interface.h +++ b/backend/genesys/test_scanner_interface.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_TEST_SCANNER_INTERFACE_H diff --git a/backend/genesys/test_settings.cpp b/backend/genesys/test_settings.cpp index ba50f36..c0aa43f 100644 --- a/backend/genesys/test_settings.cpp +++ b/backend/genesys/test_settings.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/test_settings.h b/backend/genesys/test_settings.h index 90c6e50..64e8f02 100644 --- a/backend/genesys/test_settings.h +++ b/backend/genesys/test_settings.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_TEST_SETTINGS_H diff --git a/backend/genesys/test_usb_device.cpp b/backend/genesys/test_usb_device.cpp index 46cd4e5..a5dbd78 100644 --- a/backend/genesys/test_usb_device.cpp +++ b/backend/genesys/test_usb_device.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/test_usb_device.h b/backend/genesys/test_usb_device.h index 6fd0ff3..ae8d4a2 100644 --- a/backend/genesys/test_usb_device.h +++ b/backend/genesys/test_usb_device.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_TEST_USB_DEVICE_H diff --git a/backend/genesys/usb_device.cpp b/backend/genesys/usb_device.cpp index 63afb09..41b8fbe 100644 --- a/backend/genesys/usb_device.cpp +++ b/backend/genesys/usb_device.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/usb_device.h b/backend/genesys/usb_device.h index 72f7017..fa97e5c 100644 --- a/backend/genesys/usb_device.h +++ b/backend/genesys/usb_device.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_USB_DEVICE_H diff --git a/backend/genesys/utilities.h b/backend/genesys/utilities.h index 6e637d0..8c872c9 100644 --- a/backend/genesys/utilities.h +++ b/backend/genesys/utilities.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_UTILITIES_H @@ -226,7 +205,7 @@ class BasicStreamStateSaver { public: explicit BasicStreamStateSaver(std::basic_ios& stream) : - stream_{stream} + stream_(stream) { flags_ = stream_.flags(); width_ = stream_.width(); diff --git a/backend/gphoto2.c b/backend/gphoto2.c index 0ea5b48..758829a 100644 --- a/backend/gphoto2.c +++ b/backend/gphoto2.c @@ -677,7 +677,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize } if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (GPHOTO2_CONFIG_FILE); diff --git a/backend/gt68xx.c b/backend/gt68xx.c index 6e43765..f46c578 100644 --- a/backend/gt68xx.c +++ b/backend/gt68xx.c @@ -1174,8 +1174,11 @@ static SANE_Status probe_gt68xx_devices(void) new_dev[i]->model->firmware_name); } if (i == 0) - DBG (5, "sane_init: firmware %s can't be loaded, set device " - "first\n", word); + { + DBG (5, "sane_init: firmware %s can't be loaded, set device " + "first\n", word); + free (word); + } } else { @@ -1198,8 +1201,11 @@ static SANE_Status probe_gt68xx_devices(void) new_dev[i]->model->name, new_dev[i]->model->vendor); } if (i == 0) - DBG (5, "sane_init: can't set vendor name %s, set device " - "first\n", word); + { + DBG (5, "sane_init: can't set vendor name %s, set device " + "first\n", word); + free (word); + } } else { @@ -1221,9 +1227,11 @@ static SANE_Status probe_gt68xx_devices(void) new_dev[i]->model->name, new_dev[i]->model->model); } if (i == 0) - DBG (5, "sane_init: can't set model name %s, set device " - "first\n", word); - free (word); + { + DBG (5, "sane_init: can't set model name %s, set device " + "first\n", word); + free (word); + } } else { @@ -1332,10 +1340,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) } #endif DBG (2, "SANE GT68xx backend version %d.%d build %d from %s\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (5, "sane_init: authorize %s null\n", authorize ? "!=" : "=="); diff --git a/backend/hp.c b/backend/hp.c index 2358d1f..558a36d 100644 --- a/backend/hp.c +++ b/backend/hp.c @@ -816,7 +816,7 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback __sane_unused__ authorize) hp_destroy(); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, VERSIO); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, VERSIO); status = hp_init(); DBG(3, "sane_init will finish with %s\n", sane_strstatus (status)); diff --git a/backend/hp3500.c b/backend/hp3500.c index b7a2d59..bf07b36 100644 --- a/backend/hp3500.c +++ b/backend/hp3500.c @@ -274,7 +274,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) sanei_thread_init (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); sanei_usb_find_devices (0x03f0, 0x2205, attachScanner); sanei_usb_find_devices (0x03f0, 0x2005, attachScanner); diff --git a/backend/hp3900_sane.c b/backend/hp3900_sane.c index c717d4d..eae99e0 100644 --- a/backend/hp3900_sane.c +++ b/backend/hp3900_sane.c @@ -1806,7 +1806,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) /* Return backend version */ if (version_code != NULL) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); return SANE_STATUS_GOOD; } diff --git a/backend/hp4200.c b/backend/hp4200.c index c080fcb..5b21b47 100644 --- a/backend/hp4200.c +++ b/backend/hp4200.c @@ -1497,7 +1497,7 @@ do_fine_calibration (HP4200_Scanner * s, struct coarse_t *coarse) int i; for (i = 0; i < 12; i++) { - memset (registro[i], 0, 5460 * 3 * sizeof(registro[0])); + memset (registro[i], 0, 5460 * 3 * sizeof(int)); } } @@ -2375,12 +2375,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (DBG_proc, "%s\n", me); DBG (DBG_error, "SANE hp4200 backend version %d.%d build %d from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); /* put some version_code checks here */ if (NULL != version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); } sanei_usb_init (); diff --git a/backend/hp5400_sane.c b/backend/hp5400_sane.c index 8413568..5043dad 100644 --- a/backend/hp5400_sane.c +++ b/backend/hp5400_sane.c @@ -623,7 +623,7 @@ sane_init (SANE_Int * piVersion, SANE_Auth_Callback pfnAuth) DBG_INIT (); HP5400_DBG (DBG_MSG, "sane_init: SANE hp5400 backend version %d.%d-%d (from %s)\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); sanei_usb_init (); @@ -671,7 +671,7 @@ sane_init (SANE_Int * piVersion, SANE_Auth_Callback pfnAuth) if (piVersion != NULL) { - *piVersion = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *piVersion = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } return SANE_STATUS_GOOD; diff --git a/backend/hp5590.c b/backend/hp5590.c index 1c164e4..78c9313 100644 --- a/backend/hp5590.c +++ b/backend/hp5590.c @@ -480,11 +480,11 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG_INIT(); DBG (1, "SANE backed for HP ScanJet 4500C/4570C/5500C/5550C/5590/7650 %u.%u.%u\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (1, "(c) Ilia Sotnikov \n"); if (version_code) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); sanei_usb_init(); diff --git a/backend/hpljm1005.c b/backend/hpljm1005.c index 95ddd8e..2a7116c 100644 --- a/backend/hpljm1005.c +++ b/backend/hpljm1005.c @@ -392,7 +392,7 @@ sane_init (SANE_Int * version_code, { if (version_code != NULL) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG_INIT(); diff --git a/backend/hpsj5s.c b/backend/hpsj5s.c index ea58433..5ff5064 100644 --- a/backend/hpsj5s.c +++ b/backend/hpsj5s.c @@ -166,11 +166,11 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (2, "sane_init: version_code %s 0, authorize %s 0\n", version_code == 0 ? "=" : "!=", authorize == 0 ? "=" : "!="); DBG (1, "sane_init: SANE hpsj5s backend version %d.%d.%d\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); /*Inform about supported version */ if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); /*Open configuration file for this backend */ config_file = sanei_config_open (HPSJ5S_CONFIG_FILE); diff --git a/backend/hs2p.c b/backend/hs2p.c index ec9eec9..76f4b96 100644 --- a/backend/hs2p.c +++ b/backend/hs2p.c @@ -1565,14 +1565,14 @@ sane_init (SANE_Int * version_code, /*DBG (DBG_sane_init, "> sane_init (authorize = %p)\n", (void *) authorize); */ #if defined PACKAGE && defined VERSION DBG (DBG_sane_init, "> sane_init: hs2p backend version %d.%d-%d (" - PACKAGE " " VERSION ")\n", SANE_CURRENT_MAJOR, V_MINOR, BUILD); + PACKAGE " " VERSION ")\n", SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); #endif /* sanei_thread_init (); */ if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); if ((fp = sanei_config_open (HS2P_CONFIG_FILE)) != NULL) diff --git a/backend/ibm.c b/backend/ibm.c index 91a09ee..688cdfb 100644 --- a/backend/ibm.c +++ b/backend/ibm.c @@ -545,11 +545,11 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) #if defined PACKAGE && defined VERSION DBG (2, "sane_init: ibm backend version %d.%d-%d (" - PACKAGE " " VERSION ")\n", SANE_CURRENT_MAJOR, V_MINOR, BUILD); + PACKAGE " " VERSION ")\n", SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); #endif if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open(IBM_CONFIG_FILE); if (fp) diff --git a/backend/kodak.c b/backend/kodak.c index 39c91e6..c41f088 100644 --- a/backend/kodak.c +++ b/backend/kodak.c @@ -181,10 +181,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (10, "sane_init: start\n"); if (version_code) - *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (5, "sane_init: kodak backend %d.%d.%d, from %s\n", - V_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); DBG (10, "sane_init: finish\n"); diff --git a/backend/kodakaio.c b/backend/kodakaio.c index 73dd58b..fe83e27 100644 --- a/backend/kodakaio.c +++ b/backend/kodakaio.c @@ -2629,7 +2629,7 @@ sane_init(SANE_Int *version_code, SANE_Auth_Callback __sane_unused__ authorize) KODAKAIO_VERSION, KODAKAIO_REVISION, KODAKAIO_BUILD); DBG(2, "%s: called\n", __func__); if (version_code != NULL) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, KODAKAIO_BUILD); sanei_usb_init(); diff --git a/backend/kvs1025.c b/backend/kvs1025.c index fc89d87..9d53690 100644 --- a/backend/kvs1025.c +++ b/backend/kvs1025.c @@ -51,11 +51,11 @@ sane_init (SANE_Int * version_code, DBG (DBG_error, "This is panasonic KV-S1020C / KV-S1025C version %d.%d build %d\n", - V_MAJOR, V_MINOR, V_BUILD); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, V_BUILD); if (version_code) { - *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, V_BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, V_BUILD); } /* Initialize USB */ diff --git a/backend/kvs20xx.c b/backend/kvs20xx.c index 8864d7d..7baebbc 100644 --- a/backend/kvs20xx.c +++ b/backend/kvs20xx.c @@ -64,7 +64,7 @@ sane_init (SANE_Int __sane_unused__ * version_code, DBG_INIT (); DBG (DBG_INFO, "This is panasonic kvs20xx driver\n"); - *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); /* Initialize USB */ sanei_usb_init (); diff --git a/backend/kvs40xx.c b/backend/kvs40xx.c index 6416d64..230bdc2 100644 --- a/backend/kvs40xx.c +++ b/backend/kvs40xx.c @@ -165,7 +165,7 @@ sane_init (SANE_Int __sane_unused__ * version_code, DBG_INIT (); DBG (DBG_INFO, "This is panasonic kvs40xx driver\n"); - *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, 1); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 1); /* Initialize USB */ sanei_usb_init (); diff --git a/backend/leo.c b/backend/leo.c index 3c97daa..344d2c6 100644 --- a/backend/leo.c +++ b/backend/leo.c @@ -1298,12 +1298,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG (DBG_sane_init, "sane_init\n"); DBG (DBG_error, "This is sane-leo version %d.%d-%d\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD); + SANE_CURRENT_MINOR, BUILD); DBG (DBG_error, "(C) 2002 by Frank Zago\n"); if (version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } fp = sanei_config_open (LEO_CONFIG_FILE); diff --git a/backend/lexmark.c b/backend/lexmark.c index 2c9287a..ba0311d 100644 --- a/backend/lexmark.c +++ b/backend/lexmark.c @@ -526,12 +526,12 @@ sane_init (SANE_Int * version_code, DBG_INIT (); DBG (1, "SANE Lexmark backend version %d.%d.%d-devel\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD); + SANE_CURRENT_MINOR, BUILD); DBG (2, "sane_init: version_code=%p\n", (void *) version_code); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); #ifndef FAKE_USB sanei_usb_init (); diff --git a/backend/ma1509.c b/backend/ma1509.c index 37bbefb..5966a17 100644 --- a/backend/ma1509.c +++ b/backend/ma1509.c @@ -1110,10 +1110,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) #endif DBG (2, "SANE ma1509 backend version %d.%d build %d from %s\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (4, "sane_init: authorize %s null\n", authorize ? "!=" : "=="); diff --git a/backend/magicolor.c b/backend/magicolor.c index 886dbab..8fc6d31 100644 --- a/backend/magicolor.c +++ b/backend/magicolor.c @@ -2266,7 +2266,7 @@ sane_init(SANE_Int *version_code, SANE_Auth_Callback __sane_unused__ authorize) MAGICOLOR_VERSION, MAGICOLOR_REVISION, MAGICOLOR_BUILD); if (version_code != NULL) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, MAGICOLOR_BUILD); sanei_usb_init(); diff --git a/backend/matsushita.c b/backend/matsushita.c index d982f50..e3a983f 100644 --- a/backend/matsushita.c +++ b/backend/matsushita.c @@ -1711,12 +1711,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG (DBG_sane_init, "sane_init\n"); DBG (DBG_error, "This is sane-matsushita version %d.%d-%d\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD); + SANE_CURRENT_MINOR, BUILD); DBG (DBG_error, "(C) 2002 by Frank Zago\n"); if (version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } fp = sanei_config_open (MATSUSHITA_CONFIG_FILE); diff --git a/backend/microtek.c b/backend/microtek.c index 200a69c..17f3151 100644 --- a/backend/microtek.c +++ b/backend/microtek.c @@ -57,6 +57,7 @@ #include "../include/sane/config.h" +#include #include #include #include @@ -3065,7 +3066,7 @@ sane_init(SANE_Int *version_code, SANE_Auth_Callback authorize) MICROTEK_MAJOR, MICROTEK_MINOR, MICROTEK_PATCH); /* return the SANE version we got compiled under */ if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); /* parse config file */ fp = sanei_config_open (MICROTEK_CONFIG_FILE); diff --git a/backend/microtek2.c b/backend/microtek2.c index 72c1b20..505e86b 100644 --- a/backend/microtek2.c +++ b/backend/microtek2.c @@ -456,7 +456,7 @@ sane_init(SANE_Int *version_code, SANE_Auth_Callback __sane_unused__ authorize) MICROTEK2_MAJOR, MICROTEK2_MINOR, MICROTEK2_BUILD); if ( version_code ) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); #ifdef HAVE_AUTHORIZATION auth_callback = authorize; diff --git a/backend/mustek.c b/backend/mustek.c index 48bcfd9..4d77fb5 100644 --- a/backend/mustek.c +++ b/backend/mustek.c @@ -5201,10 +5201,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) #endif DBG (2, "SANE mustek backend version %d.%d build %d from %s\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (5, "sane_init: authorize %s null\n", authorize ? "!=" : "=="); diff --git a/backend/mustek_pp.c b/backend/mustek_pp.c index 26dc0e4..2d374ee 100644 --- a/backend/mustek_pp.c +++ b/backend/mustek_pp.c @@ -710,7 +710,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (3, "backend by Jochen Eisinger \n"); if (version_code != NULL) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, MUSTEK_PP_BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, MUSTEK_PP_BUILD); sane_auth = authorize; diff --git a/backend/mustek_usb.c b/backend/mustek_usb.c index 6bd3390..7417094 100644 --- a/backend/mustek_usb.c +++ b/backend/mustek_usb.c @@ -699,10 +699,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG_INIT (); DBG (2, "SANE Mustek USB backend version %d.%d build %d from %s\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (5, "sane_init: authorize %s null\n", authorize ? "!=" : "=="); diff --git a/backend/mustek_usb2.c b/backend/mustek_usb2.c index aa4d797..9faeff6 100644 --- a/backend/mustek_usb2.c +++ b/backend/mustek_usb2.c @@ -2008,12 +2008,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG_INIT (); DBG (DBG_FUNC, "sane_init: start\n"); DBG (DBG_ERR, "SANE Mustek USB2 backend version %d.%d build %d from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); num_devices = 1; /* HOLD: only one device in this backend */ if (version_code != NULL) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (DBG_INFO, "sane_init: authorize %s null\n", authorize ? "!=" : "=="); diff --git a/backend/nec.c b/backend/nec.c index b61bb37..66bfc9b 100644 --- a/backend/nec.c +++ b/backend/nec.c @@ -1898,7 +1898,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (1, "sane_init: NEC (Ver %d.%d)\n", NEC_MAJOR, NEC_MINOR); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (NEC_CONFIG_FILE); if (!fp) diff --git a/backend/niash.c b/backend/niash.c index 03faa36..bce6c2f 100644 --- a/backend/niash.c +++ b/backend/niash.c @@ -195,7 +195,7 @@ _UnityGammaTable (unsigned char *hwGamma) } static const SANE_Range rangeXmm = { 0, 220, 1 }; -static const SANE_Range rangeYmm = { 0, 296, 1 }; +static const SANE_Range rangeYmm = { 0, 297, 1 }; static const SANE_Int startUpGamma = SANE_FIX (1.6); static const char colorStr[] = { SANE_VALUE_SCAN_MODE_COLOR }; @@ -827,7 +827,7 @@ sane_init (SANE_Int * piVersion, SANE_Auth_Callback __sane_unused__ pfnAuth) if (piVersion != NULL) { - *piVersion = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *piVersion = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } /* initialise transfer methods */ diff --git a/backend/p5.c b/backend/p5.c index 7e25cc1..558d9d2 100644 --- a/backend/p5.c +++ b/backend/p5.c @@ -164,12 +164,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) /* init backend debug */ DBG_INIT (); DBG (DBG_info, "SANE P5 backend version %d.%d-%d\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG (DBG_proc, "sane_init: start\n"); DBG (DBG_trace, "sane_init: init_count=%d\n", init_count); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); /* cold-plugging case : probe for already plugged devices */ status = probe_p5_devices (); diff --git a/backend/pie.c b/backend/pie.c index b5be0a2..2db90dc 100644 --- a/backend/pie.c +++ b/backend/pie.c @@ -2936,7 +2936,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG (DBG_sane_init, "sane_init() build %d\n", BUILD); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); fp = sanei_config_open (PIE_CONFIG_FILE); if (!fp) diff --git a/backend/pieusb.c b/backend/pieusb.c index a070fc0..f8dc073 100644 --- a/backend/pieusb.c +++ b/backend/pieusb.c @@ -110,6 +110,8 @@ extern void write_tiff_rgbi_header (FILE *fptr, int width, int height, int depth /* device flags */ #define FLAG_SLIDE_TRANSPORT 0x01 +/* Some scanners do understand SLIDE_TRANSPORT but not CMD_17 - introducing a new flag */ +#define FLAG_CMD_17_NOSUPPORT 0x02 /* -------------------------------------------------------------------------- * @@ -163,7 +165,6 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG (DBG_info_sane, "sane_init() build %d\n", BUILD); /* Set version code to current major, minor and build number */ - /* TODO: use V_MINOR instead or SANE_CURRENT_MINOR? If so, why? */ if (version_code) *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); @@ -1004,10 +1005,12 @@ sane_start (SANE_Handle handle) /* ---------------------------------------------------------------------- * * Function 17 + * This function is not supported by all scanners which are capable of + * slide transport, therefore FLAG_CMD_17_NOSUPPORT was introduced. * * ---------------------------------------------------------------------- */ - if (scanner->device->flags & FLAG_SLIDE_TRANSPORT) { + if ( (scanner->device->flags & FLAG_SLIDE_TRANSPORT) & !(scanner->device->flags & FLAG_CMD_17_NOSUPPORT) ) { sanei_pieusb_cmd_17 (scanner->device_number, 1, &status); if (status.pieusb_status != PIEUSB_STATUS_GOOD) { DBG (DBG_error, "sane_start(): sanei_pieusb_cmd_17 failed: %d\n", status.pieusb_status); diff --git a/backend/pieusb.conf.in b/backend/pieusb.conf.in index 8904d3d..df9a194 100644 --- a/backend/pieusb.conf.in +++ b/backend/pieusb.conf.in @@ -16,5 +16,7 @@ usb 0x05e3 0x0145 0x47 0x00 # Reflecta CrystalScan 3600 usb 0x05e3 0x0145 0x2e 0x00 -# Reflecta DigitDia 4000 -usb 0x05e3 0x0142 0x2f 0x00 +# Reflecta DigitDia 4000 - SLIDE_TRANSPORT but no CMD_17 +usb 0x05e3 0x0142 0x2f 0x03 +# Reflecta RPS 10M (aka Pacific Image PrimeFilm XAs) +usb 0x05e3 0x0144 0x0048 0x00 diff --git a/backend/pieusb_specific.c b/backend/pieusb_specific.c index 033ad03..e5471ee 100644 --- a/backend/pieusb_specific.c +++ b/backend/pieusb_specific.c @@ -753,7 +753,7 @@ sanei_pieusb_init_options (Pieusb_Scanner* scanner) scanner->opt[OPT_FAST_INFRARED].cap |= SANE_CAP_SOFT_SELECT; /* automatically advance to next slide after scan */ - scanner->opt[OPT_ADVANCE_SLIDE].name = "advcane"; + scanner->opt[OPT_ADVANCE_SLIDE].name = "advance"; scanner->opt[OPT_ADVANCE_SLIDE].title = "Advance slide"; scanner->opt[OPT_ADVANCE_SLIDE].desc = "Automatically advance to next slide after scan"; scanner->opt[OPT_ADVANCE_SLIDE].type = SANE_TYPE_BOOL; diff --git a/backend/pint.c b/backend/pint.c index 7ab53e5..cc8137b 100644 --- a/backend/pint.c +++ b/backend/pint.c @@ -573,7 +573,7 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authorize) DBG_INIT(); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (PINT_CONFIG_FILE); if (!fp) diff --git a/backend/pixma/pixma.c b/backend/pixma/pixma.c index b4e423d..31e71f0 100644 --- a/backend/pixma/pixma.c +++ b/backend/pixma/pixma.c @@ -1661,7 +1661,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) if (!version_code) return SANE_STATUS_INVAL; myversion = 100 * PIXMA_VERSION_MAJOR + PIXMA_VERSION_MINOR; - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, myversion); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, myversion); DBG_INIT (); sanei_thread_init (); pixma_set_debug_level (DBG_LEVEL); diff --git a/backend/pixma/pixma_common.c b/backend/pixma/pixma_common.c index 6bce4bc..24912b8 100644 --- a/backend/pixma/pixma_common.c +++ b/backend/pixma/pixma_common.c @@ -968,16 +968,16 @@ pixma_read_image (pixma_t * s, void *buf, unsigned len) s->last_source = s->param->source; if ((s->cur_image_size != s->param->image_size) && !s->param->mode_jpeg) { - pixma_dbg (1, "WARNING:image size mismatches\n"); - pixma_dbg (1, + PDBG (pixma_dbg (1, "WARNING:image size mismatches\n")); + PDBG (pixma_dbg (1, " %"PRIu64" expected (%d lines) but %"PRIu64" received (%"PRIu64" lines)\n", s->param->image_size, s->param->h, s->cur_image_size, - s->cur_image_size / s->param->line_size); + s->cur_image_size / s->param->line_size)); if ((s->cur_image_size % s->param->line_size) != 0) { - pixma_dbg (1, - "BUG:received data not multiple of line_size\n"); + PDBG (pixma_dbg (1, + "BUG:received data not multiple of line_size\n")); } } if ((s->cur_image_size < s->param->image_size) && !s->param->mode_jpeg) diff --git a/backend/plustek.c b/backend/plustek.c index 10458a0..96fd04f 100644 --- a/backend/plustek.c +++ b/backend/plustek.c @@ -1465,7 +1465,7 @@ sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize ) usbGetList( &usbDevs ); if( version_code != NULL ) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open( PLUSTEK_CONFIG_FILE ); diff --git a/backend/plustek_pp.c b/backend/plustek_pp.c index 76a8789..af91c99 100644 --- a/backend/plustek_pp.c +++ b/backend/plustek_pp.c @@ -1166,7 +1166,7 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize ) #endif if( version_code != NULL ) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open( PLUSTEK_CONFIG_FILE ); diff --git a/backend/pnm.c b/backend/pnm.c index ccc6f64..0ace3a5 100644 --- a/backend/pnm.c +++ b/backend/pnm.c @@ -509,10 +509,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (2, "sane_init: version_code %s 0, authorize %s 0\n", version_code == 0 ? "=" : "!=", authorize == 0 ? "=" : "!="); DBG (1, "sane_init: SANE pnm backend version %d.%d.%d from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); return SANE_STATUS_GOOD; } diff --git a/backend/qcam.c b/backend/qcam.c index 9b1d7a3..9d55055 100644 --- a/backend/qcam.c +++ b/backend/qcam.c @@ -1461,7 +1461,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (1, "sane_init: enter\n"); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (QCAM_CONFIG_FILE); if (!fp) diff --git a/backend/ricoh.c b/backend/ricoh.c index eb692c9..d1f20c0 100644 --- a/backend/ricoh.c +++ b/backend/ricoh.c @@ -495,7 +495,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) #endif if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open(RICOH_CONFIG_FILE); if (fp) diff --git a/backend/ricoh2.c b/backend/ricoh2.c index e8f8604..e145b65 100644 --- a/backend/ricoh2.c +++ b/backend/ricoh2.c @@ -293,7 +293,7 @@ sane_init (SANE_Int *vc, SANE_Auth_Callback __sane_unused__ cb) } if (vc) - *vc = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *vc = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); DBG(8, " #include #include "sm3600-scantool.h" diff --git a/backend/sm3600.c b/backend/sm3600.c index 8542e3e..e1df6b0 100644 --- a/backend/sm3600.c +++ b/backend/sm3600.c @@ -390,9 +390,9 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authCB) DBG(DEBUG_VERBOSE,"SM3600 init\n"); if (version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); DBG(DEBUG_VERBOSE,"SM3600 version: %x\n", - SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, BUILD)); + SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD)); } pdevFirst=NULL; diff --git a/backend/sm3840.c b/backend/sm3840.c index b728128..159f600 100644 --- a/backend/sm3840.c +++ b/backend/sm3840.c @@ -549,7 +549,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) { DBG_INIT (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); if (authorize) DBG (2, "Unused authorize\n"); diff --git a/backend/sp15c.c b/backend/sp15c.c index 6feada5..a3ad5c2 100644 --- a/backend/sp15c.c +++ b/backend/sp15c.c @@ -281,7 +281,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) sanei_thread_init (); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (SP15C_CONFIG_FILE); if (!fp) { diff --git a/backend/st400.c b/backend/st400.c index 487dbd1..a75807f 100644 --- a/backend/st400.c +++ b/backend/st400.c @@ -680,7 +680,7 @@ sane_init( SANE_Int *versionP, SANE_Auth_Callback authorize ) DBG(DCODE, "sane_init: version %s null, authorize %s null\n", (versionP) ? "!=" : "==", (authorize) ? "!=" : "=="); if( versionP != NULL ) - *versionP = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, 0); + *versionP = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); status = SANE_STATUS_GOOD; if( (fp = sanei_config_open(ST400_CONFIG_FILE)) != NULL ) { diff --git a/backend/stv680.c b/backend/stv680.c index cab59b4..eb9add5 100644 --- a/backend/stv680.c +++ b/backend/stv680.c @@ -1523,12 +1523,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) authorize = authorize; /* silence gcc */ DBG (DBG_error, "This is sane-stv680 version %d.%d-%d\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD); + SANE_CURRENT_MINOR, BUILD); DBG (DBG_error, "(C) 2004-2006 by Gerard Klaver\n"); if (version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } DBG (DBG_proc, "sane_init: authorize %s null\n", authorize ? "!=" : "=="); diff --git a/backend/tamarack.c b/backend/tamarack.c index 38e0aad..38cc7ea 100644 --- a/backend/tamarack.c +++ b/backend/tamarack.c @@ -916,7 +916,7 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authorize) sanei_thread_init(); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open (TAMARACK_CONFIG_FILE); if (!fp) { diff --git a/backend/teco1.c b/backend/teco1.c index 6462ac2..1ba0dff 100644 --- a/backend/teco1.c +++ b/backend/teco1.c @@ -1476,12 +1476,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG (DBG_sane_init, "sane_init\n"); DBG (DBG_error, "This is sane-teco1 version %d.%d-%d\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD); + SANE_CURRENT_MINOR, BUILD); DBG (DBG_error, "(C) 2002 by Frank Zago\n"); if (version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } fp = sanei_config_open (TECO_CONFIG_FILE); diff --git a/backend/teco2.c b/backend/teco2.c index 01fb667..fd3aa5f 100644 --- a/backend/teco2.c +++ b/backend/teco2.c @@ -2519,12 +2519,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG (DBG_sane_init, "sane_init\n"); DBG (DBG_error, "This is sane-teco2 version %d.%d-%d\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD); + SANE_CURRENT_MINOR, BUILD); DBG (DBG_error, "(C) 2002 - 2003 by Frank Zago, update 2003 - 2008 by Gerard Klaver\n"); if (version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } fp = sanei_config_open (TECO2_CONFIG_FILE); diff --git a/backend/teco3.c b/backend/teco3.c index 6a0c61f..d568a5e 100644 --- a/backend/teco3.c +++ b/backend/teco3.c @@ -1498,12 +1498,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize DBG (DBG_sane_init, "sane_init\n"); DBG (DBG_error, "This is sane-teco3 version %d.%d-%d\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD); + SANE_CURRENT_MINOR, BUILD); DBG (DBG_error, "(C) 2002 by Frank Zago\n"); if (version_code) { - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } fp = sanei_config_open (TECO_CONFIG_FILE); diff --git a/backend/test.c b/backend/test.c index 075fdfa..3c7a949 100644 --- a/backend/test.c +++ b/backend/test.c @@ -1637,10 +1637,10 @@ sane_init (SANE_Int * __sane_unused__ version_code, SANE_Auth_Callback __sane_un previous_device = 0; DBG (1, "sane_init: SANE test backend version %d.%d.%d from %s\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); if (inited) DBG (3, "sane_init: warning: already inited\n"); diff --git a/backend/u12.c b/backend/u12.c index 7434552..c7bc51a 100644 --- a/backend/u12.c +++ b/backend/u12.c @@ -941,7 +941,7 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize ) init_config_struct( &config ); if( version_code != NULL ) - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, 0); + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, 0); fp = sanei_config_open( U12_CONFIG_FILE ); diff --git a/backend/umax.c b/backend/umax.c index 9cefc08..d6551c5 100644 --- a/backend/umax.c +++ b/backend/umax.c @@ -5987,7 +5987,7 @@ SANE_Status sane_init(SANE_Int *version_code, SANE_Auth_Callback authorize) DBG_INIT(); DBG(DBG_sane_init,"sane_init\n"); - DBG(DBG_error,"This is sane-umax version %d.%d build %d\n", SANE_CURRENT_MAJOR, V_MINOR, BUILD); + DBG(DBG_error,"This is sane-umax version %d.%d build %d\n", SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); #ifdef UMAX_ENABLE_USB DBG(DBG_error,"compiled with USB support for Astra 2200\n"); #else @@ -5998,7 +5998,7 @@ SANE_Status sane_init(SANE_Int *version_code, SANE_Auth_Callback authorize) if (version_code) { - *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); } frontend_authorize_callback = authorize; /* store frontend authorize callback */ diff --git a/backend/umax1220u.c b/backend/umax1220u.c index 6e8d95f..8c6098c 100644 --- a/backend/umax1220u.c +++ b/backend/umax1220u.c @@ -593,10 +593,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (2, "sane_init: version_code %s 0, authorize %s 0\n", version_code == 0 ? "=" : "!=", authorize == 0 ? "=" : "!="); DBG (1, "sane_init: SANE umax1220u backend version %d.%d.%d from %s\n", - SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); sanei_usb_init (); sanei_pv8630_init (); diff --git a/backend/umax_pp.c b/backend/umax_pp.c index 4a4ab8a..e705a77 100644 --- a/backend/umax_pp.c +++ b/backend/umax_pp.c @@ -833,9 +833,9 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) } if (version_code != NULL) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, UMAX_PP_BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, UMAX_PP_BUILD); - DBG (3, "init: SANE v%s, backend v%d.%d.%d-%s\n", VERSION, SANE_CURRENT_MAJOR, V_MINOR, + DBG (3, "init: SANE v%s, backend v%d.%d.%d-%s\n", VERSION, SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, UMAX_PP_BUILD, UMAX_PP_STATE); /* set up configuration options to parse */ diff --git a/backend/umax_pp.h b/backend/umax_pp.h index ffff012..c41328b 100644 --- a/backend/umax_pp.h +++ b/backend/umax_pp.h @@ -192,7 +192,7 @@ enum Umax_PP_Configure_Option }; #define DEBUG() DBG(4, "%s(v%d.%d.%d-%s): line %d: debug exception\n", \ - __func__, SANE_CURRENT_MAJOR, V_MINOR, \ + __func__, SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, \ UMAX_PP_BUILD, UMAX_PP_STATE, __LINE__) #endif /* umax_pp_h */ diff --git a/backend/v4l.c b/backend/v4l.c index b15e5d1..bce3c3a 100644 --- a/backend/v4l.c +++ b/backend/v4l.c @@ -438,10 +438,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG_INIT (); DBG (2, "SANE v4l backend version %d.%d build %d from %s\n", SANE_CURRENT_MAJOR, - V_MINOR, BUILD, PACKAGE_STRING); + SANE_CURRENT_MINOR, BUILD, PACKAGE_STRING); if (version_code) - *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); + *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BUILD); fp = sanei_config_open (V4L_CONFIG_FILE); if (!fp) diff --git a/backend/xerox_mfp.c b/backend/xerox_mfp.c index edd6e64..310dc53 100644 --- a/backend/xerox_mfp.c +++ b/backend/xerox_mfp.c @@ -1042,7 +1042,7 @@ sane_init(SANE_Int *version_code, SANE_Auth_Callback cb) (version_code) ? "!=" : "==", (cb) ? "!=" : "=="); if (version_code) - *version_code = SANE_VERSION_CODE(V_MAJOR, V_MINOR, BACKEND_BUILD); + *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, BACKEND_BUILD); sanei_usb_init(); return SANE_STATUS_GOOD; -- cgit v1.2.3