kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'master' into 'master'
Add new backend ricoh2 See merge request sane-project/backends!20merge-requests/37/head
commit
0af6149aa8
1
AUTHORS
1
AUTHORS
|
@ -88,6 +88,7 @@ Backends:
|
|||
despeckling filter by Patrick Reynolds,
|
||||
B&W fixes by Andrew Kuchling
|
||||
ricoh: Feico W. Dillema
|
||||
ricoh2: Stanislav Yuzvinsky
|
||||
rts8891: Stéphane Voltz
|
||||
s9036: Ingo Schneider
|
||||
sceptre: Frank Zago
|
||||
|
|
|
@ -197,8 +197,8 @@ CSCOPE = cscope
|
|||
am__DIST_COMMON = $(srcdir)/Makefile.in \
|
||||
$(top_srcdir)/include/sane/config.h.in ABOUT-NLS AUTHORS \
|
||||
COPYING ChangeLog INSTALL NEWS README ar-lib compile \
|
||||
config.guess config.rpath config.sub install-sh ltmain.sh \
|
||||
missing mkinstalldirs
|
||||
config.guess config.rpath config.sub depcomp install-sh \
|
||||
ltmain.sh missing mkinstalldirs
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
|
|
@ -21,7 +21,7 @@ If you have problems, you may need to regenerate the build system entirely.
|
|||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
dnl serial 11 (pkg-config-0.29)
|
||||
dnl serial 11 (pkg-config-0.29.1)
|
||||
dnl
|
||||
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
||||
|
@ -63,7 +63,7 @@ dnl
|
|||
dnl See the "Since" comment for each macro you use to see what version
|
||||
dnl of the macros you require.
|
||||
m4_defun([PKG_PREREQ],
|
||||
[m4_define([PKG_MACROS_VERSION], [0.29])
|
||||
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
||||
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
||||
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
||||
])dnl PKG_PREREQ
|
||||
|
|
|
@ -165,7 +165,7 @@ be_convenience_libs = libabaton.la libagfafocus.la \
|
|||
libniash.la libp5.la \
|
||||
libpie.la libpieusb.la libpint.la libpixma.la \
|
||||
libplustek.la libplustek_pp.la libpnm.la \
|
||||
libqcam.la libricoh.la librts8891.la \
|
||||
libqcam.la libricoh.la libricoh2.la librts8891.la \
|
||||
libs9036.la libsceptre.la libsharp.la \
|
||||
libsm3600.la libsm3840.la libsnapscan.la \
|
||||
libsp15c.la libst400.la libstv680.la \
|
||||
|
@ -199,7 +199,7 @@ be_dlopen_libs = libsane-abaton.la libsane-agfafocus.la \
|
|||
libsane-niash.la libsane-p5.la \
|
||||
libsane-pie.la libsane-pieusb.la libsane-pint.la libsane-pixma.la \
|
||||
libsane-plustek.la libsane-plustek_pp.la libsane-pnm.la \
|
||||
libsane-qcam.la libsane-ricoh.la libsane-rts8891.la \
|
||||
libsane-qcam.la libsane-ricoh.la libsane-ricoh2.la libsane-rts8891.la \
|
||||
libsane-s9036.la libsane-sceptre.la libsane-sharp.la \
|
||||
libsane-sm3600.la libsane-sm3840.la libsane-snapscan.la \
|
||||
libsane-sp15c.la libsane-st400.la libsane-stv680.la \
|
||||
|
@ -885,6 +885,15 @@ EXTRA_DIST += ricoh.conf.in
|
|||
# TODO: Why are these distributed but not compiled?
|
||||
EXTRA_DIST += ricoh-scsi.c
|
||||
|
||||
libricoh2_la_SOURCES = ricoh2.c
|
||||
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)
|
||||
EXTRA_DIST += ricoh2_buffer.c
|
||||
|
||||
librts8891_la_SOURCES = rts8891.c rts8891.h rts88xx_lib.c rts88xx_lib.h
|
||||
librts8891_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=rts8891
|
||||
|
||||
|
|
|
@ -377,6 +377,9 @@ libqcam_la_OBJECTS = $(am_libqcam_la_OBJECTS)
|
|||
libricoh_la_LIBADD =
|
||||
am_libricoh_la_OBJECTS = libricoh_la-ricoh.lo
|
||||
libricoh_la_OBJECTS = $(am_libricoh_la_OBJECTS)
|
||||
libricoh2_la_LIBADD =
|
||||
am_libricoh2_la_OBJECTS = libricoh2_la-ricoh2.lo
|
||||
libricoh2_la_OBJECTS = $(am_libricoh2_la_OBJECTS)
|
||||
librts8891_la_LIBADD =
|
||||
am_librts8891_la_OBJECTS = librts8891_la-rts8891.lo \
|
||||
librts8891_la-rts88xx_lib.lo
|
||||
|
@ -1141,6 +1144,7 @@ libsane_pixma_la_DEPENDENCIES = $(COMMON_LIBS) libpixma.la \
|
|||
../sanei/sanei_usb.lo ../sanei/sanei_thread.lo \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1)
|
||||
nodist_libsane_pixma_la_OBJECTS = libsane_pixma_la-pixma-s.lo
|
||||
libsane_pixma_la_OBJECTS = $(nodist_libsane_pixma_la_OBJECTS)
|
||||
|
@ -1205,6 +1209,16 @@ libsane_ricoh_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
|||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
|
||||
$(AM_CFLAGS) $(CFLAGS) $(libsane_ricoh_la_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
libsane_ricoh2_la_DEPENDENCIES = $(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 $(am__DEPENDENCIES_1)
|
||||
nodist_libsane_ricoh2_la_OBJECTS = libsane_ricoh2_la-ricoh2-s.lo
|
||||
libsane_ricoh2_la_OBJECTS = $(nodist_libsane_ricoh2_la_OBJECTS)
|
||||
libsane_ricoh2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
||||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
|
||||
$(AM_CFLAGS) $(CFLAGS) $(libsane_ricoh2_la_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
libsane_rts8891_la_DEPENDENCIES = $(COMMON_LIBS) librts8891.la \
|
||||
../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo \
|
||||
../sanei/sanei_config.lo sane_strstatus.lo \
|
||||
|
@ -1614,8 +1628,8 @@ SOURCES = $(libabaton_la_SOURCES) $(libagfafocus_la_SOURCES) \
|
|||
$(libpixma_la_SOURCES) $(libplustek_la_SOURCES) \
|
||||
$(libplustek_pp_la_SOURCES) $(libpnm_la_SOURCES) \
|
||||
$(libqcam_la_SOURCES) $(libricoh_la_SOURCES) \
|
||||
$(librts8891_la_SOURCES) $(libs9036_la_SOURCES) \
|
||||
$(nodist_libsane_abaton_la_SOURCES) \
|
||||
$(libricoh2_la_SOURCES) $(librts8891_la_SOURCES) \
|
||||
$(libs9036_la_SOURCES) $(nodist_libsane_abaton_la_SOURCES) \
|
||||
$(nodist_libsane_agfafocus_la_SOURCES) \
|
||||
$(nodist_libsane_apple_la_SOURCES) \
|
||||
$(nodist_libsane_artec_la_SOURCES) \
|
||||
|
@ -1684,6 +1698,7 @@ SOURCES = $(libabaton_la_SOURCES) $(libagfafocus_la_SOURCES) \
|
|||
$(nodist_libsane_pnm_la_SOURCES) \
|
||||
$(nodist_libsane_qcam_la_SOURCES) \
|
||||
$(nodist_libsane_ricoh_la_SOURCES) \
|
||||
$(nodist_libsane_ricoh2_la_SOURCES) \
|
||||
$(nodist_libsane_rts8891_la_SOURCES) \
|
||||
$(nodist_libsane_s9036_la_SOURCES) \
|
||||
$(nodist_libsane_sceptre_la_SOURCES) \
|
||||
|
@ -1750,17 +1765,17 @@ DIST_SOURCES = $(libabaton_la_SOURCES) $(libagfafocus_la_SOURCES) \
|
|||
$(libpixma_la_SOURCES) $(libplustek_la_SOURCES) \
|
||||
$(libplustek_pp_la_SOURCES) $(libpnm_la_SOURCES) \
|
||||
$(libqcam_la_SOURCES) $(libricoh_la_SOURCES) \
|
||||
$(librts8891_la_SOURCES) $(libs9036_la_SOURCES) \
|
||||
$(libsceptre_la_SOURCES) $(libsharp_la_SOURCES) \
|
||||
$(libsm3600_la_SOURCES) $(libsm3840_la_SOURCES) \
|
||||
$(libsnapscan_la_SOURCES) $(libsp15c_la_SOURCES) \
|
||||
$(libst400_la_SOURCES) $(libstv680_la_SOURCES) \
|
||||
$(libtamarack_la_SOURCES) $(libteco1_la_SOURCES) \
|
||||
$(libteco2_la_SOURCES) $(libteco3_la_SOURCES) \
|
||||
$(libtest_la_SOURCES) $(libu12_la_SOURCES) \
|
||||
$(libumax_la_SOURCES) $(libumax1220u_la_SOURCES) \
|
||||
$(libumax_pp_la_SOURCES) $(libv4l_la_SOURCES) \
|
||||
$(libxerox_mfp_la_SOURCES)
|
||||
$(libricoh2_la_SOURCES) $(librts8891_la_SOURCES) \
|
||||
$(libs9036_la_SOURCES) $(libsceptre_la_SOURCES) \
|
||||
$(libsharp_la_SOURCES) $(libsm3600_la_SOURCES) \
|
||||
$(libsm3840_la_SOURCES) $(libsnapscan_la_SOURCES) \
|
||||
$(libsp15c_la_SOURCES) $(libst400_la_SOURCES) \
|
||||
$(libstv680_la_SOURCES) $(libtamarack_la_SOURCES) \
|
||||
$(libteco1_la_SOURCES) $(libteco2_la_SOURCES) \
|
||||
$(libteco3_la_SOURCES) $(libtest_la_SOURCES) \
|
||||
$(libu12_la_SOURCES) $(libumax_la_SOURCES) \
|
||||
$(libumax1220u_la_SOURCES) $(libumax_pp_la_SOURCES) \
|
||||
$(libv4l_la_SOURCES) $(libxerox_mfp_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
|
@ -2076,24 +2091,24 @@ EXTRA_DIST = sane_strstatus.c stubs.c saned.conf.in abaton.conf.in \
|
|||
plustek-pp_scale.c plustek-pp_scan.h plustek-pp_scandata.h \
|
||||
plustek-pp_sysdep.h plustek-pp_tpa.c plustek-pp_types.h \
|
||||
plustek-pp_wrapper.c qcam.conf.in ricoh.conf.in ricoh-scsi.c \
|
||||
rts8891.conf.in rts8891_devices.c rts8891_low.c rts8891_low.h \
|
||||
s9036.conf.in sceptre.conf.in sharp.conf.in sm3600-color.c \
|
||||
sm3600-gray.c sm3600-homerun.c sm3600-scanmtek.c \
|
||||
sm3600-scantool.h sm3600-scanusb.c sm3600-scanutil.c \
|
||||
sm3840.conf.in sm3840_lib.c sm3840_lib.h sm3840_scan.c \
|
||||
snapscan.conf.in snapscan-data.c snapscan-mutex.c \
|
||||
snapscan-options.c snapscan-scsi.c snapscan-sources.c \
|
||||
snapscan-sources.h snapscan-usb.c snapscan-usb.h sp15c.conf.in \
|
||||
st400.conf.in stv680.conf.in tamarack.conf.in test.conf.in \
|
||||
test-picture.c teco1.conf.in teco2.conf.in teco3.conf.in \
|
||||
u12.conf.in 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 umax.conf.in 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 umax1220u.conf.in umax1220u-common.c \
|
||||
umax_pp.conf.in v4l.conf.in xerox_mfp.conf.in dll.conf.in \
|
||||
dll.aliases
|
||||
ricoh2_buffer.c rts8891.conf.in rts8891_devices.c \
|
||||
rts8891_low.c rts8891_low.h s9036.conf.in sceptre.conf.in \
|
||||
sharp.conf.in sm3600-color.c sm3600-gray.c sm3600-homerun.c \
|
||||
sm3600-scanmtek.c sm3600-scantool.h sm3600-scanusb.c \
|
||||
sm3600-scanutil.c sm3840.conf.in sm3840_lib.c sm3840_lib.h \
|
||||
sm3840_scan.c snapscan.conf.in snapscan-data.c \
|
||||
snapscan-mutex.c snapscan-options.c snapscan-scsi.c \
|
||||
snapscan-sources.c snapscan-sources.h snapscan-usb.c \
|
||||
snapscan-usb.h sp15c.conf.in st400.conf.in stv680.conf.in \
|
||||
tamarack.conf.in test.conf.in test-picture.c teco1.conf.in \
|
||||
teco2.conf.in teco3.conf.in u12.conf.in 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 umax.conf.in \
|
||||
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 umax1220u.conf.in \
|
||||
umax1220u-common.c umax_pp.conf.in v4l.conf.in \
|
||||
xerox_mfp.conf.in dll.conf.in dll.aliases
|
||||
|
||||
# Backends are not required to have a config file. Any backend
|
||||
# that wants to install a config file should list it here.
|
||||
|
@ -2153,7 +2168,7 @@ be_convenience_libs = libabaton.la libagfafocus.la \
|
|||
libniash.la libp5.la \
|
||||
libpie.la libpieusb.la libpint.la libpixma.la \
|
||||
libplustek.la libplustek_pp.la libpnm.la \
|
||||
libqcam.la libricoh.la librts8891.la \
|
||||
libqcam.la libricoh.la libricoh2.la librts8891.la \
|
||||
libs9036.la libsceptre.la libsharp.la \
|
||||
libsm3600.la libsm3840.la libsnapscan.la \
|
||||
libsp15c.la libst400.la libstv680.la \
|
||||
|
@ -2188,7 +2203,7 @@ be_dlopen_libs = libsane-abaton.la libsane-agfafocus.la \
|
|||
libsane-niash.la libsane-p5.la \
|
||||
libsane-pie.la libsane-pieusb.la libsane-pint.la libsane-pixma.la \
|
||||
libsane-plustek.la libsane-plustek_pp.la libsane-pnm.la \
|
||||
libsane-qcam.la libsane-ricoh.la libsane-rts8891.la \
|
||||
libsane-qcam.la libsane-ricoh.la libsane-ricoh2.la libsane-rts8891.la \
|
||||
libsane-s9036.la libsane-sceptre.la libsane-sharp.la \
|
||||
libsane-sm3600.la libsane-sm3840.la libsane-snapscan.la \
|
||||
libsane-sp15c.la libsane-st400.la libsane-stv680.la \
|
||||
|
@ -2642,6 +2657,12 @@ 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)
|
||||
libricoh2_la_SOURCES = ricoh2.c
|
||||
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)
|
||||
librts8891_la_SOURCES = rts8891.c rts8891.h rts88xx_lib.c rts88xx_lib.h
|
||||
librts8891_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=rts8891
|
||||
nodist_libsane_rts8891_la_SOURCES = rts8891-s.c
|
||||
|
@ -3120,6 +3141,9 @@ libqcam.la: $(libqcam_la_OBJECTS) $(libqcam_la_DEPENDENCIES) $(EXTRA_libqcam_la_
|
|||
libricoh.la: $(libricoh_la_OBJECTS) $(libricoh_la_DEPENDENCIES) $(EXTRA_libricoh_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) $(libricoh_la_OBJECTS) $(libricoh_la_LIBADD) $(LIBS)
|
||||
|
||||
libricoh2.la: $(libricoh2_la_OBJECTS) $(libricoh2_la_DEPENDENCIES) $(EXTRA_libricoh2_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) $(libricoh2_la_OBJECTS) $(libricoh2_la_LIBADD) $(LIBS)
|
||||
|
||||
librts8891.la: $(librts8891_la_OBJECTS) $(librts8891_la_DEPENDENCIES) $(EXTRA_librts8891_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) $(librts8891_la_OBJECTS) $(librts8891_la_LIBADD) $(LIBS)
|
||||
|
||||
|
@ -3333,6 +3357,9 @@ libsane-qcam.la: $(libsane_qcam_la_OBJECTS) $(libsane_qcam_la_DEPENDENCIES) $(EX
|
|||
libsane-ricoh.la: $(libsane_ricoh_la_OBJECTS) $(libsane_ricoh_la_DEPENDENCIES) $(EXTRA_libsane_ricoh_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libsane_ricoh_la_LINK) $(libsane_ricoh_la_OBJECTS) $(libsane_ricoh_la_LIBADD) $(LIBS)
|
||||
|
||||
libsane-ricoh2.la: $(libsane_ricoh2_la_OBJECTS) $(libsane_ricoh2_la_DEPENDENCIES) $(EXTRA_libsane_ricoh2_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libsane_ricoh2_la_LINK) $(libsane_ricoh2_la_OBJECTS) $(libsane_ricoh2_la_LIBADD) $(LIBS)
|
||||
|
||||
libsane-rts8891.la: $(libsane_rts8891_la_OBJECTS) $(libsane_rts8891_la_DEPENDENCIES) $(EXTRA_libsane_rts8891_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libsane_rts8891_la_LINK) $(libsane_rts8891_la_OBJECTS) $(libsane_rts8891_la_LIBADD) $(LIBS)
|
||||
|
||||
|
@ -3581,6 +3608,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libplustek_pp_la-plustek_pp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpnm_la-pnm.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqcam_la-qcam.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libricoh2_la-ricoh2.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libricoh_la-ricoh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librts8891_la-rts8891.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librts8891_la-rts88xx_lib.Plo@am__quote@
|
||||
|
@ -3654,6 +3682,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_plustek_pp_la-plustek_pp-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_pnm_la-pnm-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_qcam_la-qcam-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_ricoh2_la-ricoh2-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_ricoh_la-ricoh-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_rts8891_la-rts8891-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_s9036_la-s9036-s.Plo@am__quote@
|
||||
|
@ -4564,6 +4593,13 @@ libricoh_la-ricoh.lo: ricoh.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libricoh_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libricoh_la-ricoh.lo `test -f 'ricoh.c' || echo '$(srcdir)/'`ricoh.c
|
||||
|
||||
libricoh2_la-ricoh2.lo: ricoh2.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libricoh2_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libricoh2_la-ricoh2.lo -MD -MP -MF $(DEPDIR)/libricoh2_la-ricoh2.Tpo -c -o libricoh2_la-ricoh2.lo `test -f 'ricoh2.c' || echo '$(srcdir)/'`ricoh2.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libricoh2_la-ricoh2.Tpo $(DEPDIR)/libricoh2_la-ricoh2.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ricoh2.c' object='libricoh2_la-ricoh2.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libricoh2_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libricoh2_la-ricoh2.lo `test -f 'ricoh2.c' || echo '$(srcdir)/'`ricoh2.c
|
||||
|
||||
librts8891_la-rts8891.lo: rts8891.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librts8891_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librts8891_la-rts8891.lo -MD -MP -MF $(DEPDIR)/librts8891_la-rts8891.Tpo -c -o librts8891_la-rts8891.lo `test -f 'rts8891.c' || echo '$(srcdir)/'`rts8891.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librts8891_la-rts8891.Tpo $(DEPDIR)/librts8891_la-rts8891.Plo
|
||||
|
@ -5068,6 +5104,13 @@ libsane_ricoh_la-ricoh-s.lo: ricoh-s.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsane_ricoh_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsane_ricoh_la-ricoh-s.lo `test -f 'ricoh-s.c' || echo '$(srcdir)/'`ricoh-s.c
|
||||
|
||||
libsane_ricoh2_la-ricoh2-s.lo: ricoh2-s.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsane_ricoh2_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsane_ricoh2_la-ricoh2-s.lo -MD -MP -MF $(DEPDIR)/libsane_ricoh2_la-ricoh2-s.Tpo -c -o libsane_ricoh2_la-ricoh2-s.lo `test -f 'ricoh2-s.c' || echo '$(srcdir)/'`ricoh2-s.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsane_ricoh2_la-ricoh2-s.Tpo $(DEPDIR)/libsane_ricoh2_la-ricoh2-s.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ricoh2-s.c' object='libsane_ricoh2_la-ricoh2-s.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsane_ricoh2_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsane_ricoh2_la-ricoh2-s.lo `test -f 'ricoh2-s.c' || echo '$(srcdir)/'`ricoh2-s.c
|
||||
|
||||
libsane_rts8891_la-rts8891-s.lo: rts8891-s.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsane_rts8891_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsane_rts8891_la-rts8891-s.lo -MD -MP -MF $(DEPDIR)/libsane_rts8891_la-rts8891-s.Tpo -c -o libsane_rts8891_la-rts8891-s.lo `test -f 'rts8891-s.c' || echo '$(srcdir)/'`rts8891-s.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsane_rts8891_la-rts8891-s.Tpo $(DEPDIR)/libsane_rts8891_la-rts8891-s.Plo
|
||||
|
|
|
@ -0,0 +1,934 @@
|
|||
/* sane - Scanner Access Now Easy.
|
||||
|
||||
Copyright (C) 2018 Stanislav Yuzvinsky
|
||||
Based on the work done by viruxx
|
||||
|
||||
This file is part of the SANE package.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
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 "../include/sane/config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/sane/sane.h"
|
||||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/sanei_usb.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
#include "../include/sane/sanei_backend.h"
|
||||
#include "../include/sane/sanei_debug.h"
|
||||
|
||||
#include "ricoh2_buffer.c"
|
||||
|
||||
#define MAX_OPTION_STRING_SIZE 255
|
||||
#define MAX_LINE_SIZE 240 * 256 /* = 61440 */
|
||||
#define HEIGHT_PIXELS_300DPI 3508
|
||||
#define WIDTH_BYTES_300DPI 2560
|
||||
#define WIDTH_PIXELS_300DPI 2550
|
||||
#define INFO_SIZE (WIDTH_BYTES_300DPI - WIDTH_PIXELS_300DPI)
|
||||
#define USB_TIMEOUT_MS 20000
|
||||
#define MAX_COMMAND_SIZE 64
|
||||
|
||||
#define CHECK_IF(x) if (!(x)) return SANE_STATUS_INVAL
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OPT_NUM_OPTS = 0,
|
||||
OPT_MODE,
|
||||
OPT_RESOLUTION,
|
||||
|
||||
/* must come last: */
|
||||
NUM_OPTIONS
|
||||
}
|
||||
Ricoh_Options;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SCAN_MODE_COLOR,
|
||||
SCAN_MODE_GRAY
|
||||
}
|
||||
Scan_Mode;
|
||||
|
||||
|
||||
typedef struct Ricoh2_Device {
|
||||
struct Ricoh2_Device *next;
|
||||
SANE_Device sane;
|
||||
SANE_Bool active;
|
||||
|
||||
// options
|
||||
SANE_Option_Descriptor opt[NUM_OPTIONS];
|
||||
Option_Value val[NUM_OPTIONS];
|
||||
|
||||
// acquiring session
|
||||
SANE_Int dn;
|
||||
SANE_Bool cancelled;
|
||||
Scan_Mode mode;
|
||||
SANE_Int resolution;
|
||||
SANE_Bool eof;
|
||||
size_t bytes_to_read;
|
||||
ricoh2_buffer *buffer;
|
||||
|
||||
}
|
||||
Ricoh2_Device;
|
||||
|
||||
static SANE_String_Const mode_list[] = {
|
||||
SANE_VALUE_SCAN_MODE_COLOR,
|
||||
SANE_VALUE_SCAN_MODE_GRAY,
|
||||
NULL
|
||||
};
|
||||
static SANE_String_Const default_mode = SANE_VALUE_SCAN_MODE_COLOR;
|
||||
|
||||
static SANE_Int resolution_list[] = {
|
||||
2, 300, 600
|
||||
};
|
||||
static SANE_Int default_resolution = 300;
|
||||
|
||||
static SANE_Bool initialized = SANE_FALSE;
|
||||
static Ricoh2_Device *ricoh2_devices = NULL;
|
||||
static const SANE_Device **sane_devices = NULL;
|
||||
static SANE_Int num_devices = 0;
|
||||
|
||||
static Ricoh2_Device *
|
||||
lookup_handle(SANE_Handle handle)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
|
||||
for (device = ricoh2_devices; device; device = device->next)
|
||||
{
|
||||
if (device == handle)
|
||||
return device;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* get_model_by_productid(SANE_Int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0x0448: return "Aficio SP111SU";
|
||||
case 0x042c: return "Aficio SP100SU";
|
||||
default: return "Unidentified device";
|
||||
}
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
attach (SANE_String_Const devname)
|
||||
{
|
||||
SANE_Int dn = -1;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
Ricoh2_Device *device = NULL;
|
||||
SANE_Int vendor, product;
|
||||
|
||||
for (device = ricoh2_devices; device; device = device->next)
|
||||
{
|
||||
if (strcmp (device->sane.name, devname) == 0)
|
||||
{
|
||||
device->active = SANE_TRUE;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
}
|
||||
|
||||
device = (Ricoh2_Device *) malloc (sizeof (Ricoh2_Device));
|
||||
if (!device)
|
||||
{
|
||||
return SANE_STATUS_NO_MEM;
|
||||
}
|
||||
|
||||
DBG (2, "attach %s\n", devname);
|
||||
status = sanei_usb_open (devname, &dn);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (1, "attach: couldn't open device `%s': %s\n", devname,
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
|
||||
status = sanei_usb_get_vendor_product (dn, &vendor, &product);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (1,
|
||||
"attach: couldn't get vendor and product ids of device `%s': %s\n",
|
||||
devname, sane_strstatus (status));
|
||||
sanei_usb_close (dn);
|
||||
return status;
|
||||
}
|
||||
|
||||
sanei_usb_close (dn);
|
||||
device->sane.name = strdup (devname);
|
||||
device->sane.vendor = "Ricoh";
|
||||
device->sane.model = get_model_by_productid (product);
|
||||
device->sane.type = "flatbed scanner";
|
||||
device->active = SANE_TRUE;
|
||||
device->buffer = NULL;
|
||||
|
||||
device->next = ricoh2_devices;
|
||||
ricoh2_devices = device;
|
||||
|
||||
DBG (2, "Found device %s\n", device->sane.name);
|
||||
++num_devices;
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
init_options(Ricoh2_Device *dev)
|
||||
{
|
||||
SANE_Option_Descriptor *od;
|
||||
|
||||
DBG (2, "init_options: dev = %p\n", (void *) dev);
|
||||
|
||||
/* number of options */
|
||||
od = &(dev->opt[OPT_NUM_OPTS]);
|
||||
od->name = SANE_NAME_NUM_OPTIONS;
|
||||
od->title = SANE_TITLE_NUM_OPTIONS;
|
||||
od->desc = SANE_DESC_NUM_OPTIONS;
|
||||
od->type = SANE_TYPE_INT;
|
||||
od->unit = SANE_UNIT_NONE;
|
||||
od->size = sizeof (SANE_Word);
|
||||
od->cap = SANE_CAP_SOFT_DETECT;
|
||||
od->constraint_type = SANE_CONSTRAINT_NONE;
|
||||
od->constraint.range = 0;
|
||||
dev->val[OPT_NUM_OPTS].w = NUM_OPTIONS;
|
||||
|
||||
/* mode - sets the scan mode: Color, Gray */
|
||||
od = &(dev->opt[OPT_MODE]);
|
||||
od->name = SANE_NAME_SCAN_MODE;
|
||||
od->title = SANE_TITLE_SCAN_MODE;
|
||||
od->desc = SANE_DESC_SCAN_MODE;
|
||||
od->type = SANE_TYPE_STRING;
|
||||
od->unit = SANE_UNIT_NONE;
|
||||
od->size = MAX_OPTION_STRING_SIZE;
|
||||
od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
|
||||
od->constraint_type = SANE_CONSTRAINT_STRING_LIST;
|
||||
od->constraint.string_list = mode_list;
|
||||
dev->val[OPT_MODE].s = malloc (od->size);
|
||||
if (!dev->val[OPT_MODE].s)
|
||||
return SANE_STATUS_NO_MEM;
|
||||
strcpy (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR);
|
||||
|
||||
/* resolution */
|
||||
od = &(dev->opt[OPT_RESOLUTION]);
|
||||
od->name = SANE_NAME_SCAN_RESOLUTION;
|
||||
od->title = SANE_TITLE_SCAN_RESOLUTION;
|
||||
od->desc = SANE_DESC_SCAN_RESOLUTION;
|
||||
od->type = SANE_TYPE_INT;
|
||||
od->unit = SANE_UNIT_DPI;
|
||||
od->size = sizeof (SANE_Word);
|
||||
od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
|
||||
od->constraint_type = SANE_CONSTRAINT_WORD_LIST;
|
||||
od->constraint.word_list = resolution_list;
|
||||
dev->val[OPT_RESOLUTION].w = 300;
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_init (SANE_Int *vc, SANE_Auth_Callback __sane_unused__ cb)
|
||||
{
|
||||
DBG_INIT ();
|
||||
|
||||
DBG(2, "sane_init\n");
|
||||
|
||||
sanei_usb_init ();
|
||||
sanei_usb_set_timeout (USB_TIMEOUT_MS);
|
||||
|
||||
num_devices = 0;
|
||||
sanei_usb_find_devices (0x5ca, 0x042c, attach);
|
||||
sanei_usb_find_devices (0x5ca, 0x0448, attach);
|
||||
|
||||
if (vc)
|
||||
*vc = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0);
|
||||
DBG(2, "sane_init: end\n");
|
||||
|
||||
initialized = SANE_TRUE;
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_get_devices (const SANE_Device ***dl,
|
||||
SANE_Bool __sane_unused__ local)
|
||||
{
|
||||
Ricoh2_Device *device = NULL;
|
||||
SANE_Int i = 0;
|
||||
|
||||
DBG(2, "sane_get_devices\n");
|
||||
|
||||
num_devices = 0;
|
||||
sanei_usb_find_devices (0x5ca, 0x042c, attach);
|
||||
sanei_usb_find_devices (0x5ca, 0x0448, attach);
|
||||
|
||||
if (sane_devices)
|
||||
free (sane_devices);
|
||||
|
||||
sane_devices = (const SANE_Device **) malloc (sizeof (const SANE_Device *)
|
||||
* (num_devices + 1));
|
||||
if (!sane_devices)
|
||||
return SANE_STATUS_NO_MEM;
|
||||
|
||||
for (device = ricoh2_devices; device; device = device->next)
|
||||
if (device->active)
|
||||
{
|
||||
sane_devices[i++] = &(device->sane);
|
||||
}
|
||||
|
||||
sane_devices[i] = NULL;
|
||||
*dl = sane_devices;
|
||||
DBG(2, "found %i devices\n", i);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_open (SANE_String_Const name, SANE_Handle *handle)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
SANE_Status status;
|
||||
|
||||
DBG (2, "sane_open: devicename=\"%s\", handle=%p\n", name,
|
||||
(void *) handle);
|
||||
|
||||
CHECK_IF (initialized);
|
||||
CHECK_IF (handle);
|
||||
|
||||
/* walk the linked list of scanner device until there is a match
|
||||
* with the device name */
|
||||
for (device = ricoh2_devices; device; device = device->next)
|
||||
{
|
||||
DBG (2, "sane_open: devname from list: %s\n",
|
||||
device->sane.name);
|
||||
if (strcmp (name, "") == 0
|
||||
|| strcmp (name, "ricoh") == 0
|
||||
|| strcmp (name, device->sane.name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
*handle = device;
|
||||
|
||||
if (!device)
|
||||
{
|
||||
DBG (2, "sane_open: Not a Ricoh device\n");
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
status = init_options (device);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
DBG (2, "sane_open: end\n");
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
const SANE_Option_Descriptor *
|
||||
sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
|
||||
DBG (100, "sane_get_option_descriptor: handle=%p, option = %d\n",
|
||||
(void *) handle, option);
|
||||
|
||||
if (!initialized)
|
||||
return NULL;
|
||||
|
||||
/* Check for valid option number */
|
||||
if ((option < 0) || (option >= NUM_OPTIONS))
|
||||
return NULL;
|
||||
|
||||
if (!(device = lookup_handle(handle)))
|
||||
return NULL;
|
||||
|
||||
if (device->opt[option].name)
|
||||
{
|
||||
DBG (100, "sane_get_option_descriptor: name=%s\n",
|
||||
device->opt[option].name);
|
||||
}
|
||||
|
||||
return &(device->opt[option]);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_control_option (SANE_Handle handle,
|
||||
SANE_Int option,
|
||||
SANE_Action action,
|
||||
void *value,
|
||||
SANE_Word *info)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
SANE_Status status;
|
||||
|
||||
DBG (2,
|
||||
"sane_control_option: handle=%p, opt=%d, act=%d, val=%p, info=%p\n",
|
||||
(void *) handle, option, action, (void *) value, (void *) info);
|
||||
|
||||
CHECK_IF (initialized);
|
||||
device = lookup_handle (handle);
|
||||
CHECK_IF (device);
|
||||
CHECK_IF (value);
|
||||
CHECK_IF (option >= 0 && option < NUM_OPTIONS);
|
||||
CHECK_IF (device->opt[option].type != SANE_TYPE_GROUP);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case SANE_ACTION_SET_AUTO:
|
||||
CHECK_IF (SANE_OPTION_IS_SETTABLE (device->opt[option].cap));
|
||||
CHECK_IF (device->opt[option].cap & SANE_CAP_AUTOMATIC);
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case OPT_RESOLUTION:
|
||||
DBG (100,
|
||||
"Setting value to default value of %d for option %s\n",
|
||||
default_resolution,
|
||||
device->opt[option].name);
|
||||
device->val[option].w = default_resolution;
|
||||
break;
|
||||
|
||||
case OPT_MODE:
|
||||
DBG (100,
|
||||
"Setting value to default value of %s for option %s\n",
|
||||
(SANE_String_Const) default_mode,
|
||||
device->opt[option].name);
|
||||
strcpy (device->val[option].s, default_mode);
|
||||
break;
|
||||
|
||||
default:
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
break;
|
||||
|
||||
case SANE_ACTION_SET_VALUE:
|
||||
CHECK_IF (SANE_OPTION_IS_SETTABLE (device->opt[option].cap));
|
||||
|
||||
if (device->opt[option].type == SANE_TYPE_BOOL)
|
||||
{
|
||||
SANE_Bool bool_value = *(SANE_Bool *) value;
|
||||
CHECK_IF (bool_value == SANE_TRUE || bool_value == SANE_FALSE);
|
||||
}
|
||||
|
||||
if (device->opt[option].constraint_type == SANE_CONSTRAINT_RANGE)
|
||||
{
|
||||
status = sanei_constrain_value (&(device->opt[option]), value, info);
|
||||
CHECK_IF (status == SANE_STATUS_GOOD);
|
||||
}
|
||||
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case OPT_RESOLUTION:
|
||||
DBG (100,
|
||||
"Setting value to %d for option %s\n",
|
||||
*(SANE_Word *) value,
|
||||
device->opt[option].name);
|
||||
device->val[option].w = *(SANE_Word *) value;
|
||||
break;
|
||||
|
||||
case OPT_MODE:
|
||||
DBG (100,
|
||||
"Setting value to %s for option %s\n",
|
||||
(SANE_String_Const)value,
|
||||
device->opt[option].name);
|
||||
strcpy (device->val[option].s, value);
|
||||
break;
|
||||
|
||||
default:
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
break;
|
||||
|
||||
case SANE_ACTION_GET_VALUE:
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case OPT_NUM_OPTS:
|
||||
case OPT_RESOLUTION:
|
||||
*(SANE_Word *) value = device->val[option].w;
|
||||
DBG (100, "Option value = %d (%s)\n", *(SANE_Word *) value,
|
||||
device->opt[option].name);
|
||||
break;
|
||||
case OPT_MODE:
|
||||
strcpy (value, device->val[option].s);
|
||||
break;
|
||||
default:
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static void
|
||||
update_scan_params (Ricoh2_Device *device)
|
||||
{
|
||||
/* Scan mode: color or grayscale */
|
||||
if (strcmp(device->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
|
||||
{
|
||||
device->mode = SCAN_MODE_COLOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
device->mode = SCAN_MODE_GRAY;
|
||||
}
|
||||
|
||||
/* resolution: 300 or 600dpi */
|
||||
device->resolution = device->val[OPT_RESOLUTION].w;
|
||||
}
|
||||
|
||||
|
||||
SANE_Status
|
||||
sane_get_parameters (SANE_Handle handle, SANE_Parameters *params)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
|
||||
DBG (2, "sane_get_parameters: handle=%p, params=%p\n", (void *) handle,
|
||||
(void *) params);
|
||||
|
||||
CHECK_IF (initialized);
|
||||
device = lookup_handle (handle);
|
||||
CHECK_IF (device);
|
||||
CHECK_IF (params);
|
||||
|
||||
update_scan_params (device);
|
||||
|
||||
params->format =
|
||||
device->mode == SCAN_MODE_COLOR ? SANE_FRAME_RGB : SANE_FRAME_GRAY;
|
||||
params->last_frame = SANE_TRUE;
|
||||
|
||||
params->pixels_per_line = WIDTH_PIXELS_300DPI;
|
||||
params->bytes_per_line = params->pixels_per_line;
|
||||
params->lines = HEIGHT_PIXELS_300DPI;
|
||||
params->depth = 8;
|
||||
|
||||
if (device->resolution == 600)
|
||||
{
|
||||
params->bytes_per_line *= 2;
|
||||
params->pixels_per_line *= 2;
|
||||
params->lines *= 2;
|
||||
}
|
||||
|
||||
if (device->mode == SCAN_MODE_COLOR)
|
||||
{
|
||||
params->bytes_per_line *= 3;
|
||||
}
|
||||
|
||||
DBG (2, "sane_get_parametrs: format = %s bytes_per_line = %d "
|
||||
"depth = %d "
|
||||
"pixels_per_line = %d "
|
||||
"lines = %d\n",
|
||||
(params->format == SANE_FRAME_RGB ? "rgb" : "gray"),
|
||||
params->bytes_per_line,
|
||||
params->depth,
|
||||
params->pixels_per_line,
|
||||
params->lines);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SANE_Byte *send_buffer;
|
||||
size_t to_send;
|
||||
SANE_Byte *receive_buffer;
|
||||
size_t to_receive;
|
||||
}
|
||||
Send_Receive_Pair;
|
||||
|
||||
static SANE_Status
|
||||
send_receive (SANE_Int dn, Send_Receive_Pair *transfer)
|
||||
{
|
||||
SANE_Status status;
|
||||
size_t io_size;
|
||||
SANE_Byte send_buffer[MAX_COMMAND_SIZE];
|
||||
|
||||
assert(transfer->to_send <= MAX_COMMAND_SIZE);
|
||||
|
||||
memset(send_buffer, 0, MAX_COMMAND_SIZE);
|
||||
|
||||
/* send a command */
|
||||
io_size = MAX_COMMAND_SIZE;
|
||||
DBG (255, "sending a packet of size %lu\n", io_size);
|
||||
memcpy (send_buffer, transfer->send_buffer, transfer->to_send);
|
||||
status = sanei_usb_write_bulk (dn, send_buffer, &io_size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (1, "could not send packet: %s\n", sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
|
||||
/* receive a result */
|
||||
io_size = transfer->to_receive;
|
||||
DBG (255, "receiving a packet of size %lu\n", io_size);
|
||||
if (io_size)
|
||||
{
|
||||
status = sanei_usb_read_bulk (dn, transfer->receive_buffer, &io_size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (1, "could not get a response for packet: %s\n",
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
if (io_size != transfer->to_receive)
|
||||
{
|
||||
DBG (1, "unexpected size of received packet: expected %lu, "
|
||||
"received %lu\n", transfer->to_receive, io_size);
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
init_scan(SANE_Int dn, Scan_Mode mode, SANE_Int resolution)
|
||||
{
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
SANE_Byte dummy_buffer[11]; // the longest expected reply
|
||||
size_t i;
|
||||
|
||||
SANE_Byte urb_init[] = { 0x03, 0x09, 0x01 };
|
||||
SANE_Byte magic0[] = { 0x03, 0x0d, 0x0b };
|
||||
SANE_Byte magic1[] = {
|
||||
0x03, 0x0c, 0x11, 0x00, 0x00, 0x00, 0x01, 0x02, 0x05,
|
||||
0xff, 0x00, 0x00, 0x00, 0x00, 0xec, 0x13, 0x6c, 0x1b };
|
||||
SANE_Byte magic2[] = { 0x03, 0x0b, 0x08 };
|
||||
SANE_Byte magic3[] = {
|
||||
0x03, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x50, 0x6d, 0x06, 0x01 };
|
||||
|
||||
Send_Receive_Pair transfer[] =
|
||||
{
|
||||
{ urb_init, sizeof (urb_init), dummy_buffer, 1 },
|
||||
{ magic0, sizeof (magic0), dummy_buffer, 11 },
|
||||
{ magic1, sizeof (magic1), dummy_buffer, 0 },
|
||||
{ magic2, sizeof (magic2), dummy_buffer, 8 },
|
||||
{ magic3, sizeof (magic3), dummy_buffer, 0 }
|
||||
};
|
||||
|
||||
if (resolution == 600)
|
||||
magic1[6] = 0x02;
|
||||
|
||||
if (mode == SCAN_MODE_COLOR)
|
||||
magic1[7] = 0x03;
|
||||
|
||||
for (i = 0;
|
||||
i < sizeof (transfer) / sizeof (transfer[0])
|
||||
&& (status == SANE_STATUS_GOOD);
|
||||
++i)
|
||||
{
|
||||
DBG (255, "sending initialization packet %zi\n", i);
|
||||
status = send_receive (dn, transfer + i);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_start (SANE_Handle handle)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
SANE_Status status;
|
||||
SANE_Int pixels_per_line;
|
||||
SANE_Int resolution_factor = 1;
|
||||
|
||||
DBG (2, "sane_start: handle=%p\n", (void *) handle);
|
||||
|
||||
CHECK_IF (initialized);
|
||||
device = lookup_handle (handle);
|
||||
CHECK_IF (device);
|
||||
|
||||
update_scan_params (device);
|
||||
device->cancelled = SANE_FALSE;
|
||||
|
||||
status = sanei_usb_open (device->sane.name, &(device->dn));
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (1, "could not open device %s: %s\n",
|
||||
device->sane.name, sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
|
||||
DBG (2, "usb device %s opened, device number is %d\n",
|
||||
device->sane.name, device->dn);
|
||||
|
||||
status = sanei_usb_claim_interface (device->dn, 0);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (1, "could not claim interface 0: %s\n",
|
||||
sane_strstatus (status));
|
||||
sanei_usb_close (device->dn);
|
||||
return status;
|
||||
}
|
||||
|
||||
sanei_usb_set_endpoint (device->dn,
|
||||
USB_DIR_OUT | USB_ENDPOINT_TYPE_BULK,
|
||||
0x03);
|
||||
|
||||
sanei_usb_set_endpoint (device->dn,
|
||||
USB_DIR_IN | USB_ENDPOINT_TYPE_BULK,
|
||||
0x85);
|
||||
|
||||
status = sanei_usb_reset (device->dn);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (1, "could not reset device %s: %s\n",
|
||||
device->sane.name, sane_strstatus (status));
|
||||
sanei_usb_close (device->dn);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
status = init_scan (device->dn, device->mode, device->resolution);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
sanei_usb_close (device->dn);
|
||||
return status;
|
||||
}
|
||||
|
||||
resolution_factor = device->resolution == 600 ? 2 : 1;
|
||||
|
||||
pixels_per_line = WIDTH_PIXELS_300DPI * resolution_factor;
|
||||
|
||||
device->bytes_to_read =
|
||||
WIDTH_PIXELS_300DPI * resolution_factor
|
||||
* HEIGHT_PIXELS_300DPI * resolution_factor
|
||||
* (device->mode == SCAN_MODE_COLOR ? 3 : 1);
|
||||
|
||||
device->buffer =
|
||||
ricoh2_buffer_create (MAX_LINE_SIZE,
|
||||
pixels_per_line,
|
||||
INFO_SIZE * resolution_factor,
|
||||
device->mode == SCAN_MODE_COLOR);
|
||||
|
||||
DBG (2, "sane_start: to read %lu\n", device->bytes_to_read);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_read (SANE_Handle handle,
|
||||
SANE_Byte *data,
|
||||
SANE_Int maxlen,
|
||||
SANE_Int *length)
|
||||
{
|
||||
SANE_Byte read_next_command[] = { 0x03, 0x0E, 0x04, 0, 0, 0, 0, 240 };
|
||||
SANE_Byte cancel_command[] = { 0x03, 0x0a };
|
||||
SANE_Byte end_command[] = { 0x03, 0x09, 0x01 };
|
||||
|
||||
Ricoh2_Device *device;
|
||||
SANE_Status status;
|
||||
Send_Receive_Pair transfer;
|
||||
SANE_Byte dummy_buf;
|
||||
|
||||
DBG (2, "sane_read: handle=%p, data=%p, maxlen = %d, length=%p\n",
|
||||
(void *) handle, (void *) data, maxlen, (void *) length);
|
||||
|
||||
CHECK_IF (initialized);
|
||||
device = lookup_handle (handle);
|
||||
CHECK_IF (device);
|
||||
CHECK_IF (length);
|
||||
CHECK_IF (maxlen);
|
||||
|
||||
// EOF has already been reached before or acquisition process hasn't
|
||||
// been initiated at all
|
||||
if (device->bytes_to_read <= 0)
|
||||
{
|
||||
return SANE_STATUS_EOF;
|
||||
}
|
||||
|
||||
if (!ricoh2_buffer_get_bytes_remain (device->buffer))
|
||||
{
|
||||
transfer.send_buffer = read_next_command;
|
||||
transfer.to_send = sizeof (read_next_command);
|
||||
transfer.receive_buffer =
|
||||
ricoh2_buffer_get_internal_buffer (device->buffer);
|
||||
transfer.to_receive = MAX_LINE_SIZE;
|
||||
read_next_command[7] = transfer.to_receive / 256;
|
||||
|
||||
DBG (2, "Receiving data of size %zi\n", transfer.to_receive);
|
||||
|
||||
status = send_receive (device->dn, &transfer);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
device->bytes_to_read = 0;
|
||||
device->cancelled = SANE_TRUE;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
*length = ricoh2_buffer_get_data (device->buffer,
|
||||
data,
|
||||
min(maxlen, device->bytes_to_read));
|
||||
|
||||
device->bytes_to_read -= *length;
|
||||
|
||||
DBG (2,
|
||||
"Read length %d, left to read %lu\n",
|
||||
*length,
|
||||
device->bytes_to_read);
|
||||
|
||||
DBG (2,
|
||||
"%d bytes remain in the buffer\n",
|
||||
ricoh2_buffer_get_bytes_remain(device->buffer));
|
||||
|
||||
// either we've just reached expected data size
|
||||
// or the user has cancelled the process
|
||||
if ((device->bytes_to_read <= 0) || (device->cancelled))
|
||||
{
|
||||
DBG (2, "Sending cancel command\n");
|
||||
transfer.send_buffer = cancel_command;
|
||||
transfer.to_send = sizeof (cancel_command);
|
||||
transfer.receive_buffer = &dummy_buf;
|
||||
transfer.to_receive = 0;
|
||||
send_receive(device->dn, &transfer);
|
||||
|
||||
transfer.send_buffer = end_command;
|
||||
transfer.to_send = sizeof (end_command);
|
||||
transfer.receive_buffer = &dummy_buf;
|
||||
transfer.to_receive = 1;
|
||||
send_receive(device->dn, &transfer);
|
||||
|
||||
sanei_usb_close(device->dn);
|
||||
|
||||
ricoh2_buffer_dispose(device->buffer);
|
||||
device->buffer = NULL;
|
||||
}
|
||||
|
||||
if (device->cancelled)
|
||||
{
|
||||
device->cancelled = SANE_FALSE;
|
||||
return SANE_STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
if (device->bytes_to_read <= 0)
|
||||
{
|
||||
return SANE_STATUS_EOF;
|
||||
}
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_set_io_mode (SANE_Handle handle, SANE_Bool non_blocking)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
DBG (2, "sane_set_io_mode: handle = %p, non_blocking = %d\n",
|
||||
(void *) handle, non_blocking);
|
||||
|
||||
CHECK_IF (initialized);
|
||||
device = lookup_handle (handle);
|
||||
CHECK_IF (device);
|
||||
|
||||
if (non_blocking)
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_get_select_fd (SANE_Handle handle, SANE_Int *fd)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
DBG (2, "sane_get_select_fd: handle = %p, fd %s 0\n", (void *) handle,
|
||||
fd ? "!=" : "=");
|
||||
|
||||
CHECK_IF (initialized);
|
||||
device = lookup_handle (handle);
|
||||
CHECK_IF (device);
|
||||
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
void
|
||||
sane_cancel (SANE_Handle handle)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
|
||||
DBG (2, "sane_cancel: handle = %p\n", (void *) handle);
|
||||
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
if (!(device = lookup_handle(handle)))
|
||||
return;
|
||||
|
||||
device->cancelled = SANE_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
sane_close (SANE_Handle handle)
|
||||
{
|
||||
Ricoh2_Device *device;
|
||||
|
||||
DBG (2, ">sane_close\n");
|
||||
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
device = lookup_handle (handle);
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
sanei_usb_exit();
|
||||
|
||||
DBG (2, "<sane_close\n");
|
||||
}
|
||||
|
||||
void
|
||||
sane_exit (void)
|
||||
{
|
||||
Ricoh2_Device *device, *next;
|
||||
|
||||
DBG (2, "sane_exit\n");
|
||||
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
for (device = ricoh2_devices, next = device; device; device = next)
|
||||
{
|
||||
next = device->next;
|
||||
free (device);
|
||||
}
|
||||
|
||||
if (sane_devices)
|
||||
free (sane_devices);
|
||||
|
||||
sanei_usb_exit ();
|
||||
initialized = SANE_FALSE;
|
||||
}
|
|
@ -0,0 +1,229 @@
|
|||
/* sane - Scanner Access Now Easy.
|
||||
|
||||
Copyright (C) 2018 Stanislav Yuzvinsky
|
||||
Based on the work done by viruxx
|
||||
|
||||
This file is part of the SANE package.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
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 "../include/sane/config.h"
|
||||
|
||||
#include <memory.h>
|
||||
#include <assert.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../include/sane/sanei_debug.h"
|
||||
|
||||
typedef struct ricoh2_buffer
|
||||
{
|
||||
/* lifetime constants */
|
||||
SANE_Byte *data;
|
||||
SANE_Int size;
|
||||
SANE_Int pixels_per_line;
|
||||
SANE_Int info_size;
|
||||
SANE_Bool is_rgb;
|
||||
|
||||
/* state */
|
||||
SANE_Int current_position;
|
||||
SANE_Int remain_in_line;
|
||||
|
||||
}
|
||||
ricoh2_buffer;
|
||||
|
||||
static ricoh2_buffer *
|
||||
ricoh2_buffer_create (SANE_Int size,
|
||||
SANE_Int pixels_per_line,
|
||||
SANE_Int info_size,
|
||||
SANE_Bool is_rgb)
|
||||
{
|
||||
ricoh2_buffer *self;
|
||||
assert (size > 0);
|
||||
assert (pixels_per_line > 0);
|
||||
assert (info_size >= 0);
|
||||
|
||||
self = malloc (sizeof (ricoh2_buffer));
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
self->data = malloc (size);
|
||||
if (!self->data)
|
||||
{
|
||||
free (self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->size = size;
|
||||
self->pixels_per_line = pixels_per_line;
|
||||
self->info_size = info_size;
|
||||
self->is_rgb = is_rgb;
|
||||
|
||||
self->current_position = 0;
|
||||
self->remain_in_line = pixels_per_line;
|
||||
|
||||
|
||||
DBG (100,
|
||||
"size = %d pixels_per_line = %d info_size = %d rgb? = %d pos = %d\n",
|
||||
self->size,
|
||||
self->pixels_per_line,
|
||||
self->info_size,
|
||||
self->is_rgb,
|
||||
self->current_position);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/* destructor */
|
||||
static void
|
||||
ricoh2_buffer_dispose (ricoh2_buffer *self)
|
||||
{
|
||||
assert (self);
|
||||
free (self->data);
|
||||
free (self);
|
||||
}
|
||||
|
||||
static SANE_Byte *
|
||||
ricoh2_buffer_get_internal_buffer (ricoh2_buffer *self)
|
||||
{
|
||||
assert (self);
|
||||
DBG (100, "engaging a buffer of size %d\n", self->size);
|
||||
|
||||
self->current_position = 0;
|
||||
self->remain_in_line = self->pixels_per_line;
|
||||
|
||||
DBG (100, "remain in line = %d\n", self->remain_in_line);
|
||||
|
||||
return self->data;
|
||||
}
|
||||
|
||||
static SANE_Int
|
||||
ricoh2_buffer_get_bytes_remain (ricoh2_buffer *self)
|
||||
{
|
||||
assert (self);
|
||||
|
||||
DBG (100,
|
||||
"bytes remain in the buffer %d\n",
|
||||
self->size - self->current_position);
|
||||
|
||||
return self->size - self->current_position;
|
||||
}
|
||||
|
||||
inline static SANE_Int
|
||||
min (SANE_Int v1, SANE_Int v2)
|
||||
{
|
||||
return v1 < v2 ? v1 : v2;
|
||||
}
|
||||
|
||||
static SANE_Int
|
||||
ricoh2_buffer_get_data (ricoh2_buffer *self,
|
||||
SANE_Byte *dest,
|
||||
SANE_Int dest_size)
|
||||
{
|
||||
SANE_Int actually_copied = 0;
|
||||
SANE_Int pixels_to_copy;
|
||||
SANE_Int bytes_per_pixel;
|
||||
SANE_Int bytes_per_color;
|
||||
SANE_Byte *src;
|
||||
SANE_Byte *end;
|
||||
|
||||
assert (self);
|
||||
assert (dest);
|
||||
assert (self->size > self->current_position);
|
||||
|
||||
bytes_per_pixel = self->is_rgb ? 3 : 1;
|
||||
bytes_per_color = self->pixels_per_line + self->info_size;
|
||||
|
||||
DBG (2,
|
||||
"trying to get %d bytes from the buffer, "
|
||||
"while %d bytes in the line\n",
|
||||
dest_size,
|
||||
self->remain_in_line);
|
||||
|
||||
for (pixels_to_copy =
|
||||
min (dest_size / bytes_per_pixel, self->remain_in_line);
|
||||
pixels_to_copy && self->size > self->current_position;
|
||||
pixels_to_copy =
|
||||
min (dest_size / bytes_per_pixel, self->remain_in_line))
|
||||
{
|
||||
|
||||
DBG (2,
|
||||
"providing %d bytes to the user (until the end of the line), "
|
||||
"position in buffer is %d\n",
|
||||
pixels_to_copy * bytes_per_pixel,
|
||||
self->current_position);
|
||||
|
||||
for (src = self->data + self->current_position,
|
||||
end = src + pixels_to_copy;
|
||||
src < end;
|
||||
++src)
|
||||
{
|
||||
*(dest++) = *(src);
|
||||
if (bytes_per_pixel == 3)
|
||||
{
|
||||
*(dest++) = *(src + bytes_per_color);
|
||||
*(dest++) = *(src + 2 * bytes_per_color);
|
||||
}
|
||||
}
|
||||
|
||||
dest_size -= pixels_to_copy * bytes_per_pixel;
|
||||
actually_copied += pixels_to_copy * bytes_per_pixel;
|
||||
self->current_position += pixels_to_copy;
|
||||
self->remain_in_line -= pixels_to_copy;
|
||||
|
||||
// move to the next line
|
||||
if (!self->remain_in_line)
|
||||
{
|
||||
self->current_position += self->info_size;
|
||||
if (self->is_rgb)
|
||||
self->current_position += 2 * bytes_per_color;
|
||||
self->remain_in_line = self->pixels_per_line;
|
||||
DBG (100,
|
||||
"Line feed, new position is %d\n",
|
||||
self->current_position);
|
||||
}
|
||||
|
||||
DBG (100,
|
||||
"left in the buffer: %d\n",
|
||||
self->size - self->current_position);
|
||||
}
|
||||
|
||||
/* invariant */
|
||||
assert (self->size >= self->current_position);
|
||||
|
||||
return actually_copied;
|
||||
}
|
|
@ -21214,7 +21214,7 @@ ALL_BACKENDS="abaton agfafocus apple artec artec_eplus48u as6e \
|
|||
kvs40xx leo lexmark ma1509 magicolor \
|
||||
matsushita microtek microtek2 mustek mustek_pp \
|
||||
mustek_usb mustek_usb2 nec net niash pie pieusb pint \
|
||||
pixma plustek plustek_pp qcam ricoh rts8891 s9036 \
|
||||
pixma plustek plustek_pp qcam ricoh ricoh2 rts8891 s9036 \
|
||||
sceptre sharp sm3600 sm3840 snapscan sp15c st400 \
|
||||
stv680 tamarack teco1 teco2 teco3 test u12 umax
|
||||
umax_pp umax1220u v4l xerox_mfp p5"
|
||||
|
@ -21439,7 +21439,7 @@ for be in ${BACKENDS}; do
|
|||
esac
|
||||
;;
|
||||
|
||||
dc210|dc240)
|
||||
dc210|dc240|pixma)
|
||||
if test "${sane_cv_use_libjpeg}" != "yes"; then
|
||||
echo "*** $be backend requires JPEG library - $DISABLE_MSG"
|
||||
backend_supported="no"
|
||||
|
|
|
@ -597,7 +597,7 @@ ALL_BACKENDS="abaton agfafocus apple artec artec_eplus48u as6e \
|
|||
kvs40xx leo lexmark ma1509 magicolor \
|
||||
matsushita microtek microtek2 mustek mustek_pp \
|
||||
mustek_usb mustek_usb2 nec net niash pie pieusb pint \
|
||||
pixma plustek plustek_pp qcam ricoh rts8891 s9036 \
|
||||
pixma plustek plustek_pp qcam ricoh ricoh2 rts8891 s9036 \
|
||||
sceptre sharp sm3600 sm3840 snapscan sp15c st400 \
|
||||
stv680 tamarack teco1 teco2 teco3 test u12 umax
|
||||
umax_pp umax1220u v4l xerox_mfp p5"
|
||||
|
|
|
@ -24,7 +24,7 @@ BACKEND_5MANS = sane-abaton.5 sane-agfafocus.5 sane-apple.5 sane-as6e.5 \
|
|||
sane-nec.5 sane-net.5 sane-pie.5 sane-pieusb.5 sane-pint.5 sane-pnm.5 \
|
||||
sane-umax.5 sane-qcam.5 sane-scsi.5 sane-artec.5 sane-kodak.5 sane-kodakaio.5 \
|
||||
sane-fujitsu.5 sane-sharp.5 sane-s9036.5 sane-tamarack.5 \
|
||||
sane-ricoh.5 sane-avision.5 sane-plustek.5 sane-st400.5 \
|
||||
sane-ricoh.5 sane-ricoh.5 sane-avision.5 sane-plustek.5 sane-st400.5 \
|
||||
sane-mustek_pp.5 sane-dc210.5 sane-v4l.5 sane-snapscan.5 \
|
||||
sane-canon.5 sane-coolscan.5 sane-bh.5 sane-dc240.5 \
|
||||
sane-umax_pp.5 sane-umax1220u.5 sane-sm3600.5 sane-usb.5 \
|
||||
|
@ -47,7 +47,7 @@ EXTRA_DIST += sane-abaton.man sane-agfafocus.man sane-apple.man sane-as6e.man \
|
|||
sane-pie.man sane-pieusb.man sane-pint.man sane-pnm.man sane-umax.man \
|
||||
sane-qcam.man sane-scsi.man sane-artec.man sane-fujitsu.man \
|
||||
sane-sharp.man sane-s9036.man sane-tamarack.man sane-kodak.man sane-kodakaio.man\
|
||||
sane-ricoh.man sane-avision.man sane-plustek.man sane-st400.man \
|
||||
sane-ricoh.man sane-ricoh2.man sane-avision.man sane-plustek.man sane-st400.man \
|
||||
sane-mustek_pp.man sane-dc210.man sane-v4l.man sane-snapscan.man \
|
||||
sane-canon.man sane-coolscan.man sane-bh.man sane-dc240.man \
|
||||
sane-umax_pp.man sane-umax1220u.man sane-sm3600.man sane-usb.man \
|
||||
|
@ -174,7 +174,8 @@ DESC_FILES = descriptions/abaton.desc descriptions/agfafocus.desc \
|
|||
descriptions/niash.desc descriptions/pie.desc descriptions/pieusb.desc descriptions/pint.desc \
|
||||
descriptions/p5.desc descriptions/pixma.desc descriptions/plustek.desc \
|
||||
descriptions/plustek_pp.desc descriptions/pnm.desc descriptions/qcam.desc \
|
||||
descriptions/ricoh.desc descriptions/rts8891.desc descriptions/s9036.desc \
|
||||
descriptions/ricoh.desc descriptions/ricoh2.desc \
|
||||
descriptions/rts8891.desc descriptions/s9036.desc \
|
||||
descriptions/sceptre.desc descriptions/sharp.desc descriptions/sm3600.desc \
|
||||
descriptions/sm3840.desc descriptions/snapscan.desc descriptions/sp15c.desc \
|
||||
descriptions/st400.desc descriptions/stv680.desc descriptions/tamarack.desc \
|
||||
|
|
|
@ -377,24 +377,24 @@ EXTRA_DIST = scanimage.man sane-config.man sane-find-scanner.man \
|
|||
sane-pieusb.man sane-pint.man sane-pnm.man sane-umax.man \
|
||||
sane-qcam.man sane-scsi.man sane-artec.man sane-fujitsu.man \
|
||||
sane-sharp.man sane-s9036.man sane-tamarack.man sane-kodak.man \
|
||||
sane-kodakaio.man sane-ricoh.man sane-avision.man \
|
||||
sane-plustek.man sane-st400.man sane-mustek_pp.man \
|
||||
sane-dc210.man sane-v4l.man sane-snapscan.man sane-canon.man \
|
||||
sane-coolscan.man sane-bh.man sane-dc240.man sane-umax_pp.man \
|
||||
sane-umax1220u.man sane-sm3600.man sane-usb.man \
|
||||
sane-mustek_usb.man sane-sceptre.man sane-canon_pp.man \
|
||||
sane-canon630u.man sane-teco1.man sane-teco2.man \
|
||||
sane-teco3.man sane-test.man sane-sp15c.man sane-coolscan2.man \
|
||||
sane-hpsj5s.man sane-gt68xx.man sane-artec_eplus48u.man \
|
||||
sane-ma1509.man sane-ibm.man sane-hp5400.man \
|
||||
sane-plustek_pp.man sane-u12.man sane-niash.man \
|
||||
sane-sm3840.man sane-genesys.man sane-hp4200.man \
|
||||
sane-mustek_usb2.man sane-hp3500.man sane-pixma.man \
|
||||
sane-stv680.man sane-hp5590.man sane-hpljm1005.man \
|
||||
sane-cardscan.man sane-hp3900.man sane-epjitsu.man \
|
||||
sane-hs2p.man sane-canon_dr.man sane-xerox_mfp.man \
|
||||
sane-rts8891.man sane-coolscan3.man sane-kvs1025.man \
|
||||
sane-kvs20xx.man sane-kvs40xx.man sane-p5.man \
|
||||
sane-kodakaio.man sane-ricoh.man sane-ricoh2.man \
|
||||
sane-avision.man sane-plustek.man sane-st400.man \
|
||||
sane-mustek_pp.man sane-dc210.man sane-v4l.man \
|
||||
sane-snapscan.man sane-canon.man sane-coolscan.man sane-bh.man \
|
||||
sane-dc240.man sane-umax_pp.man sane-umax1220u.man \
|
||||
sane-sm3600.man sane-usb.man sane-mustek_usb.man \
|
||||
sane-sceptre.man sane-canon_pp.man sane-canon630u.man \
|
||||
sane-teco1.man sane-teco2.man sane-teco3.man sane-test.man \
|
||||
sane-sp15c.man sane-coolscan2.man sane-hpsj5s.man \
|
||||
sane-gt68xx.man sane-artec_eplus48u.man sane-ma1509.man \
|
||||
sane-ibm.man sane-hp5400.man sane-plustek_pp.man sane-u12.man \
|
||||
sane-niash.man sane-sm3840.man sane-genesys.man \
|
||||
sane-hp4200.man sane-mustek_usb2.man sane-hp3500.man \
|
||||
sane-pixma.man sane-stv680.man sane-hp5590.man \
|
||||
sane-hpljm1005.man sane-cardscan.man sane-hp3900.man \
|
||||
sane-epjitsu.man sane-hs2p.man sane-canon_dr.man \
|
||||
sane-xerox_mfp.man sane-rts8891.man sane-coolscan3.man \
|
||||
sane-kvs1025.man sane-kvs20xx.man sane-kvs40xx.man sane-p5.man \
|
||||
sane-magicolor.man sane.man saned.man descriptions.txt \
|
||||
releases.txt sane-logo2.jpg sane-logo.png sane.png \
|
||||
$(DESC_FILES) descriptions/template.desc. $(DESC_EXT_FILES) \
|
||||
|
@ -416,7 +416,7 @@ BACKEND_5MANS = sane-abaton.5 sane-agfafocus.5 sane-apple.5 sane-as6e.5 \
|
|||
sane-nec.5 sane-net.5 sane-pie.5 sane-pieusb.5 sane-pint.5 sane-pnm.5 \
|
||||
sane-umax.5 sane-qcam.5 sane-scsi.5 sane-artec.5 sane-kodak.5 sane-kodakaio.5 \
|
||||
sane-fujitsu.5 sane-sharp.5 sane-s9036.5 sane-tamarack.5 \
|
||||
sane-ricoh.5 sane-avision.5 sane-plustek.5 sane-st400.5 \
|
||||
sane-ricoh.5 sane-ricoh.5 sane-avision.5 sane-plustek.5 sane-st400.5 \
|
||||
sane-mustek_pp.5 sane-dc210.5 sane-v4l.5 sane-snapscan.5 \
|
||||
sane-canon.5 sane-coolscan.5 sane-bh.5 sane-dc240.5 \
|
||||
sane-umax_pp.5 sane-umax1220u.5 sane-sm3600.5 sane-usb.5 \
|
||||
|
@ -503,7 +503,8 @@ DESC_FILES = descriptions/abaton.desc descriptions/agfafocus.desc \
|
|||
descriptions/niash.desc descriptions/pie.desc descriptions/pieusb.desc descriptions/pint.desc \
|
||||
descriptions/p5.desc descriptions/pixma.desc descriptions/plustek.desc \
|
||||
descriptions/plustek_pp.desc descriptions/pnm.desc descriptions/qcam.desc \
|
||||
descriptions/ricoh.desc descriptions/rts8891.desc descriptions/s9036.desc \
|
||||
descriptions/ricoh.desc descriptions/ricoh2.desc \
|
||||
descriptions/rts8891.desc descriptions/s9036.desc \
|
||||
descriptions/sceptre.desc descriptions/sharp.desc descriptions/sm3600.desc \
|
||||
descriptions/sm3840.desc descriptions/snapscan.desc descriptions/sp15c.desc \
|
||||
descriptions/st400.desc descriptions/stv680.desc descriptions/tamarack.desc \
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
;
|
||||
; SANE Backend specification file
|
||||
;
|
||||
; It's basically emacs-lisp --- so ";" indicates comment to end of line.
|
||||
; All syntactic elements are keyword tokens, followed by a string or
|
||||
; keyword argument, as specified.
|
||||
;
|
||||
; ":backend" *must* be specified.
|
||||
; All other information is optional (but what good is the file without it?).
|
||||
;
|
||||
; See doc/descriptions.txt for details.
|
||||
|
||||
:backend "ricoh2" ; name of backend
|
||||
:version "1.0" ; version of backend (or "unmaintained")
|
||||
:new :yes ; Is the backend new to this SANE release?
|
||||
; :yes or :no
|
||||
:manpage "sane-ricoh2" ; name of manpage (if it exists)
|
||||
:url "http://www.ricoh.com/" ; backend's web page
|
||||
|
||||
:devicetype :scanner ; start of a list of devices....
|
||||
; other types: :stillcam, :vidcam,
|
||||
; :meta, :api
|
||||
|
||||
:mfg "Ricoh" ; name a manufacturer
|
||||
:url "http://www.ricoh.com/" ; manufacturer's URL
|
||||
|
||||
:model "SP-111SU" ; name models for above-specified mfg.
|
||||
:status :basic ; :minimal, :basic, :good, :complete
|
||||
; :untested, or :unsupported
|
||||
:interface "USB" ; interface type of the device:
|
||||
; "SCSI", "USB", "Parport (EPP)",
|
||||
; "Parport (SPP)", "Parport (ECP)",
|
||||
; "Serial port", "IEEE-1394", "JetDirect",
|
||||
; or "Proprietary".
|
||||
:usbid "0x05ca" "0x0448" ; Vendor and product ids of an USB device
|
||||
|
||||
:model "SP-100SU"
|
||||
:status :untested
|
||||
:interface "USB"
|
||||
:usbid "0x05ca" "0x042c"
|
|
@ -0,0 +1,56 @@
|
|||
.TH sane\-ricoh2 5 "28 Sep 2018" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
|
||||
.IX sane\-ricoh2
|
||||
.SH NAME
|
||||
sane\-ricoh2 \- SANE backend for Ricoh flatbed scanners
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B sane\-ricoh2
|
||||
library implements a SANE (Scanner Access Now Easy) backend that
|
||||
provides access to the following Ricoh flatbed scanners:
|
||||
.PP
|
||||
.RS
|
||||
SP-100SU
|
||||
.br
|
||||
SP-111SU
|
||||
.br
|
||||
.RE
|
||||
.PP
|
||||
.SH FILES
|
||||
.TP
|
||||
.I @LIBDIR@/libsane\-ricoh2.a
|
||||
The static library implementing this backend.
|
||||
.TP
|
||||
.I @LIBDIR@/libsane\-ricoh2.so
|
||||
The shared library implementing this backend (present on systems that
|
||||
support dynamic loading).
|
||||
|
||||
.SH OPTIONS
|
||||
The options the backend supports can either be selected through command line
|
||||
options to programs like scanimage or through GUI elements in programs like
|
||||
xscanimage or xsane.
|
||||
.PP
|
||||
The following options are supported by ricoh2:
|
||||
|
||||
.B \-\-mode color|gray
|
||||
|
||||
.RS
|
||||
Color or grayscale mode.
|
||||
.RE
|
||||
|
||||
.B \-\-resolution 300|600
|
||||
|
||||
.RS
|
||||
DPI resolution.
|
||||
|
||||
.RE
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B SANE_DEBUG_RICOH2
|
||||
If the library was compiled with debug support enabled, this
|
||||
environment variable controls the debug level for this backend. Higher
|
||||
debug levels increase the verbosity of the output.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
sane(7), sane\-scsi(5)
|
||||
.SH AUTHOR
|
||||
Stanislav Yuzvinsky
|
|
@ -448,6 +448,12 @@ scanners: IS50 and IS60. See
|
|||
.BR sane\-ricoh (5)
|
||||
for details.
|
||||
.TP
|
||||
.B ricoh2
|
||||
The ricoh2 backend provides access to the following Ricoh flatbed
|
||||
scanners: SP-100SU and SP-111SU. See
|
||||
.BR sane\-ricoh2 (5)
|
||||
for details.
|
||||
.TP
|
||||
.B s9036
|
||||
The s9036 backend provides access to Siemens 9036 flatbed scanners. See
|
||||
.BR sane\-s9036 (5)
|
||||
|
@ -903,6 +909,7 @@ for details).
|
|||
.BR sane\-pnm (5),
|
||||
.BR sane\-qcam (5),
|
||||
.BR sane\-ricoh (5),
|
||||
.BR sane\-ricoh2 (5),
|
||||
.BR sane\-s9036 (5),
|
||||
.BR sane\-sceptre (5),
|
||||
.BR sane\-scsi (5),
|
||||
|
|
Ładowanie…
Reference in New Issue