kopia lustrzana https://gitlab.com/sane-project/backends
adding new kvs40xx backend
rodzic
9441b1cdfe
commit
483b0dc488
|
@ -1,3 +1,10 @@
|
|||
2011-06-06 m. allan noah <kitno455 at gmail dot com>
|
||||
* docs/*kvs40xx*, backend/kvs40xx*: New Panasonic KV-S40xx/70xx
|
||||
backend, originally by Panasonic Russia.
|
||||
* acinclude.m4, */Makefile.am, configure*: build new kvs40xx backend
|
||||
* po/POTFILES: add new kvs40xx backend
|
||||
* po/.gitignore: ignore sane-backends.pot
|
||||
|
||||
2011-06-02 Julien Blache <jb@jblache.org>
|
||||
* tools/sane-desc.c: add udev+acl output mode, udev rules using ACLs
|
||||
for the scanner group instead of making the device root:scanner 0664.
|
||||
|
|
|
@ -640,7 +640,7 @@ for be in ${BACKENDS}; do
|
|||
fi
|
||||
;;
|
||||
|
||||
mustek_usb2)
|
||||
mustek_usb2|kvs40xx)
|
||||
if test "${have_pthread}" != "yes"; then
|
||||
echo "*** $be backend requires pthread library - $DISABLE_MSG"
|
||||
backend_supported="no"
|
||||
|
|
|
@ -176,7 +176,7 @@ be_convenience_libs = libabaton.la libagfafocus.la \
|
|||
libhp3500.la libhp3900.la libhp4200.la \
|
||||
libhp5400.la libhp5590.la libhpljm1005.la \
|
||||
libhpsj5s.la libhs2p.la libibm.la libkodak.la \
|
||||
libkvs1025.la libkvs20xx.la \
|
||||
libkvs1025.la libkvs20xx.la libkvs40xx.la \
|
||||
libleo.la liblexmark.la libma1509.la libmagicolor.la \
|
||||
libmatsushita.la libmicrotek.la libmicrotek2.la \
|
||||
libmustek.la libmustek_pp.la libmustek_usb.la \
|
||||
|
@ -209,7 +209,8 @@ be_dlopen_libs = libsane-abaton.la libsane-agfafocus.la \
|
|||
libsane-hp3500.la libsane-hp3900.la libsane-hp4200.la \
|
||||
libsane-hp5400.la libsane-hp5590.la libsane-hpljm1005.la \
|
||||
libsane-hpsj5s.la libsane-hs2p.la libsane-ibm.la libsane-kodak.la \
|
||||
libsane-kvs1025.la libsane-kvs20xx.la libsane-leo.la \
|
||||
libsane-kvs1025.la libsane-kvs20xx.la libsane-kvs40xx.la \
|
||||
libsane-leo.la \
|
||||
libsane-lexmark.la libsane-ma1509.la libsane-magicolor.la \
|
||||
libsane-matsushita.la libsane-microtek.la libsane-microtek2.la \
|
||||
libsane-mustek.la libsane-mustek_pp.la libsane-mustek_usb.la \
|
||||
|
@ -638,6 +639,15 @@ 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)
|
||||
|
||||
libkvs40xx_la_SOURCES = kvs40xx.c kvs40xx_cmd.c kvs40xx_opt.c \
|
||||
kvs40xx.h
|
||||
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)
|
||||
|
||||
libleo_la_SOURCES = leo.c leo.h
|
||||
libleo_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=leo
|
||||
|
||||
|
|
|
@ -210,6 +210,10 @@ libkvs20xx_la_LIBADD =
|
|||
am_libkvs20xx_la_OBJECTS = libkvs20xx_la-kvs20xx.lo \
|
||||
libkvs20xx_la-kvs20xx_cmd.lo libkvs20xx_la-kvs20xx_opt.lo
|
||||
libkvs20xx_la_OBJECTS = $(am_libkvs20xx_la_OBJECTS)
|
||||
libkvs40xx_la_LIBADD =
|
||||
am_libkvs40xx_la_OBJECTS = libkvs40xx_la-kvs40xx.lo \
|
||||
libkvs40xx_la-kvs40xx_cmd.lo libkvs40xx_la-kvs40xx_opt.lo
|
||||
libkvs40xx_la_OBJECTS = $(am_libkvs40xx_la_OBJECTS)
|
||||
libleo_la_LIBADD =
|
||||
am_libleo_la_OBJECTS = libleo_la-leo.lo
|
||||
libleo_la_OBJECTS = $(am_libleo_la_OBJECTS)
|
||||
|
@ -741,6 +745,17 @@ libsane_kvs20xx_la_OBJECTS = $(nodist_libsane_kvs20xx_la_OBJECTS)
|
|||
libsane_kvs20xx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libsane_kvs20xx_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
libsane_kvs40xx_la_DEPENDENCIES = $(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 \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
nodist_libsane_kvs40xx_la_OBJECTS = libsane_kvs40xx_la-kvs40xx-s.lo
|
||||
libsane_kvs40xx_la_OBJECTS = $(nodist_libsane_kvs40xx_la_OBJECTS)
|
||||
libsane_kvs40xx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libsane_kvs40xx_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
libsane_leo_la_DEPENDENCIES = $(COMMON_LIBS) libleo.la \
|
||||
../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo \
|
||||
../sanei/sanei_config.lo ../sanei/sanei_config2.lo \
|
||||
|
@ -1314,14 +1329,15 @@ SOURCES = $(libabaton_la_SOURCES) $(libagfafocus_la_SOURCES) \
|
|||
$(libhpsj5s_la_SOURCES) $(libhs2p_la_SOURCES) \
|
||||
$(libibm_la_SOURCES) $(libkodak_la_SOURCES) \
|
||||
$(libkvs1025_la_SOURCES) $(libkvs20xx_la_SOURCES) \
|
||||
$(libleo_la_SOURCES) $(liblexmark_la_SOURCES) \
|
||||
$(libma1509_la_SOURCES) $(libmagicolor_la_SOURCES) \
|
||||
$(libmatsushita_la_SOURCES) $(libmicrotek_la_SOURCES) \
|
||||
$(libmicrotek2_la_SOURCES) $(libmustek_la_SOURCES) \
|
||||
$(libmustek_pp_la_SOURCES) $(libmustek_usb_la_SOURCES) \
|
||||
$(libmustek_usb2_la_SOURCES) $(libnec_la_SOURCES) \
|
||||
$(libnet_la_SOURCES) $(libniash_la_SOURCES) \
|
||||
$(libp5_la_SOURCES) $(libpie_la_SOURCES) $(libpint_la_SOURCES) \
|
||||
$(libkvs40xx_la_SOURCES) $(libleo_la_SOURCES) \
|
||||
$(liblexmark_la_SOURCES) $(libma1509_la_SOURCES) \
|
||||
$(libmagicolor_la_SOURCES) $(libmatsushita_la_SOURCES) \
|
||||
$(libmicrotek_la_SOURCES) $(libmicrotek2_la_SOURCES) \
|
||||
$(libmustek_la_SOURCES) $(libmustek_pp_la_SOURCES) \
|
||||
$(libmustek_usb_la_SOURCES) $(libmustek_usb2_la_SOURCES) \
|
||||
$(libnec_la_SOURCES) $(libnet_la_SOURCES) \
|
||||
$(libniash_la_SOURCES) $(libp5_la_SOURCES) \
|
||||
$(libpie_la_SOURCES) $(libpint_la_SOURCES) \
|
||||
$(libpixma_la_SOURCES) $(libplustek_la_SOURCES) \
|
||||
$(libplustek_pp_la_SOURCES) $(libpnm_la_SOURCES) \
|
||||
$(libqcam_la_SOURCES) $(libricoh_la_SOURCES) \
|
||||
|
@ -1368,6 +1384,7 @@ SOURCES = $(libabaton_la_SOURCES) $(libagfafocus_la_SOURCES) \
|
|||
$(nodist_libsane_kodak_la_SOURCES) \
|
||||
$(nodist_libsane_kvs1025_la_SOURCES) \
|
||||
$(nodist_libsane_kvs20xx_la_SOURCES) \
|
||||
$(nodist_libsane_kvs40xx_la_SOURCES) \
|
||||
$(nodist_libsane_leo_la_SOURCES) \
|
||||
$(nodist_libsane_lexmark_la_SOURCES) \
|
||||
$(nodist_libsane_ma1509_la_SOURCES) \
|
||||
|
@ -1443,14 +1460,15 @@ DIST_SOURCES = $(libabaton_la_SOURCES) $(libagfafocus_la_SOURCES) \
|
|||
$(libhpsj5s_la_SOURCES) $(libhs2p_la_SOURCES) \
|
||||
$(libibm_la_SOURCES) $(libkodak_la_SOURCES) \
|
||||
$(libkvs1025_la_SOURCES) $(libkvs20xx_la_SOURCES) \
|
||||
$(libleo_la_SOURCES) $(liblexmark_la_SOURCES) \
|
||||
$(libma1509_la_SOURCES) $(libmagicolor_la_SOURCES) \
|
||||
$(libmatsushita_la_SOURCES) $(libmicrotek_la_SOURCES) \
|
||||
$(libmicrotek2_la_SOURCES) $(libmustek_la_SOURCES) \
|
||||
$(libmustek_pp_la_SOURCES) $(libmustek_usb_la_SOURCES) \
|
||||
$(libmustek_usb2_la_SOURCES) $(libnec_la_SOURCES) \
|
||||
$(libnet_la_SOURCES) $(libniash_la_SOURCES) \
|
||||
$(libp5_la_SOURCES) $(libpie_la_SOURCES) $(libpint_la_SOURCES) \
|
||||
$(libkvs40xx_la_SOURCES) $(libleo_la_SOURCES) \
|
||||
$(liblexmark_la_SOURCES) $(libma1509_la_SOURCES) \
|
||||
$(libmagicolor_la_SOURCES) $(libmatsushita_la_SOURCES) \
|
||||
$(libmicrotek_la_SOURCES) $(libmicrotek2_la_SOURCES) \
|
||||
$(libmustek_la_SOURCES) $(libmustek_pp_la_SOURCES) \
|
||||
$(libmustek_usb_la_SOURCES) $(libmustek_usb2_la_SOURCES) \
|
||||
$(libnec_la_SOURCES) $(libnet_la_SOURCES) \
|
||||
$(libniash_la_SOURCES) $(libp5_la_SOURCES) \
|
||||
$(libpie_la_SOURCES) $(libpint_la_SOURCES) \
|
||||
$(libpixma_la_SOURCES) $(libplustek_la_SOURCES) \
|
||||
$(libplustek_pp_la_SOURCES) $(libpnm_la_SOURCES) \
|
||||
$(libqcam_la_SOURCES) $(libricoh_la_SOURCES) \
|
||||
|
@ -1793,7 +1811,7 @@ be_convenience_libs = libabaton.la libagfafocus.la \
|
|||
libhp3500.la libhp3900.la libhp4200.la \
|
||||
libhp5400.la libhp5590.la libhpljm1005.la \
|
||||
libhpsj5s.la libhs2p.la libibm.la libkodak.la \
|
||||
libkvs1025.la libkvs20xx.la \
|
||||
libkvs1025.la libkvs20xx.la libkvs40xx.la \
|
||||
libleo.la liblexmark.la libma1509.la libmagicolor.la \
|
||||
libmatsushita.la libmicrotek.la libmicrotek2.la \
|
||||
libmustek.la libmustek_pp.la libmustek_usb.la \
|
||||
|
@ -1827,7 +1845,8 @@ be_dlopen_libs = libsane-abaton.la libsane-agfafocus.la \
|
|||
libsane-hp3500.la libsane-hp3900.la libsane-hp4200.la \
|
||||
libsane-hp5400.la libsane-hp5590.la libsane-hpljm1005.la \
|
||||
libsane-hpsj5s.la libsane-hs2p.la libsane-ibm.la libsane-kodak.la \
|
||||
libsane-kvs1025.la libsane-kvs20xx.la libsane-leo.la \
|
||||
libsane-kvs1025.la libsane-kvs20xx.la libsane-kvs40xx.la \
|
||||
libsane-leo.la \
|
||||
libsane-lexmark.la libsane-ma1509.la libsane-magicolor.la \
|
||||
libsane-matsushita.la libsane-microtek.la libsane-microtek2.la \
|
||||
libsane-mustek.la libsane-mustek_pp.la libsane-mustek_usb.la \
|
||||
|
@ -2117,6 +2136,14 @@ 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)
|
||||
libkvs40xx_la_SOURCES = kvs40xx.c kvs40xx_cmd.c kvs40xx_opt.c \
|
||||
kvs40xx.h
|
||||
|
||||
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)
|
||||
libleo_la_SOURCES = leo.c leo.h
|
||||
libleo_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=leo
|
||||
nodist_libsane_leo_la_SOURCES = leo-s.c
|
||||
|
@ -2411,10 +2438,10 @@ libsane_dll_la_LIBADD = $(COMMON_LIBS) libdll.la ../sanei/sanei_init_debug.lo ..
|
|||
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.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_magic.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 $(DL_LIBS) $(LIBV4L_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(TIFF_LIBS) $(JPEG_LIBS) $(GPHOTO2_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(AVAHI_LIBS) $(SCSI_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS)
|
||||
libsane_la_LIBADD = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../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 $(DL_LIBS) $(LIBV4L_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(TIFF_LIBS) $(JPEG_LIBS) $(GPHOTO2_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(AVAHI_LIBS) $(SCSI_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS)
|
||||
|
||||
# WARNING: Automake is getting this wrong so have to do it ourselves.
|
||||
libsane_la_DEPENDENCIES = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_magic.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_JPEG_LO@
|
||||
libsane_la_DEPENDENCIES = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../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_JPEG_LO@
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
|
@ -2596,6 +2623,8 @@ libkvs1025.la: $(libkvs1025_la_OBJECTS) $(libkvs1025_la_DEPENDENCIES)
|
|||
$(LINK) $(libkvs1025_la_OBJECTS) $(libkvs1025_la_LIBADD) $(LIBS)
|
||||
libkvs20xx.la: $(libkvs20xx_la_OBJECTS) $(libkvs20xx_la_DEPENDENCIES)
|
||||
$(LINK) $(libkvs20xx_la_OBJECTS) $(libkvs20xx_la_LIBADD) $(LIBS)
|
||||
libkvs40xx.la: $(libkvs40xx_la_OBJECTS) $(libkvs40xx_la_DEPENDENCIES)
|
||||
$(LINK) $(libkvs40xx_la_OBJECTS) $(libkvs40xx_la_LIBADD) $(LIBS)
|
||||
libleo.la: $(libleo_la_OBJECTS) $(libleo_la_DEPENDENCIES)
|
||||
$(LINK) $(libleo_la_OBJECTS) $(libleo_la_LIBADD) $(LIBS)
|
||||
liblexmark.la: $(liblexmark_la_OBJECTS) $(liblexmark_la_DEPENDENCIES)
|
||||
|
@ -2730,6 +2759,8 @@ libsane-kvs1025.la: $(libsane_kvs1025_la_OBJECTS) $(libsane_kvs1025_la_DEPENDENC
|
|||
$(libsane_kvs1025_la_LINK) $(libsane_kvs1025_la_OBJECTS) $(libsane_kvs1025_la_LIBADD) $(LIBS)
|
||||
libsane-kvs20xx.la: $(libsane_kvs20xx_la_OBJECTS) $(libsane_kvs20xx_la_DEPENDENCIES)
|
||||
$(libsane_kvs20xx_la_LINK) $(libsane_kvs20xx_la_OBJECTS) $(libsane_kvs20xx_la_LIBADD) $(LIBS)
|
||||
libsane-kvs40xx.la: $(libsane_kvs40xx_la_OBJECTS) $(libsane_kvs40xx_la_DEPENDENCIES)
|
||||
$(libsane_kvs40xx_la_LINK) $(libsane_kvs40xx_la_OBJECTS) $(libsane_kvs40xx_la_LIBADD) $(LIBS)
|
||||
libsane-leo.la: $(libsane_leo_la_OBJECTS) $(libsane_leo_la_DEPENDENCIES)
|
||||
$(libsane_leo_la_LINK) $(libsane_leo_la_OBJECTS) $(libsane_leo_la_LIBADD) $(LIBS)
|
||||
libsane-lexmark.la: $(libsane_lexmark_la_OBJECTS) $(libsane_lexmark_la_DEPENDENCIES)
|
||||
|
@ -2935,6 +2966,9 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkvs20xx_la-kvs20xx.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkvs20xx_la-kvs20xx_cmd.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkvs20xx_la-kvs20xx_opt.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkvs40xx_la-kvs40xx.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkvs40xx_la-kvs40xx_cmd.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkvs40xx_la-kvs40xx_opt.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libleo_la-leo.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblexmark_la-lexmark.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblexmark_la-lexmark_low.Plo@am__quote@
|
||||
|
@ -3011,6 +3045,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_kodak_la-kodak-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_kvs1025_la-kvs1025-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_kvs20xx_la-kvs20xx-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_kvs40xx_la-kvs40xx-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_la-dll-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_leo_la-leo-s.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsane_lexmark_la-lexmark-s.Plo@am__quote@
|
||||
|
@ -3591,6 +3626,27 @@ libkvs20xx_la-kvs20xx_opt.lo: kvs20xx_opt.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkvs20xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkvs20xx_la-kvs20xx_opt.lo `test -f 'kvs20xx_opt.c' || echo '$(srcdir)/'`kvs20xx_opt.c
|
||||
|
||||
libkvs40xx_la-kvs40xx.lo: kvs40xx.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkvs40xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libkvs40xx_la-kvs40xx.lo -MD -MP -MF $(DEPDIR)/libkvs40xx_la-kvs40xx.Tpo -c -o libkvs40xx_la-kvs40xx.lo `test -f 'kvs40xx.c' || echo '$(srcdir)/'`kvs40xx.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libkvs40xx_la-kvs40xx.Tpo $(DEPDIR)/libkvs40xx_la-kvs40xx.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kvs40xx.c' object='libkvs40xx_la-kvs40xx.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkvs40xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkvs40xx_la-kvs40xx.lo `test -f 'kvs40xx.c' || echo '$(srcdir)/'`kvs40xx.c
|
||||
|
||||
libkvs40xx_la-kvs40xx_cmd.lo: kvs40xx_cmd.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkvs40xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libkvs40xx_la-kvs40xx_cmd.lo -MD -MP -MF $(DEPDIR)/libkvs40xx_la-kvs40xx_cmd.Tpo -c -o libkvs40xx_la-kvs40xx_cmd.lo `test -f 'kvs40xx_cmd.c' || echo '$(srcdir)/'`kvs40xx_cmd.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libkvs40xx_la-kvs40xx_cmd.Tpo $(DEPDIR)/libkvs40xx_la-kvs40xx_cmd.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kvs40xx_cmd.c' object='libkvs40xx_la-kvs40xx_cmd.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkvs40xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkvs40xx_la-kvs40xx_cmd.lo `test -f 'kvs40xx_cmd.c' || echo '$(srcdir)/'`kvs40xx_cmd.c
|
||||
|
||||
libkvs40xx_la-kvs40xx_opt.lo: kvs40xx_opt.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkvs40xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libkvs40xx_la-kvs40xx_opt.lo -MD -MP -MF $(DEPDIR)/libkvs40xx_la-kvs40xx_opt.Tpo -c -o libkvs40xx_la-kvs40xx_opt.lo `test -f 'kvs40xx_opt.c' || echo '$(srcdir)/'`kvs40xx_opt.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libkvs40xx_la-kvs40xx_opt.Tpo $(DEPDIR)/libkvs40xx_la-kvs40xx_opt.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kvs40xx_opt.c' object='libkvs40xx_la-kvs40xx_opt.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkvs40xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkvs40xx_la-kvs40xx_opt.lo `test -f 'kvs40xx_opt.c' || echo '$(srcdir)/'`kvs40xx_opt.c
|
||||
|
||||
libleo_la-leo.lo: leo.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libleo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libleo_la-leo.lo -MD -MP -MF $(DEPDIR)/libleo_la-leo.Tpo -c -o libleo_la-leo.lo `test -f 'leo.c' || echo '$(srcdir)/'`leo.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libleo_la-leo.Tpo $(DEPDIR)/libleo_la-leo.Plo
|
||||
|
@ -4123,6 +4179,13 @@ libsane_kvs20xx_la-kvs20xx-s.lo: kvs20xx-s.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsane_kvs20xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsane_kvs20xx_la-kvs20xx-s.lo `test -f 'kvs20xx-s.c' || echo '$(srcdir)/'`kvs20xx-s.c
|
||||
|
||||
libsane_kvs40xx_la-kvs40xx-s.lo: kvs40xx-s.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsane_kvs40xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsane_kvs40xx_la-kvs40xx-s.lo -MD -MP -MF $(DEPDIR)/libsane_kvs40xx_la-kvs40xx-s.Tpo -c -o libsane_kvs40xx_la-kvs40xx-s.lo `test -f 'kvs40xx-s.c' || echo '$(srcdir)/'`kvs40xx-s.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libsane_kvs40xx_la-kvs40xx-s.Tpo $(DEPDIR)/libsane_kvs40xx_la-kvs40xx-s.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='kvs40xx-s.c' object='libsane_kvs40xx_la-kvs40xx-s.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsane_kvs40xx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsane_kvs40xx_la-kvs40xx-s.lo `test -f 'kvs40xx-s.c' || echo '$(srcdir)/'`kvs40xx-s.c
|
||||
|
||||
libsane_leo_la-leo-s.lo: leo-s.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsane_leo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsane_leo_la-leo-s.lo -MD -MP -MF $(DEPDIR)/libsane_leo_la-leo-s.Tpo -c -o libsane_leo_la-leo-s.lo `test -f 'leo-s.c' || echo '$(srcdir)/'`leo-s.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libsane_leo_la-leo-s.Tpo $(DEPDIR)/libsane_leo_la-leo-s.Plo
|
||||
|
|
|
@ -0,0 +1,747 @@
|
|||
/*
|
||||
Copyright (C) 2009, Panasonic Russia Ltd.
|
||||
Copyright (C) 2010,2011, m. allan noah
|
||||
*/
|
||||
/*
|
||||
Panasonic KV-S40xx USB-SCSI scanner driver.
|
||||
*/
|
||||
|
||||
#include "../include/sane/config.h"
|
||||
|
||||
#include <ctype.h> /*isspace*/
|
||||
#include <math.h> /*tan*/
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#define DEBUG_NOT_STATIC
|
||||
#include "../include/sane/sanei_backend.h"
|
||||
#include "../include/sane/sane.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/sanei_config.h"
|
||||
#include "../include/sane/sanei_usb.h"
|
||||
#include "../include/sane/sanei_scsi.h"
|
||||
#include "lassert.h"
|
||||
|
||||
#include "kvs40xx.h"
|
||||
|
||||
#include "sane/sanei_debug.h"
|
||||
|
||||
#define DATA_TAIL 0x200
|
||||
|
||||
struct known_device
|
||||
{
|
||||
const SANE_Int id;
|
||||
const SANE_Device scanner;
|
||||
};
|
||||
|
||||
static const struct known_device known_devices[] = {
|
||||
{
|
||||
KV_S4085C,
|
||||
{
|
||||
"MATSHITA",
|
||||
"KV-S4085C",
|
||||
"High Speed Color ADF Scanner",
|
||||
"scanner"
|
||||
},
|
||||
},
|
||||
{
|
||||
KV_S4065C,
|
||||
{
|
||||
"MATSHITA",
|
||||
"KV-S4065C",
|
||||
"High Speed Color ADF Scanner",
|
||||
"scanner"
|
||||
},
|
||||
},
|
||||
{
|
||||
KV_S7075C,
|
||||
{
|
||||
"MATSHITA",
|
||||
"KV-S7075C",
|
||||
"High Speed Color ADF Scanner",
|
||||
"scanner"
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static inline SANE_Status buf_init(struct buf *b, SANE_Int sz)
|
||||
{
|
||||
const int num = sz / BUF_SIZE + 1;
|
||||
b->buf = (u8 **) realloc(b->buf, num * sizeof(u8 *));
|
||||
if (!b->buf)
|
||||
return SANE_STATUS_NO_MEM;
|
||||
memset(b->buf, 0, num * sizeof(void *));
|
||||
b->size = b->head = b->tail = 0;
|
||||
b->sem = 0;
|
||||
b->st = SANE_STATUS_GOOD;
|
||||
pthread_cond_init(&b->cond, NULL);
|
||||
pthread_mutex_init(&b->mu, NULL);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static inline void buf_deinit(struct buf *b)
|
||||
{
|
||||
int i;
|
||||
if (!b->buf)
|
||||
return;
|
||||
for (i = b->head; i < b->tail; i++)
|
||||
if (b->buf[i])
|
||||
free(b->buf[i]);
|
||||
free(b->buf);
|
||||
b->buf = NULL;
|
||||
b->head = b->tail = 0;
|
||||
}
|
||||
|
||||
static inline SANE_Status new_buf(struct buf *b, u8 ** p)
|
||||
{
|
||||
b->buf[b->tail] = (u8 *) malloc(BUF_SIZE);
|
||||
if (!b->buf[b->tail])
|
||||
return SANE_STATUS_NO_MEM;
|
||||
*p = b->buf[b->tail];
|
||||
++b->tail;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static inline SANE_Status buf_get_err(struct buf *b)
|
||||
{
|
||||
return b->size ? SANE_STATUS_GOOD : b->st;
|
||||
}
|
||||
|
||||
static inline void buf_set_st(struct buf *b, SANE_Status st)
|
||||
{
|
||||
pthread_mutex_lock(&b->mu);
|
||||
b->st = st;
|
||||
if (buf_get_err(b))
|
||||
pthread_cond_signal(&b->cond);
|
||||
pthread_mutex_unlock(&b->mu);
|
||||
}
|
||||
|
||||
static inline void buf_cancel(struct buf *b)
|
||||
{
|
||||
buf_set_st(b, SANE_STATUS_CANCELLED);
|
||||
}
|
||||
|
||||
static inline void push_buf(struct buf *b, SANE_Int sz)
|
||||
{
|
||||
pthread_mutex_lock(&b->mu);
|
||||
b->sem++;
|
||||
b->size += sz;
|
||||
pthread_cond_signal(&b->cond);
|
||||
pthread_mutex_unlock(&b->mu);
|
||||
}
|
||||
|
||||
static inline u8 *get_buf(struct buf *b, SANE_Int * sz)
|
||||
{
|
||||
SANE_Status err = buf_get_err(b);
|
||||
if (err)
|
||||
return NULL;
|
||||
|
||||
pthread_mutex_lock(&b->mu);
|
||||
while (!b->sem && !buf_get_err(b))
|
||||
pthread_cond_wait(&b->cond, &b->mu);
|
||||
b->sem--;
|
||||
err = buf_get_err(b);
|
||||
if (!err) {
|
||||
*sz = b->size < BUF_SIZE ? b->size : BUF_SIZE;
|
||||
b->size -= *sz;
|
||||
}
|
||||
pthread_mutex_unlock(&b->mu);
|
||||
return err ? NULL : b->buf[b->head];
|
||||
}
|
||||
|
||||
static inline void pop_buf(struct buf *b)
|
||||
{
|
||||
free(b->buf[b->head]);
|
||||
b->buf[b->head] = NULL;
|
||||
++b->head;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_init (SANE_Int __sane_unused__ * version_code,
|
||||
SANE_Auth_Callback __sane_unused__ authorize)
|
||||
{
|
||||
DBG_INIT ();
|
||||
DBG (DBG_INFO, "This is panasonic kvs40xx driver\n");
|
||||
|
||||
*version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, 1);
|
||||
|
||||
/* Initialize USB */
|
||||
sanei_usb_init ();
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/*
|
||||
* List of available devices, allocated by sane_get_devices, released
|
||||
* by sane_exit()
|
||||
*/
|
||||
static SANE_Device **devlist = NULL;
|
||||
static unsigned curr_scan_dev = 0;
|
||||
|
||||
void
|
||||
sane_exit (void)
|
||||
{
|
||||
if (devlist)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; devlist[i]; i++)
|
||||
{
|
||||
free ((void *) devlist[i]);
|
||||
}
|
||||
free ((void *) devlist);
|
||||
devlist = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
attach (SANE_String_Const devname);
|
||||
|
||||
SANE_Status
|
||||
attach (SANE_String_Const devname)
|
||||
{
|
||||
int i = 0;
|
||||
if (devlist)
|
||||
{
|
||||
for (; devlist[i]; i++);
|
||||
devlist = realloc (devlist, sizeof (SANE_Device *) * (i + 1));
|
||||
if (!devlist)
|
||||
return SANE_STATUS_NO_MEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
devlist = malloc (sizeof (SANE_Device *) * 2);
|
||||
if (!devlist)
|
||||
return SANE_STATUS_NO_MEM;
|
||||
}
|
||||
devlist[i] = malloc (sizeof (SANE_Device));
|
||||
if (!devlist[i])
|
||||
return SANE_STATUS_NO_MEM;
|
||||
memcpy (devlist[i], &known_devices[curr_scan_dev].scanner,
|
||||
sizeof (SANE_Device));
|
||||
devlist[i]->name = strdup (devname);
|
||||
/* terminate device list with NULL entry: */
|
||||
devlist[i + 1] = 0;
|
||||
DBG (DBG_INFO, "%s device attached\n", devname);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/* Get device list */
|
||||
SANE_Status
|
||||
sane_get_devices (const SANE_Device *** device_list,
|
||||
SANE_Bool __sane_unused__ local_only)
|
||||
{
|
||||
if (devlist)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; devlist[i]; i++)
|
||||
{
|
||||
free ((void *) devlist[i]);
|
||||
}
|
||||
free ((void *) devlist);
|
||||
devlist = NULL;
|
||||
}
|
||||
|
||||
for (curr_scan_dev = 0;
|
||||
curr_scan_dev <
|
||||
sizeof (known_devices) / sizeof (known_devices[0]); curr_scan_dev++)
|
||||
{
|
||||
sanei_usb_find_devices (PANASONIC_ID,
|
||||
known_devices[curr_scan_dev].id, attach);
|
||||
}
|
||||
|
||||
for (curr_scan_dev = 0;
|
||||
curr_scan_dev <
|
||||
sizeof (known_devices) / sizeof (known_devices[0]); curr_scan_dev++)
|
||||
{
|
||||
sanei_scsi_find_devices (known_devices[curr_scan_dev].
|
||||
scanner.vendor,
|
||||
known_devices[curr_scan_dev].
|
||||
scanner.model, NULL, -1, -1, -1, -1, attach);
|
||||
}
|
||||
if(device_list)
|
||||
*device_list = (const SANE_Device **) devlist;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/* Open device, return the device handle */
|
||||
SANE_Status
|
||||
sane_open (SANE_String_Const devname, SANE_Handle * handle)
|
||||
{
|
||||
unsigned i, j, id = 0;
|
||||
struct scanner *s;
|
||||
SANE_Int h, bus;
|
||||
SANE_Status st = SANE_STATUS_GOOD;
|
||||
if (!devlist)
|
||||
{
|
||||
st = sane_get_devices (NULL, 0);
|
||||
if (st)
|
||||
return st;
|
||||
}
|
||||
for (i = 0; devlist[i]; i++)
|
||||
{
|
||||
if (!strcmp (devlist[i]->name, devname))
|
||||
break;
|
||||
}
|
||||
if (!devlist[i])
|
||||
return SANE_STATUS_INVAL;
|
||||
for (j = 0; j < sizeof (known_devices) / sizeof (known_devices[0]); j++)
|
||||
{
|
||||
if (!strcmp (devlist[i]->model, known_devices[j].scanner.model))
|
||||
{
|
||||
id = known_devices[j].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
st = sanei_usb_open (devname, &h);
|
||||
|
||||
if (st == SANE_STATUS_ACCESS_DENIED)
|
||||
return st;
|
||||
if (st)
|
||||
{
|
||||
st = sanei_scsi_open (devname, &h, sense_handler, NULL);
|
||||
if (st)
|
||||
{
|
||||
return st;
|
||||
}
|
||||
bus = SCSI;
|
||||
}
|
||||
else
|
||||
{
|
||||
bus = USB;
|
||||
st = sanei_usb_claim_interface (h, 0);
|
||||
if (st)
|
||||
{
|
||||
sanei_usb_close (h);
|
||||
return st;
|
||||
}
|
||||
}
|
||||
|
||||
s = malloc (sizeof (struct scanner));
|
||||
if (!s)
|
||||
return SANE_STATUS_NO_MEM;
|
||||
memset (s, 0, sizeof (struct scanner));
|
||||
s->buffer = malloc (MAX_READ_DATA_SIZE + BULK_HEADER_SIZE);
|
||||
if (!s->buffer)
|
||||
return SANE_STATUS_NO_MEM;
|
||||
|
||||
s->file = h;
|
||||
s->bus = bus;
|
||||
s->id = id;
|
||||
strcpy (s->name, devname);
|
||||
*handle = s;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
st = test_unit_ready (s);
|
||||
if (st)
|
||||
{
|
||||
if (s->bus == SCSI)
|
||||
{
|
||||
sanei_scsi_close (s->file);
|
||||
st = sanei_scsi_open (devname, &h, sense_handler, NULL);
|
||||
if (st)
|
||||
return st;
|
||||
}
|
||||
else
|
||||
{
|
||||
sanei_usb_release_interface (s->file, 0);
|
||||
sanei_usb_close (s->file);
|
||||
st = sanei_usb_open (devname, &h);
|
||||
if (st)
|
||||
return st;
|
||||
st = sanei_usb_claim_interface (h, 0);
|
||||
if (st)
|
||||
{
|
||||
sanei_usb_close (h);
|
||||
return st;
|
||||
}
|
||||
}
|
||||
s->file = h;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (i == 3)
|
||||
return SANE_STATUS_DEVICE_BUSY;
|
||||
|
||||
if (id == KV_S4085C || id == KV_S4065C)
|
||||
{
|
||||
char str[16];
|
||||
st = inquiry (s, str);
|
||||
if (st)
|
||||
goto err;
|
||||
if (id == KV_S4085C)
|
||||
s->id = !strcmp (str, "KV-S4085CL") ? KV_S4085CL : KV_S4085CW;
|
||||
else
|
||||
s->id = !strcmp (str, "KV-S4065CL") ? KV_S4065CL : KV_S4065CW;
|
||||
}
|
||||
init_options (s);
|
||||
st = set_timeout (s, s->val[FEED_TIMEOUT].w);
|
||||
if (st)
|
||||
goto err;
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
err:
|
||||
sane_close (s);
|
||||
return st;
|
||||
}
|
||||
|
||||
/* Close device */
|
||||
void
|
||||
sane_close (SANE_Handle handle)
|
||||
{
|
||||
struct scanner *s = (struct scanner *) handle;
|
||||
unsigned i;
|
||||
hopper_down (s);
|
||||
if (s->bus == USB)
|
||||
{
|
||||
sanei_usb_release_interface (s->file, 0);
|
||||
sanei_usb_close (s->file);
|
||||
}
|
||||
else
|
||||
sanei_scsi_close (s->file);
|
||||
|
||||
for (i = 1; i < NUM_OPTIONS; i++)
|
||||
{
|
||||
if (s->opt[i].type == SANE_TYPE_STRING && s->val[i].s)
|
||||
free (s->val[i].s);
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof (s->buf) / sizeof (s->buf[0]); i++)
|
||||
buf_deinit (&s->buf[i]);
|
||||
|
||||
free (s->buffer);
|
||||
free (s);
|
||||
|
||||
}
|
||||
|
||||
/* Get option descriptor */
|
||||
const SANE_Option_Descriptor *
|
||||
sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
|
||||
{
|
||||
struct scanner *s = handle;
|
||||
|
||||
if ((unsigned) option >= NUM_OPTIONS || option < 0)
|
||||
return NULL;
|
||||
return s->opt + option;
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
wait_document (struct scanner *s)
|
||||
{
|
||||
SANE_Status st;
|
||||
int i;
|
||||
if (!strcmp ("fb", s->val[SOURCE].s))
|
||||
return SANE_STATUS_GOOD;
|
||||
if (!strcmp ("off", s->val[MANUALFEED].s))
|
||||
return document_exist (s);
|
||||
|
||||
for (i = 0; i < s->val[FEED_TIMEOUT].w; i++)
|
||||
{
|
||||
st = document_exist (s);
|
||||
if (st != SANE_STATUS_NO_DOCS)
|
||||
return st;
|
||||
sleep (1);
|
||||
}
|
||||
return SANE_STATUS_NO_DOCS;
|
||||
}
|
||||
|
||||
static SANE_Status read_image_duplex(SANE_Handle handle)
|
||||
{
|
||||
struct scanner *s = (struct scanner *) handle;
|
||||
SANE_Status st = SANE_STATUS_GOOD;
|
||||
unsigned read, side;
|
||||
int i;
|
||||
struct side {
|
||||
unsigned mx, eof;
|
||||
u8 *p;
|
||||
struct buf *buf;
|
||||
} a[2], *b;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
a[i].mx = BUF_SIZE;
|
||||
a[i].eof = 0;
|
||||
a[i].buf = &s->buf[i];
|
||||
st = new_buf(&s->buf[i], &a[i].p);
|
||||
if (st)
|
||||
goto err;
|
||||
}
|
||||
for (b = &a[0], side = SIDE_FRONT; (!a[0].eof || !a[1].eof);) {
|
||||
pthread_testcancel();
|
||||
if (b->mx == 0) {
|
||||
push_buf(b->buf, BUF_SIZE);
|
||||
st = new_buf(b->buf, &b->p);
|
||||
if (st)
|
||||
goto err;
|
||||
b->mx = BUF_SIZE;
|
||||
}
|
||||
|
||||
st = read_image_data(s, s->page,
|
||||
side, b->p + BUF_SIZE - b->mx, b->mx,
|
||||
&read);
|
||||
b->mx -= read;
|
||||
if (st) {
|
||||
if (st != INCORRECT_LENGTH
|
||||
&& st != SANE_STATUS_EOF)
|
||||
goto err;
|
||||
|
||||
if (st == SANE_STATUS_EOF) {
|
||||
b->eof = 1;
|
||||
push_buf(b->buf, BUF_SIZE - b->mx);
|
||||
}
|
||||
side ^= SIDE_BACK;
|
||||
b = &a[side == SIDE_FRONT ? 0 : 1];
|
||||
}
|
||||
}
|
||||
|
||||
err:
|
||||
for (i = 0; i < 2; i++)
|
||||
buf_set_st(&s->buf[i], st);
|
||||
return st;
|
||||
}
|
||||
|
||||
static SANE_Status read_image_simplex(SANE_Handle handle)
|
||||
{
|
||||
struct scanner *s = (struct scanner *) handle;
|
||||
SANE_Status st = SANE_STATUS_GOOD;
|
||||
|
||||
for (; (!st || st == INCORRECT_LENGTH);) {
|
||||
unsigned read, mx;
|
||||
unsigned char *p = NULL;
|
||||
st = new_buf(&s->buf[0], &p);
|
||||
for (read = 0, mx = BUF_SIZE; mx &&
|
||||
(!st || st == INCORRECT_LENGTH); mx -= read) {
|
||||
pthread_testcancel();
|
||||
st = read_image_data(s, s->page, SIDE_FRONT,
|
||||
p + BUF_SIZE - mx, mx, &read);
|
||||
}
|
||||
push_buf(&s->buf[0], BUF_SIZE - mx);
|
||||
}
|
||||
buf_set_st(&s->buf[0], st);
|
||||
return st;
|
||||
}
|
||||
|
||||
static SANE_Status read_data(struct scanner *s)
|
||||
{
|
||||
SANE_Status st;
|
||||
int duplex = s->val[DUPLEX].w;
|
||||
s->read = 0;
|
||||
s->side = SIDE_FRONT;
|
||||
|
||||
st = duplex ? read_image_duplex(s) : read_image_simplex(s);
|
||||
if (st && (st != SANE_STATUS_EOF))
|
||||
goto err;
|
||||
|
||||
st = read_picture_element(s, SIDE_FRONT, &s->params);
|
||||
if (st)
|
||||
goto err;
|
||||
if (!s->params.lines) {
|
||||
st = SANE_STATUS_INVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
sane_get_parameters(s, NULL);
|
||||
|
||||
s->page++;
|
||||
return SANE_STATUS_GOOD;
|
||||
err:
|
||||
s->scanning = 0;
|
||||
return st;
|
||||
}
|
||||
|
||||
/* Start scanning */
|
||||
SANE_Status
|
||||
sane_start (SANE_Handle handle)
|
||||
{
|
||||
struct scanner *s = (struct scanner *) handle;
|
||||
SANE_Status st = SANE_STATUS_GOOD;
|
||||
int duplex = s->val[DUPLEX].w, i;
|
||||
unsigned data_avalible;
|
||||
int start = 0;
|
||||
|
||||
if (s->thread)
|
||||
{
|
||||
pthread_join (s->thread, NULL);
|
||||
s->thread = 0;
|
||||
}
|
||||
if (!s->scanning)
|
||||
{
|
||||
st = test_unit_ready (s);
|
||||
if (st)
|
||||
return st;
|
||||
|
||||
st = wait_document (s);
|
||||
if (st)
|
||||
return st;
|
||||
|
||||
st = reset_window (s);
|
||||
if (st)
|
||||
return st;
|
||||
st = set_window (s, SIDE_FRONT);
|
||||
|
||||
if (st)
|
||||
return st;
|
||||
|
||||
if (duplex)
|
||||
{
|
||||
st = set_window (s, SIDE_BACK);
|
||||
if (st)
|
||||
return st;
|
||||
}
|
||||
|
||||
st = scan (s);
|
||||
if (st)
|
||||
return st;
|
||||
|
||||
if (s->val[CROP].b || s->val[LENGTHCTL].b || s->val[LONG_PAPER].b)
|
||||
{
|
||||
unsigned w, h, res = s->val[RESOLUTION].w;
|
||||
SANE_Parameters *p = &s->params;
|
||||
w = 297; /*A3 */
|
||||
h = 420;
|
||||
p->pixels_per_line = w * res / 25.4 + .5;
|
||||
p->lines = h * res / 25.4 + .5;
|
||||
}
|
||||
else
|
||||
{
|
||||
st = read_picture_element (s, SIDE_FRONT, &s->params);
|
||||
if (st)
|
||||
return st;
|
||||
}
|
||||
|
||||
start = 1;
|
||||
s->scanning = 1;
|
||||
s->page = 0;
|
||||
s->read = 0;
|
||||
s->side = SIDE_FRONT;
|
||||
sane_get_parameters (s, NULL);
|
||||
}
|
||||
|
||||
if (duplex && s->side == SIDE_FRONT && !start)
|
||||
{
|
||||
s->side = SIDE_BACK;
|
||||
s->read = 0;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
do {
|
||||
st = get_buffer_status(s, &data_avalible);
|
||||
if (st)
|
||||
goto err;
|
||||
|
||||
} while (!data_avalible);
|
||||
|
||||
for (i = 0; i < (duplex ? 2 : 1); i++)
|
||||
{
|
||||
st = buf_init (&s->buf[i], s->side_size);
|
||||
if (st)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (pthread_create (&s->thread, NULL, (void *(*)(void *)) read_data, s))
|
||||
{
|
||||
st = SANE_STATUS_IO_ERROR;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (s->val[CROP].b || s->val[LENGTHCTL].b || s->val[LONG_PAPER].b)
|
||||
{
|
||||
pthread_join (s->thread, NULL);
|
||||
s->thread = 0;
|
||||
}
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
err:
|
||||
s->scanning = 0;
|
||||
return st;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_read(SANE_Handle handle, SANE_Byte * buf,
|
||||
SANE_Int max_len, SANE_Int * len)
|
||||
{
|
||||
struct scanner *s = (struct scanner *) handle;
|
||||
int duplex = s->val[DUPLEX].w;
|
||||
struct buf *b = s->side == SIDE_FRONT ? &s->buf[0] : &s->buf[1];
|
||||
SANE_Status err = buf_get_err(b);
|
||||
SANE_Int inbuf = 0;
|
||||
*len = 0;
|
||||
|
||||
if (!s->scanning)
|
||||
return SANE_STATUS_EOF;
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
if (s->read) {
|
||||
*len =
|
||||
max_len <
|
||||
(SANE_Int) s->read ? max_len : (SANE_Int) s->read;
|
||||
memcpy(buf, s->data + BUF_SIZE - s->read, *len);
|
||||
s->read -= *len;
|
||||
|
||||
if (!s->read)
|
||||
pop_buf(b);
|
||||
goto out;
|
||||
}
|
||||
|
||||
s->data = get_buf(b, &inbuf);
|
||||
if (!s->data)
|
||||
goto out;
|
||||
|
||||
*len = max_len < inbuf ? max_len : inbuf;
|
||||
if (*len > BUF_SIZE)
|
||||
*len = BUF_SIZE;
|
||||
memcpy(buf, s->data, *len);
|
||||
s->read = inbuf > BUF_SIZE ? BUF_SIZE - *len : inbuf - *len;
|
||||
|
||||
if (!s->read)
|
||||
pop_buf(b);
|
||||
out:
|
||||
err = *len ? SANE_STATUS_GOOD : buf_get_err(b);
|
||||
if (err == SANE_STATUS_EOF) {
|
||||
if (strcmp(s->val[FEEDER_MODE].s, SANE_I18N("continuous"))) {
|
||||
if (!duplex || s->side == SIDE_BACK)
|
||||
s->scanning = 0;
|
||||
}
|
||||
buf_deinit(b);
|
||||
} else if (err) {
|
||||
unsigned i;
|
||||
for (i = 0; i < sizeof(s->buf) / sizeof(s->buf[0]); i++)
|
||||
buf_deinit(&s->buf[i]);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
void
|
||||
sane_cancel (SANE_Handle handle)
|
||||
{
|
||||
unsigned i;
|
||||
struct scanner *s = (struct scanner *) handle;
|
||||
if (s->scanning && !strcmp (s->val[FEEDER_MODE].s, SANE_I18N ("continuous")))
|
||||
{
|
||||
stop_adf (s);
|
||||
}
|
||||
if (s->thread)
|
||||
{
|
||||
pthread_cancel (s->thread);
|
||||
pthread_join (s->thread, NULL);
|
||||
s->thread = 0;
|
||||
}
|
||||
for (i = 0; i < sizeof (s->buf) / sizeof (s->buf[0]); i++)
|
||||
buf_deinit (&s->buf[i]);
|
||||
s->scanning = 0;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_set_io_mode (SANE_Handle __sane_unused__ h, SANE_Bool __sane_unused__ m)
|
||||
{
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_get_select_fd (SANE_Handle __sane_unused__ h,
|
||||
SANE_Int __sane_unused__ * fd)
|
||||
{
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
|
@ -0,0 +1,276 @@
|
|||
#ifndef __KVS40XX_H
|
||||
#define __KVS40XX_H
|
||||
|
||||
/*
|
||||
Copyright (C) 2009, Panasonic Russia Ltd.
|
||||
*/
|
||||
/*
|
||||
Panasonic KV-S40xx USB-SCSI scanner driver.
|
||||
*/
|
||||
|
||||
#include <endian.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#undef BACKEND_NAME
|
||||
#define BACKEND_NAME kvs40xx
|
||||
|
||||
#define DBG_ERR 1
|
||||
#define DBG_WARN 2
|
||||
#define DBG_MSG 3
|
||||
#define DBG_INFO 4
|
||||
#define DBG_DBG 5
|
||||
|
||||
#define PANASONIC_ID 0x04da
|
||||
#define KV_S4085C 0x100c
|
||||
#define KV_S4065C 0x100d
|
||||
#define KV_S7075C 0x100e
|
||||
|
||||
#define KV_S4085CL (KV_S4085C|0x10000)
|
||||
#define KV_S4085CW (KV_S4085C|0x20000)
|
||||
#define KV_S4065CL (KV_S4065C|0x10000)
|
||||
#define KV_S4065CW (KV_S4065C|0x20000)
|
||||
|
||||
#define USB 1
|
||||
#define SCSI 2
|
||||
#define BULK_HEADER_SIZE 12
|
||||
#define MAX_READ_DATA_SIZE (0x10000-0x100)
|
||||
#define BUF_SIZE MAX_READ_DATA_SIZE
|
||||
|
||||
#define INCORRECT_LENGTH 0xfafafafa
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned u32;
|
||||
typedef unsigned short u16;
|
||||
|
||||
#define SIDE_FRONT 0x00
|
||||
#define SIDE_BACK 0x80
|
||||
|
||||
/* options */
|
||||
typedef enum
|
||||
{
|
||||
NUM_OPTS = 0,
|
||||
|
||||
/* General options */
|
||||
MODE_GROUP,
|
||||
MODE, /* scanner modes */
|
||||
RESOLUTION, /* X and Y resolution */
|
||||
SOURCE,
|
||||
|
||||
DUPLEX, /* Duplex mode */
|
||||
FEEDER_MODE, /* Feeder mode, fixed to Continous */
|
||||
LENGTHCTL, /* Length control mode */
|
||||
LONG_PAPER,
|
||||
MANUALFEED, /* Manual feed mode */
|
||||
FEED_TIMEOUT, /* Feed timeout */
|
||||
DBLFEED, /* Double feed detection mode */
|
||||
DFEED_SENCE,
|
||||
DFSTOP,
|
||||
DFEED_L,
|
||||
DFEED_C,
|
||||
DFEED_R,
|
||||
STAPELED_DOC, /* Detect stapled document */
|
||||
FIT_TO_PAGE, /* Scanner shrinks image to fit scanned page */
|
||||
|
||||
/* Geometry group */
|
||||
GEOMETRY_GROUP,
|
||||
PAPER_SIZE, /* Paper size */
|
||||
LANDSCAPE, /* true if landscape */
|
||||
TL_X, /* upper left X */
|
||||
TL_Y, /* upper left Y */
|
||||
BR_X, /* bottom right X */
|
||||
BR_Y, /* bottom right Y */
|
||||
|
||||
ADVANCED_GROUP,
|
||||
BRIGHTNESS, /* Brightness */
|
||||
CONTRAST, /* Contrast */
|
||||
THRESHOLD, /* Binary threshold */
|
||||
AUTOMATIC_THRESHOLD,
|
||||
WHITE_LEVEL,
|
||||
NOISE_REDUCTION,
|
||||
INVERSE, /* Monochrome reversing */
|
||||
IMAGE_EMPHASIS, /* Image emphasis */
|
||||
GAMMA_CORRECTION, /* Gamma correction */
|
||||
LAMP, /* Lamp -- color drop out */
|
||||
RED_CHROMA,
|
||||
BLUE_CHROMA,
|
||||
HALFTONE_PATTERN, /* Halftone pattern */
|
||||
COMPRESSION, /* JPEG Compression */
|
||||
COMPRESSION_PAR, /* Compression parameter */
|
||||
DESKEW,
|
||||
STOP_SKEW,
|
||||
CROP,
|
||||
MIRROR,
|
||||
BTMPOS,
|
||||
TOPPOS,
|
||||
|
||||
/* must come last: */
|
||||
NUM_OPTIONS
|
||||
} KV_OPTION;
|
||||
|
||||
|
||||
struct buf
|
||||
{
|
||||
u8 **buf;
|
||||
volatile int head;
|
||||
volatile int tail;
|
||||
volatile unsigned size;
|
||||
volatile int sem;
|
||||
volatile SANE_Status st;
|
||||
pthread_mutex_t mu;
|
||||
pthread_cond_t cond;
|
||||
};
|
||||
|
||||
struct scanner
|
||||
{
|
||||
char name[128];
|
||||
unsigned id;
|
||||
volatile int scanning;
|
||||
int page;
|
||||
int side;
|
||||
int bus;
|
||||
SANE_Int file;
|
||||
SANE_Option_Descriptor opt[NUM_OPTIONS];
|
||||
Option_Value val[NUM_OPTIONS];
|
||||
SANE_Parameters params;
|
||||
u8 *buffer;
|
||||
struct buf buf[2];
|
||||
u8 *data;
|
||||
unsigned side_size;
|
||||
unsigned read;
|
||||
pthread_t thread;
|
||||
};
|
||||
|
||||
struct window
|
||||
{
|
||||
u8 reserved[6];
|
||||
u8 window_descriptor_block_length[2];
|
||||
|
||||
u8 window_identifier;
|
||||
u8 reserved2;
|
||||
u8 x_resolution[2];
|
||||
u8 y_resolution[2];
|
||||
u8 upper_left_x[4];
|
||||
u8 upper_left_y[4];
|
||||
u8 width[4];
|
||||
u8 length[4];
|
||||
u8 brightness;
|
||||
u8 threshold;
|
||||
u8 contrast;
|
||||
u8 image_composition;
|
||||
u8 bit_per_pixel;
|
||||
u8 halftone_pattern[2];
|
||||
u8 rif_padding; /*RIF*/
|
||||
u8 bit_ordering[2];
|
||||
u8 compression_type;
|
||||
u8 compression_argument;
|
||||
u8 reserved4[6];
|
||||
|
||||
u8 vendor_unique_identifier;
|
||||
u8 nobuf_fstspeed_dfstop;
|
||||
u8 mirror_image;
|
||||
u8 image_emphasis;
|
||||
u8 gamma_correction;
|
||||
u8 mcd_lamp_dfeed_sens;
|
||||
u8 reserved5; /*rmoir*/
|
||||
u8 document_size;
|
||||
u8 document_width[4];
|
||||
u8 document_length[4];
|
||||
u8 ahead_deskew_dfeed_scan_area_fspeed_rshad;
|
||||
u8 continuous_scanning_pages;
|
||||
u8 automatic_threshold_mode;
|
||||
u8 automatic_separation_mode;
|
||||
u8 standard_white_level_mode;
|
||||
u8 b_wnr_noise_reduction;
|
||||
u8 mfeed_toppos_btmpos_dsepa_hsepa_dcont_rstkr;
|
||||
u8 stop_mode;
|
||||
u8 red_chroma;
|
||||
u8 blue_chroma;
|
||||
};
|
||||
|
||||
struct support_info
|
||||
{
|
||||
/*TODO: */
|
||||
unsigned char data[32];
|
||||
};
|
||||
|
||||
void init_options (struct scanner *);
|
||||
SANE_Status test_unit_ready (struct scanner *s);
|
||||
SANE_Status set_timeout (struct scanner *s, int timeout);
|
||||
void init_window (struct scanner *s, struct window *wnd, int wnd_id);
|
||||
SANE_Status set_window (struct scanner *s, int wnd_id);
|
||||
SANE_Status reset_window (struct scanner *s);
|
||||
SANE_Status read_picture_element (struct scanner *s, unsigned side,
|
||||
SANE_Parameters * p);
|
||||
SANE_Status read_support_info (struct scanner *s, struct support_info *inf);
|
||||
SANE_Status read_image_data (struct scanner *s, unsigned page,
|
||||
unsigned side, void *buf, unsigned max_size,
|
||||
unsigned *size);
|
||||
SANE_Status document_exist (struct scanner *s);
|
||||
SANE_Status get_buffer_status (struct scanner *s, unsigned *data_avalible);
|
||||
SANE_Status scan (struct scanner *s);
|
||||
SANE_Status get_adjust_data (struct scanner *s, unsigned *dummy_length);
|
||||
SANE_Status sense_handler (int fd, u_char * sense_buffer, void *arg);
|
||||
SANE_Status stop_adf (struct scanner *s);
|
||||
SANE_Status hopper_down (struct scanner *s);
|
||||
SANE_Status inquiry (struct scanner *s, char *id);
|
||||
|
||||
static inline u16
|
||||
swap_bytes16 (u16 x)
|
||||
{
|
||||
return x << 8 | x >> 8;
|
||||
}
|
||||
static inline u32
|
||||
swap_bytes32 (u32 x)
|
||||
{
|
||||
return x << 24 | x >> 24 |
|
||||
(x & (u32) 0x0000ff00UL) << 8 | (x & (u32) 0x00ff0000UL) >> 8;
|
||||
}
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
static inline void
|
||||
set24 (u8 * p, u32 x)
|
||||
{
|
||||
p[2] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[0] = x >> 0;
|
||||
}
|
||||
|
||||
#define cpu2be16(x) (x)
|
||||
#define cpu2be32(x) (x)
|
||||
#define cpu2le16(x) swap_bytes16(x)
|
||||
#define cpu2le32(x) swap_bytes32(x)
|
||||
#define le2cpu16(x) swap_bytes16(x)
|
||||
#define le2cpu32(x) swap_bytes32(x)
|
||||
#define be2cpu16(x) (x)
|
||||
#define be2cpu32(x) (x)
|
||||
#define BIT_ORDERING 0
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
static inline void
|
||||
set24 (u8 * p, u32 x)
|
||||
{
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
#define cpu2le16(x) (x)
|
||||
#define cpu2le32(x) (x)
|
||||
#define cpu2be16(x) swap_bytes16(x)
|
||||
#define cpu2be32(x) swap_bytes32(x)
|
||||
#define le2cpu16(x) (x)
|
||||
#define le2cpu32(x) (x)
|
||||
#define be2cpu16(x) swap_bytes16(x)
|
||||
#define be2cpu32(x) swap_bytes32(x)
|
||||
#define BIT_ORDERING 1
|
||||
#else
|
||||
#error __BYTE_ORDER not defined
|
||||
#endif
|
||||
|
||||
|
||||
static inline u32
|
||||
get24 (u8 * p)
|
||||
{
|
||||
u32 x = (((u32) p[0]) << 16) | (((u32) p[1]) << 8) | (((u32) p[0]) << 0);
|
||||
return x;
|
||||
}
|
||||
#endif /*__KVS40XX_H*/
|
|
@ -0,0 +1,606 @@
|
|||
/*
|
||||
Copyright (C) 2009, Panasonic Russia Ltd.
|
||||
Copyright (C) 2010,2011, m. allan noah
|
||||
*/
|
||||
/*
|
||||
Panasonic KV-S40xx USB-SCSI scanner driver.
|
||||
*/
|
||||
#include "../include/sane/config.h"
|
||||
#include <string.h>
|
||||
|
||||
#define DEBUG_DECLARE_ONLY
|
||||
#define BACKEND_NAME kvs40xx
|
||||
|
||||
#include "../include/sane/sanei_backend.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/sanei_usb.h"
|
||||
#include "../include/sane/sanei_scsi.h"
|
||||
#include "../include/sane/sanei_config.h"
|
||||
|
||||
#include "kvs40xx.h"
|
||||
|
||||
#include "../include/sane/sanei_debug.h"
|
||||
|
||||
#define COMMAND_BLOCK 1
|
||||
#define DATA_BLOCK 2
|
||||
#define RESPONSE_BLOCK 3
|
||||
|
||||
#define COMMAND_CODE 0x9000
|
||||
#define DATA_CODE 0xb000
|
||||
#define RESPONSE_CODE 0xa000
|
||||
#define STATUS_SIZE 4
|
||||
|
||||
struct bulk_header
|
||||
{
|
||||
u32 length;
|
||||
u16 type;
|
||||
u16 code;
|
||||
u32 transaction_id;
|
||||
};
|
||||
|
||||
#define TEST_UNIT_READY 0x00
|
||||
#define INQUIRY 0x12
|
||||
#define SET_WINDOW 0x24
|
||||
#define SCAN 0x1B
|
||||
#define SEND_10 0x2A
|
||||
#define READ_10 0x28
|
||||
#define REQUEST_SENSE 0x03
|
||||
#define GET_BUFFER_STATUS 0x34
|
||||
#define SET_TIMEOUT 0xE1
|
||||
#define GET_ADJUST_DATA 0xE0
|
||||
#define HOPPER_DOWN 0xE1
|
||||
#define STOP_ADF 0xE1
|
||||
|
||||
|
||||
|
||||
#define SUPPORT_INFO 0x93
|
||||
|
||||
|
||||
#define GOOD 0
|
||||
#define CHECK_CONDITION 2
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CMD_NONE = 0,
|
||||
CMD_IN = 0x81, /* scanner to pc */
|
||||
CMD_OUT = 0x02 /* pc to scanner */
|
||||
} CMD_DIRECTION; /* equals to endpoint address */
|
||||
|
||||
#define RESPONSE_SIZE 0x12
|
||||
#define MAX_CMD_SIZE 12
|
||||
struct cmd
|
||||
{
|
||||
unsigned char cmd[MAX_CMD_SIZE];
|
||||
int cmd_size;
|
||||
void *data;
|
||||
int data_size;
|
||||
int dir;
|
||||
};
|
||||
struct response
|
||||
{
|
||||
int status;
|
||||
unsigned char data[RESPONSE_SIZE];
|
||||
};
|
||||
|
||||
SANE_Status
|
||||
usb_send_command (struct scanner *s, struct cmd *c, struct response *r,
|
||||
void *buf);
|
||||
SANE_Status
|
||||
usb_send_command (struct scanner *s, struct cmd *c, struct response *r,
|
||||
void *buf)
|
||||
{
|
||||
SANE_Status st;
|
||||
struct bulk_header *h = (struct bulk_header *) buf;
|
||||
u8 resp[sizeof (*h) + STATUS_SIZE];
|
||||
size_t sz = sizeof (*h) + MAX_CMD_SIZE;
|
||||
memset (h, 0, sz);
|
||||
h->length = cpu2be32 (sz);
|
||||
h->type = cpu2be16 (COMMAND_BLOCK);
|
||||
h->code = cpu2be16 (COMMAND_CODE);
|
||||
memcpy (h + 1, c->cmd, c->cmd_size);
|
||||
|
||||
st = sanei_usb_write_bulk (s->file, (const SANE_Byte *) h, &sz);
|
||||
if (st)
|
||||
return st;
|
||||
|
||||
if (sz != sizeof (*h) + MAX_CMD_SIZE)
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
|
||||
if (c->dir == CMD_IN)
|
||||
{
|
||||
unsigned l;
|
||||
sz = sizeof (*h) + c->data_size;
|
||||
c->data_size = 0;
|
||||
st = sanei_usb_read_bulk (s->file, (SANE_Byte *) h, &sz);
|
||||
for (l = sz; !st && l != be2cpu32 (h->length); l += sz)
|
||||
{
|
||||
DBG (DBG_WARN, "usb wrong read (%d instead %d)\n",
|
||||
c->data_size, be2cpu32 (h->length));
|
||||
sz = be2cpu32 (h->length) - l;
|
||||
st = sanei_usb_read_bulk (s->file, ((SANE_Byte *) h) + l, &sz);
|
||||
|
||||
}
|
||||
|
||||
c->data = h + 1;
|
||||
|
||||
if (st)
|
||||
{
|
||||
st = sanei_usb_release_interface (s->file, 0);
|
||||
if (st)
|
||||
return st;
|
||||
st = sanei_usb_claim_interface (s->file, 0);
|
||||
|
||||
if (st)
|
||||
return st;
|
||||
|
||||
r->status = CHECK_CONDITION;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
c->data_size = sz - sizeof (*h);
|
||||
|
||||
|
||||
}
|
||||
else if (c->dir == CMD_OUT)
|
||||
{
|
||||
sz = sizeof (*h) + c->data_size;
|
||||
memset (h, 0, sizeof (*h));
|
||||
h->length = cpu2be32 (sizeof (*h) + c->data_size);
|
||||
h->type = cpu2be16 (DATA_BLOCK);
|
||||
h->code = cpu2be16 (DATA_CODE);
|
||||
memcpy (h + 1, c->data, c->data_size);
|
||||
st = sanei_usb_write_bulk (s->file, (const SANE_Byte *) h, &sz);
|
||||
if (st)
|
||||
return st;
|
||||
}
|
||||
sz = sizeof (resp);
|
||||
st = sanei_usb_read_bulk (s->file, resp, &sz);
|
||||
if (st || sz != sizeof (resp))
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
|
||||
r->status = be2cpu32 (*((u32 *) (resp + sizeof (*h))));
|
||||
return st;
|
||||
}
|
||||
|
||||
#define END_OF_MEDIUM (1<<6)
|
||||
#define INCORRECT_LENGTH_INDICATOR (1<<5)
|
||||
static const struct
|
||||
{
|
||||
unsigned sense, asc, ascq;
|
||||
SANE_Status st;
|
||||
} s_errors[] =
|
||||
{
|
||||
{
|
||||
2, 0, 0, SANE_STATUS_DEVICE_BUSY},
|
||||
{
|
||||
2, 4, 1, SANE_STATUS_DEVICE_BUSY},
|
||||
{
|
||||
2, 4, 0x80, SANE_STATUS_COVER_OPEN},
|
||||
{
|
||||
2, 4, 0x81, SANE_STATUS_COVER_OPEN},
|
||||
{
|
||||
2, 4, 0x82, SANE_STATUS_COVER_OPEN},
|
||||
{
|
||||
2, 4, 0x83, SANE_STATUS_COVER_OPEN},
|
||||
{
|
||||
2, 4, 0x84, SANE_STATUS_COVER_OPEN},
|
||||
{
|
||||
2, 0x80, 1, SANE_STATUS_CANCELLED},
|
||||
{
|
||||
2, 0x80, 2, SANE_STATUS_CANCELLED},
|
||||
{
|
||||
3, 0x3a, 0, SANE_STATUS_NO_DOCS},
|
||||
{
|
||||
3, 0x80, 1, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 2, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 3, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 4, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 5, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 6, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 7, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 8, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 9, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 0xa, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 0xb, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 0xc, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 0xd, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 0xe, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 0xf, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 0x10, SANE_STATUS_JAMMED},
|
||||
{
|
||||
3, 0x80, 0x11, SANE_STATUS_JAMMED},
|
||||
{
|
||||
5, 0x1a, 0x0, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x20, 0x0, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x24, 0x0, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x25, 0x0, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x26, 0x0, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x2c, 0x01, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x2c, 0x02, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x2c, 0x80, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x2c, 0x81, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x2c, 0x82, SANE_STATUS_INVAL},
|
||||
{
|
||||
5, 0x2c, 0x83, SANE_STATUS_INVAL},};
|
||||
|
||||
SANE_Status
|
||||
sense_handler (int __sane_unused__ fd,
|
||||
u_char * sense_buffer, void __sane_unused__ * arg)
|
||||
{
|
||||
unsigned i;
|
||||
SANE_Status st = SANE_STATUS_GOOD;
|
||||
if (sense_buffer[2] & 0xf)
|
||||
{ /*error */
|
||||
for (i = 0; i < sizeof (s_errors) / sizeof (s_errors[0]); i++)
|
||||
{
|
||||
if ((sense_buffer[2] & 0xf) == s_errors[i].sense
|
||||
&& sense_buffer[12] == s_errors[i].asc
|
||||
&& sense_buffer[13] == s_errors[i].ascq)
|
||||
{
|
||||
st = s_errors[i].st;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == sizeof (s_errors) / sizeof (s_errors[0]))
|
||||
st = SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sense_buffer[2] & END_OF_MEDIUM)
|
||||
st = SANE_STATUS_EOF;
|
||||
else if (sense_buffer[2] & INCORRECT_LENGTH_INDICATOR)
|
||||
st = INCORRECT_LENGTH;
|
||||
}
|
||||
|
||||
DBG (DBG_ERR,
|
||||
"send_command: CHECK_CONDITION: sence:0x%x ASC:0x%x ASCQ:0x%x\n",
|
||||
sense_buffer[2], sense_buffer[12], sense_buffer[13]);
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
send_command (struct scanner * s, struct cmd * c);
|
||||
|
||||
SANE_Status
|
||||
send_command (struct scanner * s, struct cmd * c)
|
||||
{
|
||||
SANE_Status st = SANE_STATUS_GOOD;
|
||||
if (s->bus == USB)
|
||||
{
|
||||
struct response r;
|
||||
memset (&r, 0, sizeof (r));
|
||||
st = usb_send_command (s, c, &r, s->buffer);
|
||||
if (st)
|
||||
return st;
|
||||
if (r.status)
|
||||
{
|
||||
u8 b[sizeof (struct bulk_header) + RESPONSE_SIZE];
|
||||
struct cmd c2 = {
|
||||
{0}, 6,
|
||||
NULL, RESPONSE_SIZE,
|
||||
CMD_IN
|
||||
};
|
||||
c2.cmd[0] = REQUEST_SENSE;
|
||||
c2.cmd[4] = RESPONSE_SIZE;
|
||||
|
||||
st = usb_send_command (s, &c2, &r, b);
|
||||
if (st)
|
||||
return st;
|
||||
st = sense_handler (0, b + sizeof (struct bulk_header), NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (c->dir == CMD_OUT)
|
||||
{
|
||||
memcpy (s->buffer, c->cmd, c->cmd_size);
|
||||
memcpy (s->buffer + c->cmd_size, c->data, c->data_size);
|
||||
st = sanei_scsi_cmd (s->file, s->buffer,
|
||||
c->cmd_size + c->data_size, NULL, NULL);
|
||||
}
|
||||
else if (c->dir == CMD_IN)
|
||||
{
|
||||
c->data = s->buffer;
|
||||
st = sanei_scsi_cmd (s->file, c->cmd, c->cmd_size,
|
||||
c->data, (size_t *) & c->data_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
st = sanei_scsi_cmd (s->file, c->cmd, c->cmd_size, NULL, NULL);
|
||||
}
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
test_unit_ready (struct scanner * s)
|
||||
{
|
||||
struct cmd c = {
|
||||
{0}, 6,
|
||||
NULL, 0,
|
||||
CMD_NONE
|
||||
};
|
||||
c.cmd[0] = TEST_UNIT_READY;
|
||||
if (send_command (s, &c))
|
||||
return SANE_STATUS_DEVICE_BUSY;
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
set_timeout (struct scanner * s, int timeout)
|
||||
{
|
||||
u16 t = cpu2be16 ((u16) timeout);
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 0,
|
||||
CMD_OUT
|
||||
};
|
||||
c.data = &t;
|
||||
c.data_size = sizeof (t);
|
||||
c.cmd[0] = SET_TIMEOUT;
|
||||
c.cmd[2] = 0x8d;
|
||||
*((u16 *) (c.cmd + 7)) = cpu2be16 (sizeof (t));
|
||||
if (s->bus == USB)
|
||||
sanei_usb_set_timeout (timeout * 1000);
|
||||
|
||||
return send_command (s, &c);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
set_window (struct scanner * s, int wnd_id)
|
||||
{
|
||||
struct window wnd;
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 0,
|
||||
CMD_OUT
|
||||
};
|
||||
c.data = &wnd;
|
||||
c.data_size = sizeof (wnd);
|
||||
c.cmd[0] = SET_WINDOW;
|
||||
*((u16 *) (c.cmd + 7)) = cpu2be16 (sizeof (wnd));
|
||||
init_window (s, &wnd, wnd_id);
|
||||
|
||||
return send_command (s, &c);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
reset_window (struct scanner * s)
|
||||
{
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 0,
|
||||
CMD_NONE
|
||||
};
|
||||
c.cmd[0] = SET_WINDOW;
|
||||
|
||||
return send_command (s, &c);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
scan (struct scanner * s)
|
||||
{
|
||||
struct cmd c = {
|
||||
{0}, 6,
|
||||
NULL, 0,
|
||||
CMD_NONE
|
||||
};
|
||||
c.cmd[0] = SCAN;
|
||||
return send_command (s, &c);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
hopper_down (struct scanner * s)
|
||||
{
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 0,
|
||||
CMD_NONE
|
||||
};
|
||||
c.cmd[0] = HOPPER_DOWN;
|
||||
c.cmd[2] = 5;
|
||||
|
||||
if (s->id == KV_S7075C)
|
||||
return SANE_STATUS_GOOD;
|
||||
return send_command (s, &c);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
stop_adf (struct scanner * s)
|
||||
{
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 0,
|
||||
CMD_NONE
|
||||
};
|
||||
c.cmd[0] = STOP_ADF;
|
||||
c.cmd[2] = 0x8b;
|
||||
return send_command (s, &c);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
document_exist (struct scanner * s)
|
||||
{
|
||||
SANE_Status status;
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 6,
|
||||
CMD_IN
|
||||
};
|
||||
u8 *d;
|
||||
c.cmd[0] = READ_10;
|
||||
c.cmd[2] = 0x81;
|
||||
set24 (c.cmd + 6, c.data_size);
|
||||
status = send_command (s, &c);
|
||||
if (status)
|
||||
return status;
|
||||
d = c.data;
|
||||
if (d[0] & 0x20)
|
||||
return SANE_STATUS_GOOD;
|
||||
|
||||
return SANE_STATUS_NO_DOCS;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
read_picture_element (struct scanner * s, unsigned side, SANE_Parameters * p)
|
||||
{
|
||||
SANE_Status status;
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 16,
|
||||
CMD_IN
|
||||
};
|
||||
u32 *data;
|
||||
c.cmd[0] = READ_10;
|
||||
c.cmd[2] = 0x80;
|
||||
c.cmd[5] = side;
|
||||
set24 (c.cmd + 6, c.data_size);
|
||||
|
||||
status = send_command (s, &c);
|
||||
if (status)
|
||||
return status;
|
||||
data = (u32 *) c.data;
|
||||
p->pixels_per_line = be2cpu32 (data[0]);
|
||||
p->lines = be2cpu32 (data[1]);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
get_buffer_status (struct scanner * s, unsigned *data_avalible)
|
||||
{
|
||||
SANE_Status status;
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 12,
|
||||
CMD_IN
|
||||
};
|
||||
c.cmd[0] = GET_BUFFER_STATUS;
|
||||
c.cmd[7] = 12;
|
||||
|
||||
status = send_command (s, &c);
|
||||
if (status)
|
||||
return status;
|
||||
*data_avalible = get24 ((unsigned char *)c.data + 9);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
read_image_data (struct scanner * s, unsigned page,
|
||||
unsigned side, void *buf, unsigned max_size, unsigned *size)
|
||||
{
|
||||
SANE_Status status;
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 0,
|
||||
CMD_IN
|
||||
};
|
||||
c.data_size = max_size < MAX_READ_DATA_SIZE ? max_size : MAX_READ_DATA_SIZE;
|
||||
c.cmd[0] = READ_10;
|
||||
c.cmd[4] = page;
|
||||
c.cmd[5] = side;
|
||||
|
||||
set24 (c.cmd + 6, c.data_size);
|
||||
*size = 0;
|
||||
status = send_command (s, &c);
|
||||
|
||||
if (status && status != SANE_STATUS_EOF && status != INCORRECT_LENGTH)
|
||||
return status;
|
||||
|
||||
*size = c.data_size;
|
||||
memcpy (buf, c.data, *size);
|
||||
return status;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
get_adjust_data (struct scanner * s, unsigned *dummy_length)
|
||||
{
|
||||
SANE_Status status;
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, 40,
|
||||
CMD_IN
|
||||
};
|
||||
u16 *data;
|
||||
|
||||
c.cmd[0] = GET_ADJUST_DATA;
|
||||
c.cmd[2] = 0x9b;
|
||||
c.cmd[8] = 40;
|
||||
status = send_command (s, &c);
|
||||
if (status)
|
||||
return status;
|
||||
data = (u16 *) c.data;
|
||||
*dummy_length = be2cpu16 (data[0]);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
read_support_info (struct scanner * s, struct support_info * inf)
|
||||
{
|
||||
SANE_Status st;
|
||||
struct cmd c = {
|
||||
{0}, 10,
|
||||
NULL, sizeof (*inf),
|
||||
CMD_IN
|
||||
};
|
||||
|
||||
c.cmd[0] = READ_10;
|
||||
c.cmd[2] = SUPPORT_INFO;
|
||||
set24 (c.cmd + 6, c.data_size);
|
||||
|
||||
st = send_command (s, &c);
|
||||
if (st)
|
||||
return st;
|
||||
memcpy (inf, c.data, sizeof (*inf));
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
inquiry (struct scanner * s, char *id)
|
||||
{
|
||||
int i;
|
||||
SANE_Status st;
|
||||
struct cmd c = {
|
||||
{0}, 5,
|
||||
NULL, 0x60,
|
||||
CMD_IN
|
||||
};
|
||||
|
||||
c.cmd[0] = INQUIRY;
|
||||
c.cmd[4] = c.data_size;
|
||||
|
||||
st = send_command (s, &c);
|
||||
if (st)
|
||||
return st;
|
||||
memcpy (id, (unsigned char *)c.data + 16, 16);
|
||||
for (i = 0; i < 15 && id[i] != ' '; i++);
|
||||
id[i] = 0;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
Plik diff jest za duży
Load Diff
|
@ -16871,7 +16871,7 @@ ALL_BACKENDS="abaton agfafocus apple artec artec_eplus48u as6e \
|
|||
dell1600n_net dmc epjitsu epson epson2 fujitsu genesys \
|
||||
gphoto2 gt68xx hp hp3500 hp3900 hp4200 hp5400 \
|
||||
hp5590 hpsj5s hpljm1005 hs2p ibm kodak kvs1025 kvs20xx \
|
||||
leo lexmark ma1509 magicolor \
|
||||
kvs40xx leo lexmark ma1509 magicolor \
|
||||
matsushita microtek microtek2 mustek mustek_pp \
|
||||
mustek_usb mustek_usb2 nec net niash pie pint \
|
||||
pixma plustek plustek_pp qcam ricoh rts8891 s9036 \
|
||||
|
@ -16982,7 +16982,7 @@ for be in ${BACKENDS}; do
|
|||
fi
|
||||
;;
|
||||
|
||||
mustek_usb2)
|
||||
mustek_usb2|kvs40xx)
|
||||
if test "${have_pthread}" != "yes"; then
|
||||
echo "*** $be backend requires pthread library - $DISABLE_MSG"
|
||||
backend_supported="no"
|
||||
|
@ -17143,7 +17143,7 @@ for be in ${BACKENDS}; do
|
|||
fi
|
||||
;;
|
||||
|
||||
mustek_usb2)
|
||||
mustek_usb2|kvs40xx)
|
||||
if test "${have_pthread}" != "yes"; then
|
||||
echo "*** $be backend requires pthread library - $DISABLE_MSG"
|
||||
backend_supported="no"
|
||||
|
|
|
@ -556,7 +556,7 @@ ALL_BACKENDS="abaton agfafocus apple artec artec_eplus48u as6e \
|
|||
dell1600n_net dmc epjitsu epson epson2 fujitsu genesys \
|
||||
gphoto2 gt68xx hp hp3500 hp3900 hp4200 hp5400 \
|
||||
hp5590 hpsj5s hpljm1005 hs2p ibm kodak kvs1025 kvs20xx \
|
||||
leo lexmark ma1509 magicolor \
|
||||
kvs40xx leo lexmark ma1509 magicolor \
|
||||
matsushita microtek microtek2 mustek mustek_pp \
|
||||
mustek_usb mustek_usb2 nec net niash pie pint \
|
||||
pixma plustek plustek_pp qcam ricoh rts8891 s9036 \
|
||||
|
|
|
@ -37,7 +37,7 @@ BACKEND_5MANS = sane-abaton.5 sane-agfafocus.5 sane-apple.5 sane-as6e.5 \
|
|||
sane-hp5590.5 sane-hpljm1005.5 sane-cardscan.5 sane-hp3900.5 \
|
||||
sane-epjitsu.5 sane-hs2p.5 sane-canon_dr.5 sane-xerox_mfp.5 \
|
||||
sane-rts8891.5 sane-coolscan3.5 sane-kvs1025.5 sane-kvs20xx.5 \
|
||||
sane-p5.5 sane-magicolor.5
|
||||
sane-kvs40xx.5 sane-p5.5 sane-magicolor.5
|
||||
|
||||
EXTRA_DIST += sane-abaton.man sane-agfafocus.man sane-apple.man sane-as6e.man \
|
||||
sane-dll.man sane-dc25.man sane-dmc.man sane-epson.man \
|
||||
|
@ -61,8 +61,8 @@ EXTRA_DIST += sane-abaton.man sane-agfafocus.man sane-apple.man sane-as6e.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-p5.man \
|
||||
sane-magicolor.man
|
||||
sane-coolscan3.man sane-kvs1025.man sane-kvs20xx.man sane-kvs40xx.man \
|
||||
sane-p5.man sane-magicolor.man
|
||||
|
||||
man7_MANS = sane.7
|
||||
EXTRA_DIST += sane.man
|
||||
|
@ -175,6 +175,7 @@ DESC_FILES = descriptions/abaton.desc descriptions/agfafocus.desc \
|
|||
descriptions/hp5590.desc descriptions/hp.desc descriptions/hpljm1005.desc \
|
||||
descriptions/hpsj5s.desc descriptions/hs2p.desc descriptions/ibm.desc \
|
||||
descriptions/kodak.desc descriptions/kvs1025.desc descriptions/kvs20xx.desc \
|
||||
descriptions/kvs40xx.desc \
|
||||
descriptions/leo.desc descriptions/lexmark.desc descriptions/ma1509.desc \
|
||||
descriptions/magicolor.desc \
|
||||
descriptions/matsushita.desc descriptions/microtek2.desc \
|
||||
|
|
|
@ -283,7 +283,7 @@ EXTRA_DIST = scanimage.man sane-config.man sane-find-scanner.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-p5.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 sane.tex \
|
||||
net.tex html.sty $(DESC_FILES) descriptions/template.desc. \
|
||||
|
@ -315,7 +315,7 @@ BACKEND_5MANS = sane-abaton.5 sane-agfafocus.5 sane-apple.5 sane-as6e.5 \
|
|||
sane-hp5590.5 sane-hpljm1005.5 sane-cardscan.5 sane-hp3900.5 \
|
||||
sane-epjitsu.5 sane-hs2p.5 sane-canon_dr.5 sane-xerox_mfp.5 \
|
||||
sane-rts8891.5 sane-coolscan3.5 sane-kvs1025.5 sane-kvs20xx.5 \
|
||||
sane-p5.5 sane-magicolor.5
|
||||
sane-kvs40xx.5 sane-p5.5 sane-magicolor.5
|
||||
|
||||
man7_MANS = sane.7
|
||||
man8_MANS = saned.8
|
||||
|
@ -381,6 +381,7 @@ DESC_FILES = descriptions/abaton.desc descriptions/agfafocus.desc \
|
|||
descriptions/hp5590.desc descriptions/hp.desc descriptions/hpljm1005.desc \
|
||||
descriptions/hpsj5s.desc descriptions/hs2p.desc descriptions/ibm.desc \
|
||||
descriptions/kodak.desc descriptions/kvs1025.desc descriptions/kvs20xx.desc \
|
||||
descriptions/kvs40xx.desc \
|
||||
descriptions/leo.desc descriptions/lexmark.desc descriptions/ma1509.desc \
|
||||
descriptions/magicolor.desc \
|
||||
descriptions/matsushita.desc descriptions/microtek2.desc \
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
;
|
||||
; 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?).
|
||||
;
|
||||
|
||||
:backend "kvs40xx" ; name of backend
|
||||
:version "2" ; version of backend
|
||||
:new :yes
|
||||
:manpage "sane-kvs40xx" ; name of manpage (if it exists)
|
||||
:comment "New backend for SANE release 1.0.23, see sane-kvs40xx manpage"
|
||||
:devicetype :scanner ; start of a list of devices....
|
||||
|
||||
:mfg "Panasonic" ; name a manufacturer
|
||||
:url "http://www.panasonic.com/"
|
||||
|
||||
:model "KV-S4065C"
|
||||
:interface "USB"
|
||||
:usbid "0x04da" "0x100d"
|
||||
:status :untested
|
||||
|
||||
:model "KV-S4085C"
|
||||
:interface "USB"
|
||||
:usbid "0x04da" "0x100c"
|
||||
:status :untested
|
||||
|
||||
:model "KV-S7075C"
|
||||
:interface "USB"
|
||||
:usbid "0x04da" "0x100e"
|
||||
:status :untested
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
.TH sane\-kvs40xx 5 "03 Jun 2011" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
|
||||
.IX sane\-kvs40xx
|
||||
|
||||
.SH NAME
|
||||
sane\-kvs40xx \- SANE backend for Panasonic KV-S40xxC USB/SCSI ADF scanners.
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B sane\-kvs40xx
|
||||
library implements a SANE (Scanner Access Now Easy) backend which
|
||||
provides access to the Panasonic KV-S40xxC and KV-S70xxC scanners.
|
||||
|
||||
.SH KNOWN ISSUES
|
||||
This document was written by the SANE project, which has no information
|
||||
regarding the capabilites or reliability of the backend. All information
|
||||
contained here is suspect.
|
||||
|
||||
The backend uses pthreads directly, and so requires pthreads to be enabled.
|
||||
|
||||
.SH CREDITS
|
||||
The backend was written by Panasonic Russia Ltd.
|
||||
|
||||
The backend was ported to sane-backends 1.0.23 and downgraded to C89
|
||||
by m. allan noah.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
sane(7), sane\-usb(5), sane\-scsi(5)
|
||||
|
||||
.SH AUTHOR
|
||||
m. allan noah: <kitno455 a t gmail d o t com>
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
*.mo
|
||||
.tmp
|
||||
|
||||
sane-backends.pot
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
../backend/hp-option.c
|
||||
../backend/hp-option.h
|
||||
|
||||
../backend/kvs40xx.c
|
||||
../backend/kvs40xx_opt.c
|
||||
|
||||
../backend/leo.c
|
||||
../backend/leo.h
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue