diff options
-rw-r--r-- | debian/patches/0011-test.patch | 34 | ||||
-rw-r--r-- | debian/patches/0035-trim-libraries-in-sane-backends.pc.in.patch | 24 | ||||
-rw-r--r-- | debian/patches/0045-disable_lock_test_at_build_time.patch | 27 | ||||
-rw-r--r-- | debian/patches/0055-Fix_build_error.patch | 36 | ||||
-rw-r--r-- | debian/patches/0165-respect_local_only_parameter.patch | 768 | ||||
-rw-r--r-- | debian/patches/0170-return_empty_list_when_local_devices_requested.patch | 43 | ||||
-rw-r--r-- | debian/patches/0180-gt68xx_fix_use-after-free_two_memleaks.patch | 55 | ||||
-rw-r--r-- | debian/patches/0185-Change_output_from_sane-find-scanner.patch | 51 | ||||
-rw-r--r-- | debian/patches/0190-remove-kernel-driver-for-plustek_pp.patch | 2949 | ||||
-rw-r--r-- | debian/patches/0195-genesys_fix_total_file_size_exceeding.patch | 100 | ||||
-rw-r--r-- | debian/patches/0600-scanimage_manpage.patch | 21 | ||||
-rw-r--r-- | debian/patches/series | 11 |
12 files changed, 0 insertions, 4119 deletions
diff --git a/debian/patches/0011-test.patch b/debian/patches/0011-test.patch deleted file mode 100644 index d4d4590..0000000 --- a/debian/patches/0011-test.patch +++ /dev/null @@ -1,34 +0,0 @@ -Index: trunk/frontend/jpegtopdf.c -=================================================================== ---- trunk.orig/frontend/jpegtopdf.c -+++ trunk/frontend/jpegtopdf.c -@@ -184,6 +184,7 @@ static SANE_Int _get_current_time( struc - SANE_Int ret = SANE_ERR; - time_t t; - long tz; -+ long timezone = 0; - - if ( pt == NULL || sign_c == NULL || ptz_h == NULL || ptz_m == NULL ) { - goto EXIT; -@@ -201,7 +202,7 @@ static SANE_Int _get_current_time( struc - goto EXIT; - } - /* get time difference ( OHH'mm' ) */ -- tz = timezone; -+ tz = timezone; - if ( tz > 0 ) { - *sign_c = '-'; - } -Index: trunk/configure.ac -=================================================================== ---- trunk.orig/configure.ac -+++ trunk/configure.ac -@@ -671,7 +671,7 @@ ALL_BACKENDS="abaton agfafocus apple art - mustek_usb mustek_usb2 nec net niash pie pieusb pint \ - pixma plustek plustek_pp qcam ricoh ricoh2 rts8891 s9036 \ - sceptre sharp sm3600 sm3840 snapscan sp15c st400 \ -- stv680 tamarack teco1 teco2 teco3 test u12 umax -+ stv680 tamarack teco1 teco2 teco3 test u12 umax \ - umax_pp umax1220u v4l xerox_mfp p5" - - # If user specifies backends manually then cause configure diff --git a/debian/patches/0035-trim-libraries-in-sane-backends.pc.in.patch b/debian/patches/0035-trim-libraries-in-sane-backends.pc.in.patch deleted file mode 100644 index 7452b33..0000000 --- a/debian/patches/0035-trim-libraries-in-sane-backends.pc.in.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Markus Koschany <apo@gambaru.de> -Date: Sun, 30 Jun 2013 19:13:54 +0200 -Subject: trim libraries in sane-backends.pc.in - -Update the original sane-config_and_pkg-config_fixes.patch from Julien BLACHE. -Patching RPATH related flags is no longer necessary. Still trim the libraries -in sane-backends.pc.in to the bare minimum for what is needed for libsane. ---- - tools/sane-backends.pc.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/tools/sane-backends.pc.in -+++ b/tools/sane-backends.pc.in -@@ -2,8 +2,8 @@ - exec_prefix=@exec_prefix@ - libdir=@libdir@ - includedir=@includedir@ --ldflags=@LDFLAGS@ @GPHOTO2_LDFLAGS@ --libs=@LIBS@ @DL_LIBS@ @LIBV4L_LIBS@ @MATH_LIB@ @TIFF_LIBS@ @JPEG_LIBS@ @GPHOTO2_LIBS@ @SOCKET_LIBS@ @AVAHI_LIBS@ @USB_LIBS@ @SCSI_LIBS@ @RESMGR_LIBS@ -+ldflags=@LDFLAGS@ -+libs=@LIBS@ - - Name: SANE Backends - Description: Backends for SANE, the universal scanner interface diff --git a/debian/patches/0045-disable_lock_test_at_build_time.patch b/debian/patches/0045-disable_lock_test_at_build_time.patch deleted file mode 100644 index 8aeccf8..0000000 --- a/debian/patches/0045-disable_lock_test_at_build_time.patch +++ /dev/null @@ -1,27 +0,0 @@ -Description: Disable lock test at buildtime -Author: Jörg Frings-Fürst <debian@jff.emaill> -Forwarded: not-needed -Last-Update: 2020-08-28 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/acinclude.m4 -=================================================================== ---- trunk.orig/acinclude.m4 -+++ trunk/acinclude.m4 -@@ -356,11 +356,11 @@ AC_DEFUN([SANE_CHECK_LOCKING], - touch sanetest.file - chgrp $LOCKPATH_GROUP sanetest.file 2>/dev/null || lasterror=$? - rm -f sanetest.file -- if test ! -z "$lasterror"; then -- AC_MSG_WARN([Group $LOCKPATH_GROUP does not exist on this system.]) -- AC_MSG_WARN([Locking feature will be disabled.]) -- use_locking=no -- fi -+# if test ! -z "$lasterror"; then -+# AC_MSG_WARN([Group $LOCKPATH_GROUP does not exist on this system.]) -+# AC_MSG_WARN([Locking feature will be disabled.]) -+# use_locking=no -+# fi - fi - if test $use_locking = yes ; then - INSTALL_LOCKPATH=install-lockpath diff --git a/debian/patches/0055-Fix_build_error.patch b/debian/patches/0055-Fix_build_error.patch deleted file mode 100644 index b1b09b1..0000000 --- a/debian/patches/0055-Fix_build_error.patch +++ /dev/null @@ -1,36 +0,0 @@ -Description: Fix build error -Author: Jörg Frings-Fürst <debian@jff.email> -Forwarded: not-needed -Last-Update: 2020-08-28 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/po/POTFILES.in -=================================================================== ---- trunk.orig/po/POTFILES.in -+++ trunk/po/POTFILES.in -@@ -65,7 +65,7 @@ backend/p5.c - backend/p5.h - backend/p5_device.c - backend/pixma/pixma.c --backend/pixma/pixma_sane_options.c -+backend/pixma/pixma_sane_options.c - backend/plustek.c - backend/plustek_pp.c - backend/pnm.c -Index: trunk/backend/Makefile.am -=================================================================== ---- trunk.orig/backend/Makefile.am -+++ trunk/backend/Makefile.am -@@ -947,10 +947,10 @@ $(srcdir)/pixma/pixma.c: \ - - $(srcdir)/pixma/pixma_sane_options.h: - @echo Generating $@ from $(@D)/pixma.c -- @(cd $(@D); python scripts/pixma_gen_options.py h < pixma.c > $(@F)) -+ @(cd $(@D); python3 scripts/pixma_gen_options.py h < pixma.c > $(@F)) - $(srcdir)/pixma/pixma_sane_options.c: - @echo Generating $@ from $(@D)/pixma.c -- @(cd $(@D); python scripts/pixma_gen_options.py < pixma.c > $(@F)) -+ @(cd $(@D); python3 scripts/pixma_gen_options.py < pixma.c > $(@F)) - - EXTRA_DIST += pixma/pixma_sane_options.c - EXTRA_DIST += pixma/pixma_sane_options.h diff --git a/debian/patches/0165-respect_local_only_parameter.patch b/debian/patches/0165-respect_local_only_parameter.patch deleted file mode 100644 index f73a731..0000000 --- a/debian/patches/0165-respect_local_only_parameter.patch +++ /dev/null @@ -1,768 +0,0 @@ -Description: respect 'local_only' parameter of sane_get_devices() -Author: Barnabás Pőcze <pobrn@protonmail.com> -Origin: backport, https://gitlab.com/sane-project/backends/-/commit/245564dffe96ddf0fd1c703c48973cd35fddd268 -Bug: https://gitlab.com/sane-project/backends/-/merge_requests/502/ -Forwarded: no-needed -Last-Update: 2020-09-05 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/backend/dell1600n_net.c -=================================================================== ---- trunk.orig/backend/dell1600n_net.c -+++ trunk/backend/dell1600n_net.c -@@ -288,8 +288,7 @@ sane_exit (void) - /***********************************************************/ - - SANE_Status --sane_get_devices (const SANE_Device *** device_list, -- SANE_Bool __sane_unused__ local_only) -+sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only) - { - - int ret; -@@ -312,6 +311,10 @@ sane_get_devices (const SANE_Device *** - sock = 0; - pDevice = NULL; - optYes = 1; -+ -+ if (local_only) -+ return ret; -+ - InitComBuf (&queryPacket); - - /* clear previous results */ -Index: trunk/backend/epson2.c -=================================================================== ---- trunk.orig/backend/epson2.c -+++ trunk/backend/epson2.c -@@ -813,10 +813,11 @@ attach_one_pio(const char *dev) - } - - static SANE_Status --attach_one_config(SANEI_Config __sane_unused__ *config, const char *line) -+attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, -+ void *data) - { - int vendor, product; -- -+ SANE_Bool local_only = *(SANE_Bool*) data; - int len = strlen(line); - - DBG(7, "%s: len = %d, line = %s\n", __func__, len, line); -@@ -847,13 +848,16 @@ attach_one_config(SANEI_Config __sane_un - - } else if (strncmp(line, "net", 3) == 0) { - -- /* remove the "net" sub string */ -- const char *name = sanei_config_skip_whitespace(line + 3); -- -- if (strncmp(name, "autodiscovery", 13) == 0) -- e2_network_discovery(); -- else -- attach_one_net(name); -+ if (!local_only) { -+ /* remove the "net" sub string */ -+ const char *name = -+ sanei_config_skip_whitespace(line + 3); -+ -+ if (strncmp(name, "autodiscovery", 13) == 0) -+ e2_network_discovery(); -+ else -+ attach_one_net(name); -+ } - - } else if (strncmp(line, "pio", 3) == 0) { - -@@ -889,14 +893,14 @@ free_devices(void) - } - - static void --probe_devices(void) -+probe_devices(SANE_Bool local_only) - { - DBG(5, "%s\n", __func__); - - free_devices(); - - sanei_configure_attach(EPSON2_CONFIG_FILE, NULL, -- attach_one_config); -+ attach_one_config, &local_only); - } - - SANE_Status -@@ -926,14 +930,14 @@ sane_exit(void) - } - - SANE_Status --sane_get_devices(const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only) -+sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only) - { - Epson_Device *dev; - int i; - - DBG(5, "%s\n", __func__); - -- probe_devices(); -+ probe_devices(local_only); - - devlist = malloc((num_devices + 1) * sizeof(devlist[0])); - if (!devlist) { -@@ -1470,7 +1474,7 @@ sane_open(SANE_String_Const name, SANE_H - /* probe if empty device name provided */ - if (l == 0) { - -- probe_devices(); -+ probe_devices(SANE_FALSE); - - if (first_dev == NULL) { - DBG(1, "no device detected\n"); -@@ -1507,7 +1511,7 @@ sane_open(SANE_String_Const name, SANE_H - */ - - if (first_dev == NULL) -- probe_devices(); -+ probe_devices(SANE_FALSE); - - s = device_detect(name, SANE_EPSON_NODEV, 0, &status); - if (s == NULL) { -Index: trunk/backend/epsonds.c -=================================================================== ---- trunk.orig/backend/epsonds.c -+++ trunk/backend/epsonds.c -@@ -481,10 +481,11 @@ attach_one_net(const char *dev) - - - static SANE_Status --attach_one_config(SANEI_Config __sane_unused__ *config, const char *line) -+attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, -+ void *data) - { - int vendor, product; -- -+ SANE_Bool local_only = *(SANE_Bool*) data; - int len = strlen(line); - - DBG(7, "%s: len = %d, line = %s\n", __func__, len, line); -@@ -513,13 +514,16 @@ attach_one_config(SANEI_Config __sane_un - - } else if (strncmp(line, "net", 3) == 0) { - -- /* remove the "net" sub string */ -- const char *name = sanei_config_skip_whitespace(line + 3); -- -- if (strncmp(name, "autodiscovery", 13) == 0) -- e2_network_discovery(); -- else -- attach_one_net(name); -+ if (!local_only) { -+ /* remove the "net" sub string */ -+ const char *name = -+ sanei_config_skip_whitespace(line + 3); -+ -+ if (strncmp(name, "autodiscovery", 13) == 0) -+ e2_network_discovery(); -+ else -+ attach_one_net(name); -+ } - - } else { - DBG(0, "unable to parse config line: %s\n", line); -@@ -545,12 +549,13 @@ free_devices(void) - } - - static void --probe_devices(void) -+probe_devices(SANE_Bool local_only) - { - DBG(5, "%s\n", __func__); - - free_devices(); -- sanei_configure_attach(EPSONDS_CONFIG_FILE, NULL, attach_one_config); -+ sanei_configure_attach(EPSONDS_CONFIG_FILE, NULL, -+ attach_one_config, &local_only); - } - - /**** SANE API ****/ -@@ -581,14 +586,14 @@ sane_exit(void) - } - - SANE_Status --sane_get_devices(const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only) -+sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only) - { - int i; - epsonds_device *dev; - - DBG(5, "** %s\n", __func__); - -- probe_devices(); -+ probe_devices(local_only); - - devlist = malloc((num_devices + 1) * sizeof(devlist[0])); - if (!devlist) { -@@ -793,7 +798,7 @@ sane_open(SANE_String_Const name, SANE_H - /* probe if empty device name provided */ - if (name[0] == '\0') { - -- probe_devices(); -+ probe_devices(SANE_FALSE); - - if (first_dev == NULL) { - DBG(1, "no devices detected\n"); -Index: trunk/backend/escl/escl.c -=================================================================== ---- trunk.orig/backend/escl/escl.c -+++ trunk/backend/escl/escl.c -@@ -383,7 +383,8 @@ sane_exit(void) - * \return escl_add_in_list(escl_device) if the parsing worked, SANE_STATUS_GOOD otherwise. - */ - static SANE_Status --attach_one_config(SANEI_Config __sane_unused__ *config, const char *line) -+attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, -+ void __sane_unused__ *data) - { - int port = 0; - SANE_Status status; -@@ -487,7 +488,8 @@ sane_get_devices(const SANE_Device ***de - - if (device_list == NULL) - return (SANE_STATUS_INVAL); -- status = sanei_configure_attach(ESCL_CONFIG_FILE, NULL, attach_one_config); -+ status = sanei_configure_attach(ESCL_CONFIG_FILE, NULL, -+ attach_one_config, NULL); - if (status != SANE_STATUS_GOOD) - return (status); - escl_devices(&status); -Index: trunk/backend/genesys/genesys.cpp -=================================================================== ---- trunk.orig/backend/genesys/genesys.cpp -+++ trunk/backend/genesys/genesys.cpp -@@ -5186,7 +5186,8 @@ static SANE_Status attach_one_device(SAN - - // this function is passed to C API, it must not throw - static SANE_Status --config_attach_genesys(SANEI_Config __sane_unused__ *config, const char *devname) noexcept -+config_attach_genesys(SANEI_Config __sane_unused__ *config, const char *devname, -+ void __sane_unused__ *data) noexcept - { - /* the devname has been processed and is ready to be used - * directly. Since the backend is an USB only one, we can -@@ -5214,7 +5215,8 @@ static void probe_genesys_devices() - config.values = nullptr; - config.count = 0; - -- auto status = sanei_configure_attach(GENESYS_CONFIG_FILE, &config, config_attach_genesys); -+ auto status = sanei_configure_attach(GENESYS_CONFIG_FILE, &config, -+ config_attach_genesys, NULL); - if (status == SANE_STATUS_ACCESS_DENIED) { - dbg.vlog(DBG_error0, "Critical error: Couldn't access configuration file '%s'", - GENESYS_CONFIG_FILE); -Index: trunk/backend/kodakaio.c -=================================================================== ---- trunk.orig/backend/kodakaio.c -+++ trunk/backend/kodakaio.c -@@ -2513,10 +2513,11 @@ attach_one_net(const char *dev, unsigned - } - - static SANE_Status --attach_one_config(SANEI_Config __sane_unused__ *config, const char *line) -+attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, -+ void *data) - { - int vendor, product, timeout; -- -+ SANE_Bool local_only = *(SANE_Bool*) data; - int len = strlen(line); - - DBG(7, "%s: len = %d, line = %s\n", __func__, len, line); -@@ -2550,27 +2551,30 @@ attach_one_config(SANEI_Config __sane_un - - } else if (strncmp(line, "net", 3) == 0) { - -- /* remove the "net" sub string */ -- const char *name = sanei_config_skip_whitespace(line + 3); -- char IP[1024]; -- unsigned int model = 0; -- -- if (strncmp(name, "autodiscovery", 13) == 0) { -- --#if WITH_AVAHI -- DBG (30, "%s: Initiating network autodiscovery via avahi\n", __func__); -- kodak_network_discovery(NULL); --#else -- DBG (20, "%s: Network autodiscovery not done because not configured with avahi.\n", __func__); --#endif -- -- } else if (sscanf(name, "%s %x", IP, &model) == 2) { -- DBG(30, "%s: Using network device on IP %s, forcing model 0x%x\n", __func__, IP, model); -- attach_one_net(IP, model); -- } else { -+ if (!local_only) { -+ /* remove the "net" sub string */ -+ const char *name = -+ sanei_config_skip_whitespace(line + 3); -+ char IP[1024]; -+ unsigned int model = 0; -+ -+ if (strncmp(name, "autodiscovery", 13) == 0) { -+ -+ #if WITH_AVAHI -+ DBG (30, "%s: Initiating network autodiscovery via avahi\n", __func__); -+ kodak_network_discovery(NULL); -+ #else -+ DBG (20, "%s: Network autodiscovery not done because not configured with avahi.\n", __func__); -+ #endif -+ -+ } else if (sscanf(name, "%s %x", IP, &model) == 2) { -+ DBG(30, "%s: Using network device on IP %s, forcing model 0x%x\n", __func__, IP, model); -+ attach_one_net(IP, model); -+ } else { - DBG(1, "%s: net entry %s may be a host name?\n", __func__, name); - attach_one_net(name, 0); - } -+ } - - } else if (sscanf(line, "snmp-timeout %i\n", &timeout)) { - /* Timeout for auto network discovery */ -@@ -2646,7 +2650,7 @@ sane_exit(void) - } - - SANE_Status --sane_get_devices(const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only) -+sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only) - { - Kodak_Device *dev, *s, *prev=0; - int i; -@@ -2662,7 +2666,7 @@ sane_get_devices(const SANE_Device ***de - - /* Read the config, mark each device as found, possibly add new devs */ - sanei_configure_attach(KODAKAIO_CONFIG_FILE, NULL, -- attach_one_config); -+ attach_one_config, &local_only); - - /*delete missing scanners from list*/ - for (s = first_dev; s;) { -Index: trunk/backend/magicolor.c -=================================================================== ---- trunk.orig/backend/magicolor.c -+++ trunk/backend/magicolor.c -@@ -2157,10 +2157,11 @@ attach_one_net(const char *dev, unsigned - } - - static SANE_Status --attach_one_config(SANEI_Config __sane_unused__ *config, const char *line) -+attach_one_config(SANEI_Config __sane_unused__ *config, const char *line, -+ void *data) - { - int vendor, product, timeout; -- -+ SANE_Bool local_only = *(SANE_Bool*) data; - int len = strlen(line); - - DBG(7, "%s: len = %d, line = %s\n", __func__, len, line); -@@ -2189,24 +2190,27 @@ attach_one_config(SANEI_Config __sane_un - - } else if (strncmp(line, "net", 3) == 0) { - -- /* remove the "net" sub string */ -- const char *name = sanei_config_skip_whitespace(line + 3); -- char IP[1024]; -- unsigned int model = 0; -- -- if (strncmp(name, "autodiscovery", 13) == 0) { -- DBG (50, "%s: Initiating network autodiscovervy via SNMP\n", __func__); -- mc_network_discovery(NULL); -- } else if (sscanf(name, "%s %x", IP, &model) == 2) { -- DBG(50, "%s: Using network device on IP %s, forcing model 0x%x\n", __func__, IP, model); -- attach_one_net(IP, model); -- } else { -- /* use SNMP to detect the type. If not successful, -- * add the host with model type 0 */ -- DBG(50, "%s: Using network device on IP %s, trying to autodetect model\n", __func__, IP); -- if (mc_network_discovery(name)==0) { -- DBG(1, "%s: Autodetecting device model failed, using default model\n", __func__); -- attach_one_net(name, 0); -+ if (!local_only) { -+ /* remove the "net" sub string */ -+ const char *name = -+ sanei_config_skip_whitespace(line + 3); -+ char IP[1024]; -+ unsigned int model = 0; -+ -+ if (strncmp(name, "autodiscovery", 13) == 0) { -+ DBG (50, "%s: Initiating network autodiscovervy via SNMP\n", __func__); -+ mc_network_discovery(NULL); -+ } else if (sscanf(name, "%s %x", IP, &model) == 2) { -+ DBG(50, "%s: Using network device on IP %s, forcing model 0x%x\n", __func__, IP, model); -+ attach_one_net(IP, model); -+ } else { -+ /* use SNMP to detect the type. If not successful, -+ * add the host with model type 0 */ -+ DBG(50, "%s: Using network device on IP %s, trying to autodetect model\n", __func__, IP); -+ if (mc_network_discovery(name)==0) { -+ DBG(1, "%s: Autodetecting device model failed, using default model\n", __func__); -+ attach_one_net(name, 0); -+ } - } - } - -@@ -2279,7 +2283,7 @@ sane_exit(void) - } - - SANE_Status --sane_get_devices(const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only) -+sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only) - { - Magicolor_Device *dev, *s, *prev=0; - int i; -@@ -2295,7 +2299,7 @@ sane_get_devices(const SANE_Device ***de - - /* Read the config, mark each device as found, possibly add new devs */ - sanei_configure_attach(MAGICOLOR_CONFIG_FILE, NULL, -- attach_one_config); -+ attach_one_config, &local_only); - - /*delete missing scanners from list*/ - for (s = first_dev; s;) { -Index: trunk/backend/p5.c -=================================================================== ---- trunk.orig/backend/p5.c -+++ trunk/backend/p5.c -@@ -1566,7 +1566,8 @@ probe_p5_devices (void) - config.count = NUM_CFG_OPTIONS; - - /* generic configure and attach function */ -- status = sanei_configure_attach (P5_CONFIG_FILE, &config, config_attach); -+ status = sanei_configure_attach (P5_CONFIG_FILE, &config, -+ config_attach, NULL); - /* free allocated options */ - for (i = 0; i < NUM_CFG_OPTIONS; i++) - { -@@ -1590,7 +1591,8 @@ probe_p5_devices (void) - * SANE_STATUS_INVAL in case of error - */ - static SANE_Status --config_attach (SANEI_Config * config, const char *devname) -+config_attach (SANEI_Config __sane_unused__ * config, const char *devname, -+ void __sane_unused__ *data) - { - /* currently, the config is a global variable so config is useless here */ - /* the correct thing would be to have a generic sanei_attach_matching_devices -Index: trunk/backend/p5.h -=================================================================== ---- trunk.orig/backend/p5.h -+++ trunk/backend/p5.h -@@ -195,7 +195,8 @@ typedef struct P5_Session - - static SANE_Status probe_p5_devices (void); - static P5_Model *probe (const char *devicename); --static SANE_Status config_attach (SANEI_Config * config, const char *devname); -+static SANE_Status config_attach (SANEI_Config * config, const char *devname, -+ void *data); - static SANE_Status attach_p5 (const char *name, SANEI_Config * config); - static SANE_Status init_options (struct P5_Session *session); - static SANE_Status compute_parameters (struct P5_Session *session); -Index: trunk/backend/pixma/pixma.c -=================================================================== ---- trunk.orig/backend/pixma/pixma.c -+++ trunk/backend/pixma/pixma.c -@@ -159,10 +159,11 @@ static void mark_all_button_options_cach - ss -> button_option_is_cached[i] = 1; - } - --static SANE_Status config_attach_pixma(SANEI_Config * config, const char *devname) -+static SANE_Status config_attach_pixma(SANEI_Config __sane_unused__ * config, -+ const char *devname, -+ void __sane_unused__ *data) - { - int i; -- UNUSED(config); - for (i=0; i < (MAX_CONF_DEVICES -1); i++) - { - if(conf_devices[i] == NULL) -@@ -1656,8 +1657,8 @@ sane_init (SANE_Int * version_code, SANE - config.descriptors = NULL; - config.values = NULL; - -- if (sanei_configure_attach(PIXMA_CONFIG_FILE, &config, config_attach_pixma) != -- SANE_STATUS_GOOD) -+ if (sanei_configure_attach(PIXMA_CONFIG_FILE, &config, -+ config_attach_pixma, NULL) != SANE_STATUS_GOOD) - PDBG(pixma_dbg(2, "Could not read pixma configuration file: %s\n", - PIXMA_CONFIG_FILE)); - -Index: trunk/backend/rts8891.c -=================================================================== ---- trunk.orig/backend/rts8891.c -+++ trunk/backend/rts8891.c -@@ -217,7 +217,7 @@ static Rts8891_Config rtscfg; - /* ------------------------------------------------------------------------- */ - static SANE_Status probe_rts8891_devices (void); - static SANE_Status config_attach_rts8891 (SANEI_Config * config, -- const char *devname); -+ const char *devname, void *data); - static SANE_Status attach_rts8891 (const char *name); - static SANE_Status set_lamp_brightness (struct Rts8891_Device *dev, - int level); -@@ -2374,7 +2374,7 @@ probe_rts8891_devices (void) - - /* generic configure and attach function */ - status = sanei_configure_attach (RTS8891_CONFIG_FILE, &config, -- config_attach_rts8891); -+ config_attach_rts8891, NULL); - /* free allocated options */ - for (i = 0; i < NUM_CFG_OPTIONS; i++) - { -@@ -2398,7 +2398,8 @@ probe_rts8891_devices (void) - * SANE_STATUS_INVAL in case of error - */ - static SANE_Status --config_attach_rts8891 (SANEI_Config * config, const char *devname) -+config_attach_rts8891 (SANEI_Config * config, const char *devname, -+ void __sane_unused__ *data) - { - /* currently, the config is a global variable so config is useless here */ - /* the correct thing would be to have a generic sanei_attach_matching_devices -Index: trunk/backend/umax_pp.c -=================================================================== ---- trunk.orig/backend/umax_pp.c -+++ trunk/backend/umax_pp.c -@@ -419,7 +419,8 @@ umax_pp_auto_attach (SANEI_Config * conf - * device name to use for attach try. - */ - static SANE_Status --umax_pp_configure_attach (SANEI_Config * config, const char *devname) -+umax_pp_configure_attach (SANEI_Config * config, const char *devname, -+ void __sane_unused__ *data) - { - const char *lp; - SANE_Char *token; -@@ -961,7 +962,7 @@ sane_init (SANE_Int * version_code, SANE - - /* generic configure and attach function */ - status = sanei_configure_attach (UMAX_PP_CONFIG_FILE, &config, -- umax_pp_configure_attach); -+ umax_pp_configure_attach, NULL); - - /* free option descriptors */ - for (i = 0; i < NUM_CFG_OPTIONS; i++) -Index: trunk/backend/xerox_mfp.c -=================================================================== ---- trunk.orig/backend/xerox_mfp.c -+++ trunk/backend/xerox_mfp.c -@@ -1028,7 +1028,8 @@ list_one_device(SANE_String_Const devnam - - /* SANE API ignores return code of this callback */ - static SANE_Status --list_conf_devices(UNUSED(SANEI_Config *config), const char *devname) -+list_conf_devices(SANEI_Config __sane_unused__ *config, const char *devname, -+ void __sane_unused__ *data) - { - return tr_from_devname(devname)->configure_device(devname, list_one_device); - } -@@ -1080,7 +1081,7 @@ sane_get_devices(const SANE_Device *** d - config.count = 0; - config.descriptors = NULL; - config.values = NULL; -- sanei_configure_attach(XEROX_CONFIG_FILE, &config, list_conf_devices); -+ sanei_configure_attach(XEROX_CONFIG_FILE, &config, list_conf_devices, NULL); - - for (dev_count = 0, dev = devices_head; dev; dev = dev->next) - dev_count++; -Index: trunk/include/sane/sanei_config.h -=================================================================== ---- trunk.orig/include/sane/sanei_config.h -+++ trunk/include/sane/sanei_config.h -@@ -166,7 +166,9 @@ typedef struct - extern SANE_Status sanei_configure_attach ( - const char *config_file, - SANEI_Config *config, -- SANE_Status (*config_attach)(SANEI_Config *config, const char *devname) -+ SANE_Status (*config_attach)(SANEI_Config *config, const char *devname, -+ void *data), -+ void *data - ); - - /** Return the list of config directories, extracted from the SANE_CONFIG_DIR -Index: trunk/sanei/sanei_config.c -=================================================================== ---- trunk.orig/sanei/sanei_config.c -+++ trunk/sanei/sanei_config.c -@@ -239,7 +239,8 @@ sanei_config_read (char *str, int n, FIL - SANE_Status - sanei_configure_attach (const char *config_file, SANEI_Config * config, - SANE_Status (*attach) (SANEI_Config * config, -- const char *devname)) -+ const char *devname, void *data), -+ void *data) - { - SANE_Char line[PATH_MAX]; - SANE_Char *token, *string; -@@ -443,7 +444,7 @@ sanei_configure_attach (const char *conf - DBG (3, "sanei_configure_attach: trying to attach with '%s'\n", - lp2); - if(attach!=NULL) -- attach (config, lp2); -+ attach (config, lp2, data); - } - } - -Index: trunk/testsuite/sanei/sanei_config_test.c -=================================================================== ---- trunk.orig/testsuite/sanei/sanei_config_test.c -+++ trunk/testsuite/sanei/sanei_config_test.c -@@ -63,7 +63,8 @@ static const SANE_String_Const string_li - static char *lastdevname = NULL; - - static SANE_Status --check_config_attach (SANEI_Config * config, const char *devname) -+check_config_attach (SANEI_Config * config, const char *devname, -+ void __sane_unused__ *data) - { - /* silence compiler warning for now */ - if (config == NULL) -@@ -97,7 +98,8 @@ inexistent_config (void) - config.descriptors = NULL; - config.values = NULL; - status = sanei_configure_attach (CONFIG_PATH -- "/data/inexistent.conf", &config, NULL); -+ "/data/inexistent.conf", &config, -+ NULL, NULL); - - /* check results */ - assert (status != SANE_STATUS_GOOD); -@@ -114,7 +116,7 @@ null_config (void) - - status = - sanei_configure_attach (CONFIG_PATH "/data/umax_pp.conf", NULL, -- check_config_attach); -+ check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -130,7 +132,7 @@ null_attach (void) - SANE_Status status; - - status = sanei_configure_attach (CONFIG_PATH -- "/data/umax_pp.conf", NULL, NULL); -+ "/data/umax_pp.conf", NULL, NULL, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -151,7 +153,7 @@ empty_config (void) - config.values = NULL; - status = - sanei_configure_attach (CONFIG_PATH "/data/empty.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -206,7 +208,7 @@ string_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/string.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -250,7 +252,7 @@ int_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/int.conf", &config, -- check_config_attach); -+ check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -293,7 +295,7 @@ wrong_range_int_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/wrong-range.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_INVAL); -@@ -336,7 +338,7 @@ word_array_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/word-array.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -382,7 +384,7 @@ string_list_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/string-list.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -428,7 +430,7 @@ wrong_string_list_option (void) - status = - sanei_configure_attach (CONFIG_PATH - "/data/wrong-string-list.conf", &config, -- check_config_attach); -+ check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_INVAL); -@@ -563,7 +565,7 @@ umax_pp (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/umax_pp.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -631,7 +633,7 @@ wrong_bool_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/wrong-boolean.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_INVAL); -@@ -696,7 +698,7 @@ bool_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/boolean.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -767,7 +769,7 @@ fixed_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/fixed.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); -@@ -814,7 +816,7 @@ wrong_fixed_option (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/wrong-fixed.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_INVAL); -@@ -852,7 +854,7 @@ snapscan (void) - /* configure and attach */ - status = - sanei_configure_attach (CONFIG_PATH "/data/snapscan.conf", -- &config, check_config_attach); -+ &config, check_config_attach, NULL); - - /* check results */ - assert (status == SANE_STATUS_GOOD); diff --git a/debian/patches/0170-return_empty_list_when_local_devices_requested.patch b/debian/patches/0170-return_empty_list_when_local_devices_requested.patch deleted file mode 100644 index 5d0ba04..0000000 --- a/debian/patches/0170-return_empty_list_when_local_devices_requested.patch +++ /dev/null @@ -1,43 +0,0 @@ -Description: eturn_empty_list_when_local_devices_requested -Author: Barnabás Pőcze <pobrn@protonmail.com> -Origin: backport, https://gitlab.com/sane-project/backends/-/commit/c946aa5a84297f33b30cddb0c89fcf375ed65d10 -Bug: https://gitlab.com/sane-project/backends/-/merge_requests/506 -Forwarded: not-needed -Last-Update: 2020-09-19 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/backend/dell1600n_net.c -=================================================================== ---- trunk.orig/backend/dell1600n_net.c -+++ trunk/backend/dell1600n_net.c -@@ -233,6 +233,9 @@ static void JpegDecompTermSource (j_deco - /* Results of last call to sane_get_devices */ - static struct DeviceRecord *gKnownDevices[MAX_SCANNERS]; - -+/* Empty list for when network devices are not wanted */ -+static const SANE_Device *gEmptyDeviceList[1]; -+ - /* Array of open scanner device states. - :NOTE: (int)SANE_Handle is an offset into this array */ - static struct ScannerState *gOpenScanners[MAX_SCANNERS]; -@@ -306,15 +309,17 @@ sane_get_devices (const SANE_Device *** - const char *pVal; - int valLen; - -+ if (local_only) { -+ *device_list = gEmptyDeviceList; -+ return SANE_STATUS_GOOD; -+ } -+ - /* init variables */ - ret = SANE_STATUS_GOOD; - sock = 0; - pDevice = NULL; - optYes = 1; - -- if (local_only) -- return ret; -- - InitComBuf (&queryPacket); - - /* clear previous results */ diff --git a/debian/patches/0180-gt68xx_fix_use-after-free_two_memleaks.patch b/debian/patches/0180-gt68xx_fix_use-after-free_two_memleaks.patch deleted file mode 100644 index 167a9e5..0000000 --- a/debian/patches/0180-gt68xx_fix_use-after-free_two_memleaks.patch +++ /dev/null @@ -1,55 +0,0 @@ -Description: gt68xx: fix use-after-free and two mem leaks -Author: <name and email of author, optional> -Origin: https://gitlab.com/sane-project/backends/-/commit/63942f7a7473496d1160f02f5c1da3620525690d -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980311 -Forwarded: not-needed -Last-Update: 2021-06-24 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/backend/gt68xx.c -=================================================================== ---- trunk.orig/backend/gt68xx.c -+++ trunk/backend/gt68xx.c -@@ -1174,8 +1174,11 @@ static SANE_Status probe_gt68xx_devices( - new_dev[i]->model->firmware_name); - } - if (i == 0) -- DBG (5, "sane_init: firmware %s can't be loaded, set device " -- "first\n", word); -+ { -+ DBG (5, "sane_init: firmware %s can't be loaded, set device " -+ "first\n", word); -+ free (word); -+ } - } - else - { -@@ -1198,8 +1201,11 @@ static SANE_Status probe_gt68xx_devices( - new_dev[i]->model->name, new_dev[i]->model->vendor); - } - if (i == 0) -- DBG (5, "sane_init: can't set vendor name %s, set device " -- "first\n", word); -+ { -+ DBG (5, "sane_init: can't set vendor name %s, set device " -+ "first\n", word); -+ free (word); -+ } - } - else - { -@@ -1221,9 +1227,11 @@ static SANE_Status probe_gt68xx_devices( - new_dev[i]->model->name, new_dev[i]->model->model); - } - if (i == 0) -- DBG (5, "sane_init: can't set model name %s, set device " -- "first\n", word); -- free (word); -+ { -+ DBG (5, "sane_init: can't set model name %s, set device " -+ "first\n", word); -+ free (word); -+ } - } - else - { diff --git a/debian/patches/0185-Change_output_from_sane-find-scanner.patch b/debian/patches/0185-Change_output_from_sane-find-scanner.patch deleted file mode 100644 index ee4bc1a..0000000 --- a/debian/patches/0185-Change_output_from_sane-find-scanner.patch +++ /dev/null @@ -1,51 +0,0 @@ -Description: Improve output for possible USB scanners -Author: Ralph Little -Origin: upstream, https://gitlab.com/sane-project/backends/-/commit/b701c499c9ce56c6bbea14b2fac2feea37f2410f -Bug: https://gitlab.com/sane-project/backends/-/issues/575 -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983332 -Forwarded: not-needed -Applied-Upstream: commit b701c499c9ce56c6bbea14b2fac2feea37f2410f -Last-Update: 2022-02-21 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/tools/sane-find-scanner.c -=================================================================== ---- trunk.orig/tools/sane-find-scanner.c -+++ trunk/tools/sane-find-scanner.c -@@ -384,7 +384,7 @@ check_usb_file (char *file_name) - { - if (verbose > 1) - printf (" open ok, vendor and product ids were identified\n"); -- printf ("found USB scanner (vendor=0x%04x, " -+ printf ("found possible USB scanner (vendor=0x%04x, " - "product=0x%04x) at %s\n", vendor, product, file_name); - } - else -@@ -392,7 +392,7 @@ check_usb_file (char *file_name) - if (verbose > 1) - printf (" open ok, but vendor and product could NOT be " - "identified\n"); -- printf ("found USB scanner (UNKNOWN vendor and product) " -+ printf ("found possible USB scanner (UNKNOWN vendor and product) " - "at device %s\n", file_name); - unknown_found = SANE_TRUE; - } -@@ -676,7 +676,8 @@ check_libusb_device (struct usb_device * - { - char * chipset = check_usb_chip (dev, verbose, from_file); - -- printf ("found USB scanner (vendor=0x%04x", dev->descriptor.idVendor); -+ printf ("found possible USB scanner (vendor=0x%04x", -+ dev->descriptor.idVendor); - if (vendor) - printf (" [%s]", vendor); - printf (", product=0x%04x", dev->descriptor.idProduct); -@@ -1066,7 +1067,7 @@ check_libusb_device (libusb_device *dev, - if(!from_file) - chipset = check_usb_chip (verbose, desc, hdl, config0); - -- printf ("found USB scanner (vendor=0x%04x", vid); -+ printf ("found possible USB scanner (vendor=0x%04x", vid); - if (vendor) - printf (" [%s]", vendor); - printf (", product=0x%04x", pid); diff --git a/debian/patches/0190-remove-kernel-driver-for-plustek_pp.patch b/debian/patches/0190-remove-kernel-driver-for-plustek_pp.patch deleted file mode 100644 index 45377dc..0000000 --- a/debian/patches/0190-remove-kernel-driver-for-plustek_pp.patch +++ /dev/null @@ -1,2949 +0,0 @@ -Description: Remove kernel driver for plustek_pp - Cherry-Picked from upstream. -Origin: upstream -Bug:https://gitlab.com/sane-project/backends/-/issues/578 -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008275 -Forwarded: not-needed -Last-Update: 2022-03-26 <YYYY-MM-DD, last update of the meta-information, optional> ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/backend/plustek-pp.h -=================================================================== ---- trunk.orig/backend/plustek-pp.h -+++ trunk/backend/plustek-pp.h -@@ -235,11 +235,7 @@ typedef const struct mode_param - #define _E_SEQUENCE (_FIRST_ERR-30) /* caller sequence does not match */ - #define _E_NO_ASIC (_FIRST_ERR-31) /* can't detect ASIC */ - --#ifdef __KERNEL__ --# define _E_FAULT (-EFAULT) --#else - # define _E_FAULT (_E_INTERNAL) /* should never happen in userspace */ --#endif - - #define _E_LAMP_NOT_IN_POS (_FIRST_ERR-40) - #define _E_LAMP_NOT_STABLE (_FIRST_ERR-41) -@@ -471,10 +467,6 @@ typedef struct { - #define _ScanMode_AverageOut 1 /* CCD averaged 2 pixels value for output*/ - #define _ScanMode_Mono 2 /* not color mode */ - -- --#ifndef __KERNEL__ -- -- - #define PLUSTEK_CONFIG_FILE "plustek_pp.conf" - - #ifndef PATH_MAX -@@ -631,7 +623,6 @@ typedef struct { - AdjDef adj; - - } CnfDef, *pCnfDef; --#endif /* guard __KERNEL__ */ - - #endif /* guard __PLUSTEKPP_H__ */ - -Index: trunk/backend/plustek-pp_dbg.h -=================================================================== ---- trunk.orig/backend/plustek-pp_dbg.h -+++ trunk/backend/plustek-pp_dbg.h -@@ -47,22 +47,11 @@ - /* #define _ASIC_98001_SIM */ - - /* -- * the print macros -- */ --#ifdef __KERNEL__ --# define _PRINT printk --#endif -- --/* - * some debug definitions - */ - #ifdef DEBUG --# ifndef __KERNEL__ - # include <assert.h> - # define _ASSERT(x) assert(x) --# else --# define _ASSERT(x) --# endif - - # ifndef DBG - # define DBG(level, msg, args...) if ((dbg_level) & (level)) { \ -Index: trunk/backend/plustek-pp_detect.c -=================================================================== ---- trunk.orig/backend/plustek-pp_detect.c -+++ trunk/backend/plustek-pp_detect.c -@@ -97,11 +97,6 @@ static int detectScannerConnection( pSca - UChar data, control, status; - int retval = _E_NO_CONN; - --#ifdef __KERNEL__ -- DBG( DBG_LOW, "Dataport = 0x%04x\n", ps->IO.pbSppDataPort ); -- DBG( DBG_LOW, "Ctrlport = 0x%04x\n", ps->IO.pbControlPort ); --#endif -- - detectResetPort( ps ); - - /* -@@ -177,11 +172,7 @@ static int detectScannerConnection( pSca - - /* work on the result */ - if ( _OK == retval ) { --#ifdef __KERNEL__ -- ps->sCaps.wIOBase = ps->IO.pbSppDataPort; --#else - ps->sCaps.wIOBase = ps->pardev; --#endif - ps->PutToIdleMode( ps ); - - } else { -@@ -209,11 +200,7 @@ static int detectSetupBuffers( pScanData - */ - if ( 0 == ps->TotalBufferRequire ) { - --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "pt_drv: asic 0x%x probably not supported\n", ps->sCaps.AsicID); - - return _E_ALLOC; /* Out of memory */ -@@ -228,11 +215,7 @@ static int detectSetupBuffers( pScanData - - if ( NULL == ps->driverbuf ) { - --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "pt_drv: Not enough kernel memory %d\n", - ps->TotalBufferRequire); - return _E_ALLOC; /* Out of memory */ -@@ -380,11 +363,7 @@ static int detectAsic98001( pScanData ps - - return detectScannerConnection( ps ); - #else --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "!!!! WARNING, have a look at function detectAsic98001() !!!!\n" ); - ps->sCaps.AsicID = _ASIC_IS_98001; - ps->sCaps.wIOBase = ps->IO.pbSppDataPort; -@@ -434,11 +413,7 @@ _LOC int DetectScanner( pScanData ps, in - - /* read Register 0x18 (AsicID Register) of Asic9800x based devices */ - #ifdef _ASIC_98001_SIM --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "!!!! WARNING, SW-Emulation active !!!!\n" ); - asic = _ASIC_IS_98001; - #else -Index: trunk/backend/plustek-pp_hwdefs.h -=================================================================== ---- trunk.orig/backend/plustek-pp_hwdefs.h -+++ trunk/backend/plustek-pp_hwdefs.h -@@ -586,19 +586,6 @@ typedef struct - * structure to hold IO port specific stuff - */ - typedef struct { -- --#ifdef __KERNEL__ -- pFnOut fnOut; -- pFnIn fnIn; -- -- UShort pbSppDataPort; -- UShort pbEppDataPort; -- -- UShort pbStatusPort; -- UShort pbControlPort; -- UShort pbAddrOffsetPort; --#endif -- - UShort portBase; - UShort portMode; - UShort lastPortMode; -Index: trunk/backend/plustek-pp_image.c -=================================================================== ---- trunk.orig/backend/plustek-pp_image.c -+++ trunk/backend/plustek-pp_image.c -@@ -1288,11 +1288,7 @@ static Bool imageP98003ReadOneImageLine( - - } while( !MiscCheckTimer( &timer )); - --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "Timeout - Scanner malfunction !!\n" ); - MotorToHomePosition(ps); - -Index: trunk/backend/plustek-pp_io.c -=================================================================== ---- trunk.orig/backend/plustek-pp_io.c -+++ trunk/backend/plustek-pp_io.c -@@ -257,21 +257,11 @@ static Bool fnEPPRead( pScanData ps, pUC - - if( _IS_ASIC98(ps->sCaps.AsicID)) { - --#ifndef __KERNEL__ - sanei_pp_set_datadir( ps->pardev, SANEI_PP_DATAIN ); --#else -- _OUTB_CTRL( ps, (_CTRL_GENSIGNAL + _CTRL_DIRECTION)); -- _DO_UDELAY( 1 ); --#endif - for( i = 0; i < ulSize; i++ ) - pBuffer[i] = _INB_EPPDATA( ps ); - --#ifndef __KERNEL__ - sanei_pp_set_datadir( ps->pardev, SANEI_PP_DATAOUT ); --#else -- _OUTB_CTRL( ps, _CTRL_GENSIGNAL ); -- _DO_UDELAY( 1 ); --#endif - } else { - - for( i = 0; i < ulSize; i++ ) -@@ -290,18 +280,12 @@ static Bool fnBiDirRead( pScanData ps, p - start = _CTRL_START_BIDIREAD; - end = _CTRL_END_BIDIREAD; - --#ifndef __KERNEL__ - sanei_pp_set_datadir( ps->pardev, SANEI_PP_DATAIN ); - - if( !sanei_pp_uses_directio()) { - start &= ~_CTRL_DIRECTION; - end &= ~_CTRL_DIRECTION; - } --#else -- if( _IS_ASIC98(ps->sCaps.AsicID)) { -- _OUTB_CTRL( ps, (_CTRL_GENSIGNAL + _CTRL_DIRECTION)); -- } --#endif - - switch( ps->IO.delay ) { - -@@ -341,13 +325,7 @@ static Bool fnBiDirRead( pScanData ps, p - - } - --#ifndef __KERNEL__ - sanei_pp_set_datadir( ps->pardev, SANEI_PP_DATAOUT ); --#else -- if( _IS_ASIC98(ps->sCaps.AsicID)) { -- _OUTB_CTRL( ps, _CTRL_GENSIGNAL ); -- } --#endif - return _TRUE; - } - -@@ -953,45 +931,4 @@ _LOC void IOReadScannerImageData( pScanD - ps->OpenScanPath( ps ); - } - --#ifdef __KERNEL__ -- --/** the wrapper functions to support delayed and non-delayed I/O -- */ --_LOC void IOOut( Byte data, UShort port ) --{ -- DBG( DBG_IOF, "outb(0x%04x, 0x%02x)\n", port, data ); -- outb( data, port ); --} -- --_LOC void IOOutDelayed( Byte data, UShort port ) --{ -- DBG( DBG_IOF, "outb_p(0x%04x, 0x%02x)\n", port, data ); -- outb_p( data, port ); --} -- --_LOC Byte IOIn( UShort port ) --{ --#ifdef DEBUG -- Byte data = inb( port ); -- -- DBG( DBG_IOF, "inb(0x%04x) = 0x%02x\n", port, data ); -- return data; --#else -- return inb( port ); --#endif --} -- --_LOC Byte IOInDelayed( UShort port ) --{ --#ifdef DEBUG -- Byte data = inb_p( port ); -- -- DBG( DBG_IOF, "inb_p(0x%04x) = 0x%02x\n", port, data ); -- return data; --#else -- return inb_p( port ); --#endif --} --#endif /* guard __KERNEL__ */ -- - /* END PLUSTEK-PP_IO.C ......................................................*/ -Index: trunk/backend/plustek-pp_misc.c -=================================================================== ---- trunk.orig/backend/plustek-pp_misc.c -+++ trunk/backend/plustek-pp_misc.c -@@ -77,27 +77,11 @@ - - /*************************** some definitions ********************************/ - --#ifndef __KERNEL__ - # define PPA_PROBE_SPP 0x0001 - # define PPA_PROBE_PS2 0x0002 - # define PPA_PROBE_ECR 0x0010 - # define PPA_PROBE_EPP17 0x0100 - # define PPA_PROBE_EPP19 0x0200 --#else -- --/* the parport driver in Kernel 2.4 has changed. It does report the -- * possible modes in a different, more general way. As long, as -- * we do not use the parport-module change mode facility, I assume -- * the following correlations -- */ --#if defined LINUX_24 || defined LINUX_26 --# define PARPORT_MODE_PCPS2 PARPORT_MODE_TRISTATE --# define PARPORT_MODE_PCEPP PARPORT_MODE_EPP --# define PARPORT_MODE_PCECPPS2 PARPORT_MODE_TRISTATE --# define PARPORT_MODE_PCECPEPP PARPORT_MODE_EPP --# define PARPORT_MODE_PCECR PARPORT_MODE_ECP --#endif --#endif - - #define _PP_A 16807 /**< multiplier */ - #define _PP_M 2147483647L /**< 2**31 - 1 */ -@@ -107,298 +91,10 @@ - static int port_feature = 0; - static long randomnum = 1; - --#ifdef __KERNEL__ --static int portIsClaimed[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 }; -- --MODELSTR; /**< a static char array (see plustek-pp.h) */ -- --#else - static int portIsClaimed[_MAX_PTDEVS] = { 0, 0, 0, 0 }; --#endif - - /*************************** local functions *********************************/ - --#ifdef __KERNEL__ --#ifdef LINUX_26 -- --static pScanData __ps = NULL; --static int __pa = -1; -- --/** callback from parport driver -- */ --static void misc_attach(struct parport *port) --{ -- DBG( DBG_LOW, "misc_attach\n" ); -- -- __ps->pp = NULL; -- if( port->base == (unsigned long)__pa ) { -- DBG( DBG_LOW, "Requested port (0x%02x) found\n", __pa ); -- DBG( DBG_LOW, "Port mode reported: (0x%04x)\n", port->modes ); -- __ps->pp = port; -- } --} -- --static void misc_detach( struct parport *port ) --{ -- DBG( DBG_LOW, "misc_detach\n" ); --} -- --static struct parport_driver pt_drv = { -- .name = "pt_drv", -- .attach = misc_attach, -- .detach = misc_detach, --}; --#endif -- --/** display the available port-modes -- */ --#ifdef DEBUG --static void miscShowPortModes( int modes ) --{ -- DBG( DBG_LOW, "parport-modi:" ); -- -- if( modes & PARPORT_MODE_PCSPP ) -- DBG( DBG_LOW, " SPP" ); -- -- if( modes & PARPORT_MODE_PCPS2 ) -- DBG( DBG_LOW, " PS/2" ); -- -- if( modes & PARPORT_MODE_PCEPP ) -- DBG( DBG_LOW, " EPP" ); -- -- if( modes & PARPORT_MODE_PCECR ) -- DBG( DBG_LOW, " ECP" ); -- -- if( modes & PARPORT_MODE_PCECPEPP ) -- DBG( DBG_LOW, " EPP(ECP)" ); -- -- if( modes & PARPORT_MODE_PCECPPS2 ) -- DBG( DBG_LOW, " PS/2(ECP)" ); -- -- DBG( DBG_LOW, "\n" ); --} --#endif -- --/** probe the parallel port -- */ --static int initPortProbe( pScanData ps ) --{ -- int retv = 0; -- -- /* clear the controls */ -- ps->IO.lastPortMode = 0xFFFF; -- -- if( NULL != ps->pardev ) -- retv = ps->pardev->port->modes; -- return retv; --} -- --/** will be called by the parport module when we already have access, but -- * another module wants access to the port... -- */ --static int miscPreemptionCallback( pVoid data ) --{ -- pScanData ps = (pScanData)data; -- -- if( NULL != ps ) { -- -- /* never release during scanning */ -- if( ps->DataInf.dwScanFlag & _SCANNER_SCANNING ) { -- DBG( DBG_LOW, "no way!!!\n" ); -- return 1; -- } -- } -- -- /* let the port go...*/ -- return 0; --} -- --/** depending on the reported possible port modes, we try to set a faster mode -- * than SPP -- */ --static int miscSetFastMode( pScanData ps ) --{ -- UChar a, b; -- -- /* -- * when previously found the EPP mode, break right here -- */ -- if (( _PORT_EPP == ps->IO.portMode ) && (!(port_feature & PARPORT_MODE_PCECR))) -- return _OK; -- -- /* CHECK REMOVE: from here we should have SPP (Paranoia Code !) */ -- if (( _PORT_SPP != ps->IO.portMode ) && (!(port_feature & PARPORT_MODE_PCECR))) -- return _OK; -- -- DBG(DBG_LOW, "Trying faster mode...\n" ); -- -- /* -- * ECP mode usually has sub-modes of EPP and/or PS2. -- * First we try to set EPP -- */ -- if((port_feature & PARPORT_MODE_PCECR) && -- (port_feature & PARPORT_MODE_PCECPEPP)){ -- -- DBG(DBG_LOW, "Attempting to set EPP from ECP mode.\n" ); -- -- a = _INB_ECTL(ps); /* get current ECR */ -- ps->IO.lastPortMode = a; /* save it for restoring later */ -- a = (a & 0x1F) | 0x80; /* set to EPP */ -- _OUTB_ECTL(ps, a); /* write it back */ -- _DO_UDELAY(1); -- -- /* -- * It is probably unnecessary to -- * do this check but it makes me feel better -- */ -- b = _INB_ECTL(ps); /* check to see if port set */ -- if( a == b ) { -- DBG( DBG_LOW, "Port is set to (ECP) EPP mode.\n" ); -- ps->IO.portMode = _PORT_EPP; -- return _OK; -- -- } else { -- DBG( DBG_LOW, "Port could not be set to (ECP) EPP mode. " -- "Using SPP mode.\n" ); -- _OUTB_ECTL(ps,(Byte)ps->IO.lastPortMode); /* restore */ -- _DO_UDELAY(1); -- ps->IO.portMode = _PORT_SPP; -- -- /* go ahead and try with other settings...*/ -- } -- } -- -- /* If port cannot be set to EPP, try PS2 */ -- if((port_feature & PARPORT_MODE_PCECR) && -- (port_feature & PARPORT_MODE_PCECPPS2)) { -- -- DBG(DBG_LOW, "Attempting to set PS2 from ECPPS2 mode.\n" ); -- -- a = _INB_ECTL(ps); /* get current ECR */ -- ps->IO.lastPortMode = a; /* save it for restoring later */ -- -- /* set to Fast Centronics/bi-directional/PS2 */ -- a = (a & 0x1F) | 0x20; -- _OUTB_ECTL(ps,a); /* write it back */ -- _DO_UDELAY(1); -- -- /* -- * It is probably unnecessary to do this check -- * but it makes me feel better -- */ -- b = _INB_ECTL(ps); /* check to see if port set */ -- if (a == b) { -- DBG(DBG_LOW, "Port is set to (ECP) PS2 bidirectional mode.\n"); -- ps->IO.portMode = _PORT_BIDI; -- return _OK; -- } else { -- DBG(DBG_LOW, "Port could not be set to (ECP) PS2 mode. " -- "Using SPP mode.\n"); -- a = ps->IO.lastPortMode & 0x1F; -- _OUTB_ECTL(ps, a); /* set ECP ctrl to SPP */ -- _DO_UDELAY(1); -- ps->IO.portMode = _PORT_SPP; -- -- /* next mode, last attempt... */ -- } -- } -- -- /* -- * Some BIOS/cards have only a Bi-directional/PS2 mode (no EPP). -- * Make one last attempt to set to PS2 mode. -- */ -- if ( port_feature & PARPORT_MODE_PCPS2 ){ -- -- DBG(DBG_LOW, "Attempting to set PS2 mode.\n" ); -- -- a = _INB_CTRL(ps); /* get current setting of control register*/ -- ps->IO.lastPortMode = a; /* save it for restoring later */ -- a = a | 0x20; /* set bit 5 of control reg */ -- _OUTB_CTRL(ps,a); /* set to Fast Centronics/bi-directional/PS2 */ -- _DO_UDELAY(1); -- a = 0; -- -- _OUTB_DATA(ps,0x55); -- _DO_UDELAY(1); -- if ((inb(ps->IO.portBase)) != 0x55) /* read data */ -- a++; -- -- _OUTB_DATA(ps,0xAA); -- _DO_UDELAY(1); -- -- if (_INB_DATA(ps) != 0xAA) /* read data */ -- a++; -- -- if( 2 == a ) { -- DBG(DBG_LOW, "Port is set to PS2 bidirectional mode.\n"); -- ps->IO.portMode = _PORT_BIDI; -- return _OK; -- -- } else { -- DBG(DBG_LOW, "Port could not be set to PS2 mode. " -- "Using SPP mode.\n"); -- _OUTB_CTRL(ps,(Byte)ps->IO.lastPortMode); /* restore */ -- _DO_UDELAY(1); -- ps->IO.portMode = _PORT_SPP; -- } -- } -- -- /* reaching this point, we're back in SPP mode and there's no need -- * to restore at shutdown... -- */ -- ps->IO.lastPortMode = 0xFFFF; -- -- return _OK; --} -- --/** check the state of the par-port and switch to EPP-mode if possible -- */ --static int miscSetPortMode( pScanData ps ) --{ -- /* try to detect the port settings, SPP seems to work in any case ! */ -- port_feature = initPortProbe( ps ); -- --#ifdef DEBUG -- miscShowPortModes( port_feature ); --#endif -- -- switch( ps->IO.forceMode ) { -- -- case 1: -- DBG( DBG_LOW, "Use of SPP-mode enforced\n" ); -- ps->IO.portMode = _PORT_SPP; -- return _OK; -- break; -- -- case 2: -- DBG( DBG_LOW, "Use of EPP-mode enforced\n" ); -- ps->IO.portMode = _PORT_EPP; -- return _OK; -- break; -- -- default: -- break; -- } -- -- if( !(port_feature & PARPORT_MODE_PCEPP)) { -- -- if( !(port_feature & PARPORT_MODE_PCSPP )) { -- _PRINT("\nThis Port supports not the SPP- or EPP-Mode\n" ); -- _PRINT("Please activate SPP-Mode, EPP-Mode or\nEPP + ECP-Mode!\n"); -- return _E_NOSUPP; -- } else { -- DBG(DBG_LOW, "Using SPP-mode\n" ); -- ps->IO.portMode = _PORT_SPP; -- } -- } else { -- DBG(DBG_LOW, "Using EPP-mode\n" ); -- ps->IO.portMode = _PORT_EPP; -- } -- -- /* else try to set to a faster mode than SPP */ -- return miscSetFastMode( ps ); --} --#endif - - /** miscNextLongRand() -- generate 2**31-2 random numbers - ** -@@ -488,34 +184,6 @@ _LOC int MiscReinitStruct( pScanData ps - */ - _LOC int MiscInitPorts( pScanData ps, int port ) - { --#ifdef __KERNEL__ -- int status; -- -- if( NULL == ps ) -- return _E_NULLPTR; -- -- /* -- * Get access to the ports -- */ -- ps->IO.portBase = (UShort)port; -- -- status = miscSetPortMode(ps); -- -- if( _OK != status ) { -- ps->sCaps.wIOBase = _NO_BASE; -- ps->IO.portBase = _NO_BASE; -- return status; -- } -- -- /* -- * the port settings -- */ -- ps->IO.pbSppDataPort = (UShort)port; -- ps->IO.pbStatusPort = (UShort)port+1; -- ps->IO.pbControlPort = (UShort)port+2; -- ps->IO.pbEppDataPort = (UShort)port+4; -- --#else - int mode, mts; - - if( NULL == ps ) -@@ -560,7 +228,6 @@ _LOC int MiscInitPorts( pScanData ps, in - - sanei_pp_setmode( ps->pardev, mts ); - _VAR_NOT_USED( port ); --#endif - return _OK; - } - -@@ -568,11 +235,6 @@ _LOC int MiscInitPorts( pScanData ps, in - */ - _LOC void MiscRestorePort( pScanData ps ) - { --#ifdef __KERNEL__ -- if( 0 == ps->IO.pbSppDataPort ) -- return; --#endif -- - DBG(DBG_LOW,"MiscRestorePort()\n"); - - /* don't restore if not necessary */ -@@ -582,19 +244,9 @@ _LOC void MiscRestorePort( pScanData ps - } - - /*Restore Port-Mode*/ --#ifdef __KERNEL__ -- if( port_feature & PARPORT_MODE_PCECR ){ -- _OUTB_ECTL( ps, (Byte)ps->IO.lastPortMode ); -- _DO_UDELAY(1); -- } else { -- _OUTB_CTRL( ps, (Byte)ps->IO.lastPortMode ); -- _DO_UDELAY(1); -- } --#else - if( port_feature & PPA_PROBE_ECR ){ - _OUTB_ECTL(ps,ps->IO.lastPortMode); - } --#endif - } - - /** Initializes a timer. -@@ -605,11 +257,7 @@ _LOC void MiscStartTimer( TimerDef *time - { - struct timeval start_time; - --#ifdef __KERNEL__ -- _GET_TIME( &start_time ); --#else - gettimeofday(&start_time, NULL); --#endif - - *timer = (TimerDef)start_time.tv_sec * 1000000 + (TimerDef)start_time.tv_usec + us; - } -@@ -624,21 +272,14 @@ _LOC int MiscCheckTimer( TimerDef *timer - { - struct timeval current_time; - --#ifdef __KERNEL__ -- _GET_TIME( ¤t_time ); --#else - gettimeofday(¤t_time, NULL); --#endif - - if ((TimerDef)current_time.tv_sec * 1000000 + (TimerDef)current_time.tv_usec > *timer) { - return _E_TIMEOUT; - } else { --#ifdef __KERNEL__ -- schedule(); - /*#else - sched_yield(); - */ --#endif - return _OK; - } - } -@@ -673,65 +314,8 @@ _LOC Bool MiscAllPointersSet( pScanData - */ - _LOC int MiscRegisterPort( pScanData ps, int portAddr ) - { --#ifndef __KERNEL__ - DBG( DBG_LOW, "Assigning port handle %i\n", portAddr ); - ps->pardev = portAddr; --#else -- --#ifdef LINUX_26 -- __ps = ps; -- __pa = portAddr; -- -- DBG( DBG_LOW, "Requested port at 0x%02x\n", portAddr ); -- -- if( parport_register_driver(&pt_drv)) { -- /* Failed; nothing we can do. */ -- return _E_REGISTER; -- } -- --#else -- struct parport *pp = NULL; -- -- DBG( DBG_LOW, "Requested port at 0x%02x\n", portAddr ); -- -- pp = parport_enumerate(); -- ps->pardev = NULL; -- -- if( NULL == pp ) { -- return _E_PORTSEARCH; -- } -- -- /* go through the list -- */ -- for( ps->pp = NULL; NULL != pp; ) { -- -- if( pp->base == (unsigned long)portAddr ) { -- DBG( DBG_LOW, "Requested port (0x%02x) found\n", portAddr ); -- DBG( DBG_LOW, "Port mode reported: (0x%04x)\n", pp->modes ); -- ps->pp = pp; -- break; -- } -- pp = pp->next; -- } --#endif -- -- if( NULL == ps->pp ) { -- printk("PORT not found!!!\n"); -- return _E_NO_PORT; -- } -- -- /* -- * register this device -- */ -- ps->pardev = parport_register_device( ps->pp, "Plustek Driver", -- miscPreemptionCallback, NULL, NULL, 0, (pVoid)ps ); -- -- if( NULL == ps->pardev ) { -- return _E_REGISTER; -- } -- -- DBG( DBG_LOW, "Port for device %u registered\n", ps->devno ); --#endif - - portIsClaimed[ps->devno] = 0; - return _OK; -@@ -741,17 +325,7 @@ _LOC int MiscRegisterPort( pScanData ps, - */ - _LOC void MiscUnregisterPort( pScanData ps ) - { --#ifdef __KERNEL__ -- if( NULL != ps->pardev ) { -- DBG( DBG_LOW, "Port unregistered\n" ); -- parport_unregister_device( ps->pardev ); -- } --#ifdef LINUX_26 -- parport_unregister_driver( &pt_drv ); --#endif --#else - sanei_pp_close( ps->pardev ); --#endif - } - - /** Try to claim the port -@@ -763,11 +337,7 @@ _LOC int MiscClaimPort( pScanData ps ) - if( 0 == portIsClaimed[ps->devno] ) { - - DBG( DBG_HIGH, "Try to claim the parport\n" ); --#ifdef __KERNEL__ -- if( 0 != parport_claim( ps->pardev )) { --#else - if( SANE_STATUS_GOOD != sanei_pp_claim( ps->pardev )) { --#endif - return _E_BUSY; - } - } -@@ -785,11 +355,7 @@ _LOC void MiscReleasePort( pScanData ps - - if( 0 == portIsClaimed[ps->devno] ) { - DBG( DBG_HIGH, "Releasing parport\n" ); --#ifdef __KERNEL__ -- parport_release( ps->pardev ); --#else - sanei_pp_release( ps->pardev ); --#endif - } - } - } -Index: trunk/backend/plustek-pp_procs.h -=================================================================== ---- trunk.orig/backend/plustek-pp_procs.h -+++ trunk/backend/plustek-pp_procs.h -@@ -219,13 +219,6 @@ _LOC void IORegisterDirectToScanner( pSc - _LOC void IOSoftwareReset ( pScanData ps ); - _LOC void IOReadScannerImageData ( pScanData ps, pUChar pBuf, ULong size ); - --#ifdef __KERNEL__ --_LOC void IOOut ( Byte data, UShort port ); --_LOC void IOOutDelayed( Byte data, UShort port ); --_LOC Byte IOIn ( UShort port ); --_LOC Byte IOInDelayed ( UShort port ); --#endif -- - /* - * implementation in plustek-pp_tpa.c - */ -@@ -238,16 +231,6 @@ _LOC void TPAP98003Reshading ( p - */ - _LOC void ScaleX( pScanData ps, pUChar inBuf, pUChar outBuf ); - --/* -- * implementation in plustek-pp_procfs.c (Kernel-mode only) -- */ --#ifdef __KERNEL__ --int ProcFsInitialize ( void ); --void ProcFsShutdown ( void ); --void ProcFsRegisterDevice ( pScanData ps ); --void ProcFsUnregisterDevice( pScanData ps ); --#endif -- - #endif /* guard __PROCS_H__ */ - - /* END PLUSTEK-PP_PROCS.H ...................................................*/ -Index: trunk/backend/plustek-pp_ptdrv.c -=================================================================== ---- trunk.orig/backend/plustek-pp_ptdrv.c -+++ trunk/backend/plustek-pp_ptdrv.c -@@ -94,52 +94,13 @@ - * If you do not wish that, delete this exception notice. - * <hr> - */ --#ifdef __KERNEL__ --# include <linux/module.h> --# include <linux/version.h> -- --# ifdef CONFIG_DEVFS_FS --# include <linux/devfs_fs_kernel.h> --# if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,69)) --# define DEVFS_26_STYLE --# endif --# endif --#endif -- - #include "plustek-pp_scan.h" - --#ifdef __KERNEL__ --# include <linux/param.h> --#endif -- - /****************************** static vars **********************************/ - - /* default port is at 0x378 */ - static int port[_MAX_PTDEVS] = { 0x378, 0, 0, 0 }; - --#ifdef __KERNEL__ --static pScanData PtDrvDevices[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = NULL}; -- --/* default is 180 secs for lamp switch off */ --static int lampoff[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 180 }; -- --/* warmup period for lamp (30 secs) */ --static int warmup[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 30 }; -- --/* switch lamp off on unload (default = no)*/ --static int lOffonEnd[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 }; -- --/* model override (0-->none) */ --static UShort mov[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 }; -- --/* forceMode (0--> auto, 1: SPP, 2:EPP, others: auto) */ --static UShort forceMode[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 }; -- --/* to use delayed I/O for each device */ --static Bool slowIO[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = _FALSE }; -- --#else -- - static pScanData PtDrvDevices[_MAX_PTDEVS]= { NULL, NULL, NULL, NULL }; - static int lampoff[_MAX_PTDEVS] = { 180, 180, 180, 180 }; - static int warmup[_MAX_PTDEVS] = { 30, 30, 30, 30 }; -@@ -147,140 +108,14 @@ static int lOffonEnd[_MAX_PTDEVS] - static UShort mov[_MAX_PTDEVS] = { 0, 0, 0, 0 }; - static UShort forceMode[_MAX_PTDEVS] = { 0, 0, 0, 0 }; - --#endif -- - /* timers for warmup checks */ - static TimerDef toTimer[_MAX_PTDEVS]; - --#ifndef __KERNEL__ - static Bool PtDrvInitialized = _FALSE; - #ifdef HAVE_SETITIMER - static struct itimerval saveSettings; - #endif --#else --static Bool deviceScanning = _FALSE; -- --static struct timer_list tl[_MAX_PTDEVS]; -- --/* for calculation of the timer expiration */ --extern volatile unsigned long jiffies; -- --/* the parameter interface -- */ --#if ((LINUX_VERSION_CODE > 0x020111) && defined(MODULE)) --MODULE_AUTHOR("Gerhard Jaeger <gerhard@gjaeger.de>"); --MODULE_DESCRIPTION("Plustek parallelport-scanner driver"); -- --/* addresses this 'new' license feature... */ --#ifdef MODULE_LICENSE --MODULE_LICENSE("GPL"); --#endif -- --#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)) --MODULE_PARM(port, "1-" __MODULE_STRING(_MAX_PTDEVS) "i"); --MODULE_PARM(lampoff, "1-" __MODULE_STRING(_MAX_PTDEVS) "i"); --MODULE_PARM(warmup,"1-" __MODULE_STRING(_MAX_PTDEVS) "i"); --MODULE_PARM(lOffonEnd, "1-" __MODULE_STRING(_MAX_PTDEVS) "i"); --MODULE_PARM(mov, "1-" __MODULE_STRING(_MAX_PTDEVS) "i"); --MODULE_PARM(slowIO,"1-" __MODULE_STRING(_MAX_PTDEVS) "i"); --MODULE_PARM(forceMode,"1-" __MODULE_STRING(_MAX_PTDEVS) "i"); -- --#else -- --static int array_len = _MAX_PTDEVS; -- --module_param_array(port, int, &array_len, 0); --module_param_array(lampoff, int, &array_len, 0); --module_param_array(warmup, int, &array_len, 0); --module_param_array(lOffonEnd, int, &array_len, 0); --module_param_array(mov, ushort, &array_len, 0); --module_param_array(slowIO, int, &array_len, 0); --module_param_array(forceMode, ushort, &array_len, 0); -- --#endif -- -- --MODULE_PARM_DESC(port, "I/O base address of parport"); --MODULE_PARM_DESC(lampoff, "Lamp-Off timer preset in seconds"); --MODULE_PARM_DESC(warmup, "Minimum warmup time in seconds"); --MODULE_PARM_DESC(lOffonEnd, "1 - switchoff lamp on unload"); --MODULE_PARM_DESC(mov, "Modell-override switch"); --MODULE_PARM_DESC(slowIO, "0 = Fast I/O, 1 = Delayed I/O"); --MODULE_PARM_DESC(forceMode, "0 = use auto detection, " -- "1 = use SPP mode, 2 = use EPP mode"); --#endif -- --#if defined (CONFIG_DEVFS_FS) --# ifndef (DEVFS_26_STYLE) -- static devfs_handle_t devfs_handle = NULL; --# endif --#else --# ifdef LINUX_26 -- static class_t *ptdrv_class; --# endif --#endif -- --/* -- * the module interface -- */ --static int pt_drv_open ( struct inode *, struct file *); --static CLOSETYPE pt_drv_close( struct inode *, struct file *); -- --#ifdef LINUX_20 -- static int pt_drv_read( struct inode*, struct file*, char*, int ); -- static int pt_drv_write( struct inode*, struct file*, const char*, int ); --#else -- static ssize_t pt_drv_read ( struct file *file, -- char *buffer, size_t count, loff_t *); -- static ssize_t pt_drv_write( struct file *file, -- const char *buffer, size_t tmp,loff_t *count); --#endif -- --#ifdef NOLOCK_IOCTL -- static long pt_drv_ioctl( struct file *, UInt, unsigned long ); --#else -- static int pt_drv_ioctl( struct inode *, struct file *, UInt, unsigned long ); --#endif -- -- --/* -- * the driver interface -- */ --#ifdef LINUX_20 -- --static struct file_operations pt_drv_fops = --{ -- NULL, /* seek */ -- pt_drv_read, /* read */ -- pt_drv_write, /* write */ -- NULL, /* readdir */ -- NULL, /* select */ -- pt_drv_ioctl, /* ioctl */ -- NULL, /* mmap */ -- pt_drv_open, /* open */ -- pt_drv_close, /* release */ -- NULL, /* fsync */ -- NULL, /* fasync */ -- NULL, /* check_media_change */ -- NULL /* revalidate */ --}; -- --#else /* 2.2.x and higher stuff */ -- --static struct file_operations pt_drv_fops = { --#ifdef LINUX_24 -- owner: THIS_MODULE, --#endif -- read: pt_drv_read, -- write: pt_drv_write, -- IOCTL: pt_drv_ioctl, -- open: pt_drv_open, -- release: pt_drv_close, --}; - --#endif -- --#endif /* guard __KERNEL */ - - /****************************** some prototypes ******************************/ - -@@ -288,23 +123,6 @@ static void ptdrvStartLampTimer( pScanDa - - /****************************** local functions ******************************/ - --#ifdef __KERNEL__ --/** depending on the device, return the data structure -- */ --static pScanData get_pt_from_inode(struct inode *ip) --{ -- int minor = _MINOR(ip); -- -- /* -- * unit out of range -- */ -- if (minor >= _MAX_PTDEVS ) -- return NULL; -- -- return( PtDrvDevices[minor] ); --} --#endif -- - /** copy user-space data into kernel memory - */ - static int getUserPtr(const pVoid useraddr, pVoid where, UInt size ) -@@ -315,32 +133,9 @@ static int getUserPtr(const pVoid userad - if((NULL == useraddr) || ( 0 == size)) - return _E_INVALID; - --#ifdef __KERNEL__ -- if ((err = verify_area_20(VERIFY_READ, useraddr, size))) -- return err; --#endif -- - switch (size) { --#ifdef __KERNEL__ -- case sizeof(u_char): -- GET_USER_RET(*(u_char *)where, (u_char *) useraddr, -EFAULT); -- break; -- -- case sizeof(u_short): -- GET_USER_RET(*(u_short *)where, (u_short *) useraddr, -EFAULT); -- break; -- -- case sizeof(u_long): -- GET_USER_RET(*(u_long *)where, (u_long *) useraddr, -EFAULT); -- break; -- -- default: -- if (copy_from_user(where, useraddr, size)) -- return -EFAULT; --#else - default: - memcpy( where, useraddr, size ); --#endif - } - return err; - } -@@ -354,20 +149,11 @@ static int putUserPtr( const pVoid ptr, - if (NULL == useraddr) - return _E_INVALID; - --#ifdef __KERNEL__ -- if ((err = verify_area_20(VERIFY_WRITE, useraddr, size))) -- return err; -- -- if (copy_to_user(useraddr, ptr, size )) -- return -EFAULT; --#else - memcpy( useraddr, ptr, size ); --#endif - - return err; - } - --#ifndef __KERNEL__ - static unsigned long copy_from_user( pVoid dest, pVoid src, unsigned long len ) - { - memcpy( dest, src, len ); -@@ -379,37 +165,16 @@ static unsigned long copy_to_user( pVoid - memcpy( dest, src, len ); - return 0; - } --#endif - - /** - */ - static int putUserVal(const ULong value, pVoid useraddr, UInt size) - { --#ifdef __KERNEL__ -- int err; --#endif -- - if (NULL == useraddr) - return _E_INVALID; - --#ifdef __KERNEL__ -- if ((err = verify_area_20(VERIFY_WRITE, useraddr, size))) -- return err; --#endif -- - switch (size) { - --#ifdef __KERNEL__ -- case sizeof(u_char): -- PUT_USER_RET((u_char)value, (u_char *) useraddr, -EFAULT); -- break; -- case sizeof(u_short): -- PUT_USER_RET((u_short)value, (u_short *) useraddr, -EFAULT); -- break; -- case sizeof(u_long): -- PUT_USER_RET((u_long)value, (u_long *) useraddr, -EFAULT); -- break; --#else - case sizeof(UChar): - *(pUChar)useraddr = (UChar)value; - break; -@@ -420,7 +185,6 @@ static int putUserVal(const ULong value, - *(pULong)useraddr = (ULong)value; - break; - --#endif - default: - return _E_INVALID; - } -@@ -506,22 +270,14 @@ static void ptdrvLampWarmup( pScanData p - - /** - */ --#ifdef __KERNEL__ --static void ptdrvLampTimerIrq( unsigned long ptr ) --#else - static void ptdrvLampTimerIrq( int sig_num ) --#endif - { - pScanData ps; - - DBG( DBG_HIGH, "!! IRQ !! Lamp-Timer stopped.\n" ); - --#ifdef __KERNEL__ -- ps = (pScanData)ptr; --#else - _VAR_NOT_USED( sig_num ); - ps = PtDrvDevices[0]; --#endif - - /* - * paranoia check! -@@ -559,7 +315,6 @@ static void ptdrvLampTimerIrq( int sig_n - */ - static void ptdrvStartLampTimer( pScanData ps ) - { --#ifndef __KERNEL__ - sigset_t block, pause_mask; - struct sigaction s; - #ifdef HAVE_SETITIMER -@@ -597,17 +352,6 @@ static void ptdrvStartLampTimer( pScanDa - #else - alarm( ps->lampoff ); - #endif --#else -- init_timer( &tl[ps->devno] ); -- -- /* timeout val in seconds */ -- tl[ps->devno].expires = jiffies + ps->lampoff * HZ; -- tl[ps->devno].data = (unsigned long)ps; -- tl[ps->devno].function = ptdrvLampTimerIrq; -- -- if( 0 != ps->lampoff ) -- add_timer( &tl[ps->devno] ); --#endif - - DBG( DBG_HIGH, "Lamp-Timer started!\n" ); - } -@@ -616,7 +360,6 @@ static void ptdrvStartLampTimer( pScanDa - */ - static void ptdrvStopLampTimer( pScanData ps ) - { --#ifndef __KERNEL__ - sigset_t block, pause_mask; - - /* block SIGALRM */ -@@ -630,10 +373,6 @@ static void ptdrvStopLampTimer( pScanDat - _VAR_NOT_USED( ps ); - alarm(0); - #endif --#else -- if( 0 != ps->lampoff ) -- del_timer( &tl[ps->devno] ); --#endif - - DBG( DBG_HIGH, "Lamp-Timer stopped!\n" ); - } -@@ -701,23 +440,11 @@ static int ptdrvOpenDevice( pScanData ps - UShort lastMode; - ULong devno; - --#ifdef __KERNEL__ -- UShort flags; -- struct pardevice *pd; -- struct parport *pp; -- ProcDirDef procDir; --#else - int pd; --#endif - - /* - * push some values from the struct - */ --#ifdef __KERNEL__ -- flags = ps->flags; -- pp = ps->pp; -- procDir = ps->procDir; --#endif - pd = ps->pardev; - iobase = ps->sCaps.wIOBase; - asic = ps->sCaps.AsicID; -@@ -734,29 +461,10 @@ static int ptdrvOpenDevice( pScanData ps - /* - * pop the val(s) - */ --#ifdef __KERNEL__ -- ps->flags = flags; -- ps->pp = pp; -- ps->procDir = procDir; --#endif - ps->pardev = pd; - ps->bLastLampStatus = lastStat; - ps->IO.lastPortMode = lastMode; - ps->devno = devno; -- --#ifdef __KERNEL__ -- if( _TRUE == slowIO[devno] ) { -- DBG( DBG_LOW, "Using slow I/O\n" ); -- ps->IO.slowIO = _TRUE; -- ps->IO.fnOut = IOOutDelayed; -- ps->IO.fnIn = IOInDelayed; -- } else { -- DBG( DBG_LOW, "Using fast I/O\n" ); -- ps->IO.slowIO = _FALSE; -- ps->IO.fnOut = IOOut; -- ps->IO.fnIn = IOIn; -- } --#endif - ps->ModelOverride = mov[devno]; - ps->warmup = warmup[devno]; - ps->lampoff = lampoff[devno]; -@@ -798,19 +506,6 @@ static int ptdrvInit( int devno ) - return _E_ALLOC; - } - --#ifdef __KERNEL__ -- if( _TRUE == slowIO[devno] ) { -- DBG( DBG_LOW, "Using slow I/O\n" ); -- ps->IO.slowIO = _TRUE; -- ps->IO.fnOut = IOOutDelayed; -- ps->IO.fnIn = IOInDelayed; -- } else { -- DBG( DBG_LOW, "Using fast I/O\n" ); -- ps->IO.slowIO = _FALSE; -- ps->IO.fnOut = IOOut; -- ps->IO.fnIn = IOIn; -- } --#endif - ps->ModelOverride = mov[devno]; - ps->warmup = warmup[devno]; - ps->lampoff = lampoff[devno]; -@@ -845,13 +540,8 @@ static int ptdrvInit( int devno ) - - if( _OK == retval ) { - --#ifdef __KERNEL__ -- _PRINT( "pt_drv%u: %s found on port 0x%04x\n", -- devno, MiscGetModelName(ps->sCaps.Model), ps->IO.pbSppDataPort ); --#else - DBG( DBG_LOW, "pt_drv%u: %s found\n", - devno, MiscGetModelName(ps->sCaps.Model)); --#endif - - /* - * initialize the timespan timer -@@ -859,43 +549,23 @@ static int ptdrvInit( int devno ) - MiscStartTimer( &toTimer[ps->devno], (_SECOND * ps->warmup)); - - if( 0 == ps->lampoff ) --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_LOW, --#endif - "pt_drv%u: Lamp-Timer switched off.\n", devno ); - else { --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_LOW, --#endif - "pt_drv%u: Lamp-Timer set to %u seconds.\n", - devno, ps->lampoff ); - } - --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_LOW, --#endif - "pt_drv%u: WarmUp period set to %u seconds.\n", - devno, ps->warmup ); - - if( 0 == ps->lOffonEnd ) { --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_LOW, --#endif - "pt_drv%u: Lamp untouched on driver unload.\n", devno ); - } else { --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_LOW, --#endif - "pt_drv%u: Lamp switch-off on driver unload.\n", devno ); - } - -@@ -1287,31 +957,19 @@ static int ptdrvRead( pScanData ps, pUCh - int retval = _OK; - - #ifdef _ASIC_98001_SIM --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_LOW, --#endif - "pt_drv : Software-Emulation active, can't read!\n" ); - return _E_INVALID; - #endif - - if((NULL == buffer) || (NULL == ps)) { --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "pt_drv : Internal NULL-pointer!\n" ); - return _E_NULLPTR; - } - - if( 0 == count ) { --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "pt_drv%u: reading 0 bytes makes no sense!\n", ps->devno ); - return _E_INVALID; - } -@@ -1325,11 +983,7 @@ static int ptdrvRead( pScanData ps, pUCh - * when using the cat /dev/pt_drv command! - */ - if (!(ps->DataInf.dwVxdFlag & _VF_ENVIRONMENT_READY)) { --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "pt_drv%u: Cannot read, driver not initialized!\n",ps->devno); - return _E_SEQUENCE; - } -@@ -1340,11 +994,7 @@ static int ptdrvRead( pScanData ps, pUCh - ps->Scan.bp.pMonoBuf = _KALLOC( ps->DataInf.dwAppPhyBytesPerLine, GFP_KERNEL); - - if ( NULL == ps->Scan.bp.pMonoBuf ) { --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "pt_drv%u: Not enough memory available!\n", ps->devno ); - return _E_ALLOC; - } -@@ -1355,11 +1005,7 @@ static int ptdrvRead( pScanData ps, pUCh - scaleBuf = _KALLOC( ps->DataInf.dwAppPhyBytesPerLine, GFP_KERNEL); - if ( NULL == scaleBuf ) { - _KFREE( ps->Scan.bp.pMonoBuf ); --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "pt_drv%u: Not enough memory available!\n", ps->devno ); - return _E_ALLOC; - } -@@ -1406,11 +1052,7 @@ static int ptdrvRead( pScanData ps, pUCh - - retval = ps->Calibration( ps ); - if( _OK != retval ) { --#ifdef __KERNEL__ -- _PRINT( --#else - DBG( DBG_HIGH, --#endif - "pt_drv%u: calibration failed, result = %i\n", - ps->devno, retval ); - goto ReadFinished; -@@ -1507,12 +1149,9 @@ static int ptdrvRead( pScanData ps, pUCh - ps->Scan.dwLinesToRead--; - - /* needed, esp. to avoid freezing the system in SPP mode */ --#ifdef __KERNEL__ -- schedule(); - /*#else - sched_yield(); - */ --#endif - } - - if (ps->fScanningStatus) { -@@ -1565,346 +1204,6 @@ ReadFinished: - return retval; - } - --/*************************** the module interface ****************************/ -- --#ifdef __KERNEL__ /* the kernel module interface */ -- --/* Designed to be used as a module */ --#ifdef MODULE -- --/*............................................................................. -- * gets called upon module initialization -- */ --#ifdef LINUX_26 --static int __init ptdrv_init( void ) --#else --int init_module( void ) --#endif --{ -- UInt devCount; -- UInt i; -- int retval = _OK; -- int result = _OK; --#if (defined(CONFIG_DEVFS_FS) && !defined(DEVFS_26_STYLE)) -- char controlname[24]; --#endif --# ifdef LINUX_26 -- char devname[20]; --#endif -- -- DBG( DBG_HIGH, "*********************************************\n" ); -- DBG( DBG_HIGH, "pt_drv: init_module()\n" ); -- --#if (defined(CONFIG_DEVFS_FS) && !defined(DEVFS_26_STYLE)) -- devfs_handle = devfs_mk_dir(NULL, "scanner", NULL); -- if( devfs_register_chrdev(_PTDRV_MAJOR, _DRV_NAME, &pt_drv_fops)) { --#else -- if( register_chrdev(_PTDRV_MAJOR, _DRV_NAME, &pt_drv_fops)) { --#endif -- -- _PRINT(KERN_INFO "pt_drv: unable to get major %d for pt_drv devices\n", -- _PTDRV_MAJOR); -- return -EIO; -- } -- printk( KERN_INFO "pt_drv : driver version "_PTDRV_VERSTR"\n" ); -- --#if !defined (CONFIG_DEVFS_FS) && defined (LINUX_26) -- ptdrv_class = class_create(THIS_MODULE, "scanner"); -- if (IS_ERR(ptdrv_class)) -- goto out_devfs; --#endif -- -- /* register the proc_fs */ -- ProcFsInitialize(); -- -- /* go through the list of defined ports and try to find a device -- */ -- devCount = 0; -- for( i = 0; i < _MAX_PTDEVS; i++ ) { -- -- if( 0 != port[i] ) { -- result = ptdrvInit( i ); -- -- if ( _OK == result ) { -- PtDrvDevices[i]->flags |= _PTDRV_INITALIZED; -- --#ifdef CONFIG_DEVFS_FS --# ifndef DEVFS_26_STYLE -- sprintf( controlname, "scanner/pt_drv%d", devCount ); -- devfs_register( NULL, controlname, -- DEVFS_FL_DEFAULT, _PTDRV_MAJOR, 0, -- (S_IFCHR | S_IRUGO | S_IWUGO | S_IFCHR), -- &pt_drv_fops, NULL ); --# else /* DEVFS_26_STYLE */ -- devfs_mk_cdev(MKDEV(_PTDRV_MAJOR, devCount), -- (S_IFCHR | S_IRUGO | S_IWUGO | S_IFCHR), -- "scanner/pt_drv%d", devCount); --# endif --#else --# ifdef LINUX_26 -- sprintf(devname, "pt_drv%d", devCount); -- CLASS_DEV_CREATE(ptdrv_class, -- MKDEV(_PTDRV_MAJOR, devCount), NULL, -- devname); -- --# endif /* LINUX_26 */ --#endif /* CONFIG_DEVFS_FS */ -- ProcFsRegisterDevice( PtDrvDevices[i] ); -- devCount++; -- } else { -- retval = result; -- ptdrvShutdown( PtDrvDevices[i] ); -- PtDrvDevices[i] = NULL; -- } -- } -- } -- -- /* * if something went wrong, shutdown all... */ -- if( devCount == 0 ) { -- --#if !defined (CONFIG_DEVFS_FS) && defined (LINUX_26) --out_devfs: -- class_destroy(ptdrv_class); --#endif -- --#if (defined(CONFIG_DEVFS_FS) && !defined(DEVFS_26_STYLE)) -- devfs_unregister_chrdev( _PTDRV_MAJOR, _DRV_NAME ); --#else -- unregister_chrdev( _PTDRV_MAJOR, _DRV_NAME ); --#endif -- ProcFsShutdown(); -- --#ifdef __KERNEL__ -- _PRINT( KERN_INFO "pt_drv : no device(s) detected, (%i)\n", retval ); --#endif -- -- } else { -- -- DBG( DBG_HIGH, "pt_drv : init done, %u device(s) found\n", devCount ); -- retval = _OK; -- } -- DBG( DBG_HIGH, "---------------------------------------------\n" ); -- -- deviceScanning = _FALSE; -- return retval; --} -- --/*............................................................................. -- * cleanup the show -- */ --#ifdef LINUX_26 --static void __exit ptdrv_exit( void ) --#else --void cleanup_module( void ) --#endif --{ -- UInt i; -- pScanData ps; --#if (defined(CONFIG_DEVFS_FS) && !defined(DEVFS_26_STYLE)) -- char controlname[24]; -- devfs_handle_t master; --#endif -- -- DBG( DBG_HIGH, "pt_drv: cleanup_module()\n" ); -- -- for ( i = 0; i < _MAX_PTDEVS; i++ ) { -- -- ps = PtDrvDevices[i]; -- PtDrvDevices[i] = NULL; -- -- if ( NULL != ps ) { --#ifdef CONFIG_DEVFS_FS --# ifndef DEVFS_26_STYLE -- sprintf( controlname, "scanner/pt_drv%d", i ); -- master = devfs_find_handle( NULL,controlname, 0, 0, -- DEVFS_SPECIAL_CHR, 0 ); -- devfs_unregister( master ); --# else -- devfs_remove("scanner/pt_drv%d", i); --# endif --#else --# ifdef LINUX_26 -- CLASS_DEV_DESTROY(ptdrv_class, MKDEV(_PTDRV_MAJOR, i)); --# endif /* LINUX_26 */ --#endif /* CONFIG_DEVFS_FS */ -- ptdrvShutdown( ps ); -- ProcFsUnregisterDevice( ps ); -- } -- } -- --#if (defined(CONFIG_DEVFS_FS) && !defined(DEVFS_26_STYLE)) -- devfs_unregister_chrdev( _PTDRV_MAJOR, _DRV_NAME ); --#else -- unregister_chrdev( _PTDRV_MAJOR, _DRV_NAME ); --#endif -- ProcFsShutdown(); -- --#if !defined (CONFIG_DEVFS_FS) && defined (LINUX_26) -- class_destroy(ptdrv_class); --#endif -- -- DBG( DBG_HIGH, "pt_drv: cleanup done.\n" ); -- DBG( DBG_HIGH, "*********************************************\n" ); --} -- --#ifdef LINUX_26 --module_init(ptdrv_init); --module_exit(ptdrv_exit); --#endif -- --#endif /*MODULE*/ -- -- --/*............................................................................. -- * device open... -- */ --static int pt_drv_open(struct inode *inode, struct file *file) --{ -- pScanData ps; -- -- DBG( DBG_HIGH, "pt_drv_open()\n" ); -- -- ps = get_pt_from_inode(inode); -- -- if ( NULL == ps ) { -- return(-ENXIO); -- } -- -- /* device not found ? */ -- if (!(ps->flags & _PTDRV_INITALIZED)) { -- return(-ENXIO); -- } -- -- /* device is busy ? */ -- if (ps->flags & _PTDRV_OPEN) { -- return(-EBUSY); -- } -- --#ifdef LINUX_26 -- if (!try_module_get(THIS_MODULE)) -- return -EAGAIN; --#else -- MOD_INC_USE_COUNT; --#endif -- ps->flags |= _PTDRV_OPEN; -- -- return _OK; --} -- --/*............................................................................. -- * device close... -- */ --static CLOSETYPE pt_drv_close(struct inode * inode, struct file * file) --{ -- pScanData ps; -- -- DBG( DBG_HIGH, "pt_drv_close()\n" ); -- -- if ((ps = get_pt_from_inode(inode)) ) { -- -- ptdrvClose( ps ); -- -- ps->flags &= ~_PTDRV_OPEN; --#ifdef LINUX_26 -- module_put(THIS_MODULE); --#else -- MOD_DEC_USE_COUNT; --#endif -- CLOSERETURN(0); -- } else { -- -- DBG( DBG_HIGH, "pt_drv: - close failed!\n" ); -- CLOSERETURN(-ENXIO); -- } --} -- --/*............................................................................. -- * read data from device -- */ --#ifdef LINUX_20 --static int pt_drv_read(struct inode *inode, struct file *file, -- char *buffer, int count) --{ -- int result; -- pScanData ps; -- -- if ( !(ps = get_pt_from_inode(inode))) -- return(-ENXIO); --#else --static ssize_t pt_drv_read( struct file *file, -- char *buffer, size_t count, loff_t *tmp ) --{ -- int result; -- pScanData ps; -- -- if ( !(ps = get_pt_from_inode(file->f_dentry->d_inode)) ) -- return(-ENXIO); --#endif -- if ((result = verify_area_20(VERIFY_WRITE, buffer, count))) -- return result; -- -- /* -- * as the driver contains some global vars, it is not -- * possible to scan simultaenously with two or more devices -- */ -- if( _TRUE == deviceScanning ) { -- printk( KERN_INFO "pt_drv: device %u busy!!!\n", ps->devno ); -- return(-EBUSY); -- } -- -- deviceScanning = _TRUE; -- -- result = ptdrvRead( ps, buffer, count ); -- -- deviceScanning = _FALSE; -- return result; --} -- --/*............................................................................. -- * writing makes no sense -- */ --#ifdef LINUX_20 --static int pt_drv_write(struct inode * inode, struct file * file, -- const char * buffer, int count) --{ -- return -EPERM; --} --#else -- static ssize_t pt_drv_write( struct file * file,const char * buffer, -- size_t tmp,loff_t* count) --{ -- return -EPERM; --} --#endif -- --/*............................................................................. -- * the ioctl interface -- */ --#ifdef NOLOCK_IOCTL --static long pt_drv_ioctl( struct file *file, UInt cmd, unsigned long arg ) --{ -- pScanData ps; -- -- if ( !(ps = get_pt_from_inode(file->f_dentry->d_inode)) ) -- return(-ENXIO); -- -- return ptdrvIoctl( ps, cmd, (pVoid)arg); --} --#else --static int pt_drv_ioctl( struct inode *inode, struct file *file, -- UInt cmd, unsigned long arg ) --{ -- pScanData ps; -- -- if ( !(ps = get_pt_from_inode(inode)) ) -- return(-ENXIO); -- -- return ptdrvIoctl( ps, cmd, (pVoid)arg); --} --#endif -- --#else /* the user-mode interface */ -- - /*............................................................................. - * here we only have wrapper functions - */ -@@ -1980,6 +1279,4 @@ static int PtDrvRead ( pUChar buffer, in - return ptdrvRead( PtDrvDevices[0], buffer, count ); - } - --#endif /* guard __KERNEL__ */ -- - /* END PLUSTEK-PP_PTDRV.C ...................................................*/ -Index: trunk/backend/plustek-pp_scan.h -=================================================================== ---- trunk.orig/backend/plustek-pp_scan.h -+++ trunk/backend/plustek-pp_scan.h -@@ -63,8 +63,6 @@ - #ifndef __PLUSTEK_SCAN_H__ - #define __PLUSTEK_SCAN_H__ - --#ifndef __KERNEL__ -- - # include <stdlib.h> - # include <stdarg.h> - # include <string.h> -@@ -76,19 +74,6 @@ - # ifdef HAVE_SYS_IO_H - # include <sys/io.h> - # endif --#else --# include <linux/kernel.h> --# include <linux/init.h> --# include <linux/version.h> --# include "plustek-pp_sysdep.h" --# include <linux/delay.h> --# include <linux/parport.h> -- --#ifdef LINUX_24 --# include <linux/parport_pc.h> --#endif /* LINUX_24 */ -- --#endif /* __KERNEL__ */ - - /*............................................................................. - * driver properties -@@ -104,20 +89,6 @@ - # define _OPF ps->IO.fnOut - # define _IPF ps->IO.fnIn - --#ifdef __KERNEL__ -- --#define _OUTB_CTRL(pSD,port_value) _OPF(port_value,pSD->IO.pbControlPort) --#define _OUTB_DATA(pSD,port_value) _OPF(port_value,pSD->IO.pbSppDataPort) --#define _OUTB_ECTL(pSD,port_value) _OPF(port_value,(pSD->IO.portBase+0x402)) -- --#define _INB_CTRL(pSD) _IPF(pSD->IO.pbControlPort) --#define _INB_DATA(pSD) _IPF(pSD->IO.pbSppDataPort) --#define _INB_EPPDATA(pSD) _IPF(pSD->IO.pbEppDataPort) --#define _INB_STATUS(pSD) _IPF(pSD->IO.pbStatusPort) --#define _INB_ECTL(pSD) _IPF((pSD->IO.portBase+0x402)) -- --#else -- - #define _OUTB_CTRL(pSD,port_value) sanei_pp_outb_ctrl(pSD->pardev, port_value) - #define _OUTB_DATA(pSD,port_value) sanei_pp_outb_data(pSD->pardev, port_value) - #define _OUTB_ECTL(pSD,port_value) -@@ -127,32 +98,19 @@ - #define _INB_EPPDATA(pSD) sanei_pp_inb_epp(pSD->pardev) - #define _INB_STATUS(pSD) sanei_pp_inb_stat(pSD->pardev) - --#endif -- - /*............................................................................. - * for memory allocation - */ --#ifndef __KERNEL__ - # define _KALLOC(x,y) malloc(x) - # define _KFREE(x) free(x) - # define _VMALLOC(x) malloc(x) - # define _VFREE(x) free(x) --#else --# define _KALLOC(x,y) kmalloc(x,y) --# define _KFREE(x) kfree(x) --# define _VMALLOC(x) vmalloc(x) --# define _VFREE(x) vfree(x) --#endif - - /* - * WARNING - never use the _SECOND define with the _DODELAY macro !! - * they are for use the MiscStartTimer function and the _DO_UDELAY macro - */ --#ifndef __KERNEL__ - typedef double TimerDef, *pTimerDef; --#else --typedef long long TimerDef, *pTimerDef; --#endif - - #define _MSECOND 1000 /* based on 1 us */ - #define _SECOND (1000*_MSECOND) -@@ -160,13 +118,8 @@ typedef long long TimerDef, *pTimerDef; - /*............................................................................. - * timer topics - */ --#ifndef __KERNEL__ - # define _DO_UDELAY(usecs) sanei_pp_udelay(usecs) - # define _DODELAY(msecs) { int i; for( i = msecs; i--; ) _DO_UDELAY(1000); } --#else --# define _DO_UDELAY(usecs) udelay(usecs) --# define _DODELAY(msecs) mdelay(msecs) --#endif - - /*............................................................................. - * include the shared stuff right here, this concerns the ioctl interface -Index: trunk/backend/plustek-pp_scandata.h -=================================================================== ---- trunk.orig/backend/plustek-pp_scandata.h -+++ trunk/backend/plustek-pp_scandata.h -@@ -143,17 +143,7 @@ typedef struct { - */ - typedef struct scandata - { --#ifdef __KERNEL__ -- UInt flags; /* as follows: */ --#define _PTDRV_INITALIZED 0x00000001 --#define _PTDRV_OPEN 0x00000002 -- -- struct pardevice *pardev; /* for accessing parport... */ -- struct parport *pp; -- ProcDirDef procDir; --#else - int pardev; /* parport handle in user-space */ --#endif - - /* - * device control -Index: trunk/doc/Makefile.am -=================================================================== ---- trunk.orig/doc/Makefile.am -+++ trunk/doc/Makefile.am -@@ -124,8 +124,8 @@ BEDOCS += mustek/mustek.CHANGES - BEDOCS += mustek_usb/mustek_usb.CHANGES mustek_usb/mustek_usb.TODO - BEDOCS += mustek_usb2/mustek_usb2.CHANGES mustek_usb2/mustek_usb2.TODO - BEDOCS += niash/niash.TODO --BEDOCS += plustek/FAQ plustek/MakeModule.sh plustek/Makefile.kernel24 \ -- plustek/Makefile.kernel26 plustek/Plustek-PARPORT-TODO.txt \ -+BEDOCS += plustek/FAQ \ -+ plustek/Plustek-PARPORT-TODO.txt \ - plustek/Plustek-PARPORT.changes plustek/Plustek-PARPORT.txt \ - plustek/Plustek-USB-TODO.txt plustek/Plustek-USB.changes \ - plustek/Plustek-USB.txt -Index: trunk/doc/plustek/FAQ -=================================================================== ---- trunk.orig/doc/plustek/FAQ -+++ trunk/doc/plustek/FAQ -@@ -12,111 +12,10 @@ If you have some more FAQ entries, let m - THANKS to Jochen <jochen@puchalla-online.de>, who roamed through the - mailing-list and gathered the different questions. - -- - ******************************************************************************* --* TROUBLE-SHOOTING * --* * --* DRIVER TOPICS * -+* General * - ******************************************************************************* - -- --SYMPTOM: "kernel-module version mismatch" ---------- --"When I try to "make load" I get an error" -- --/sbin/modprobe pt_drv || exit 1 --/lib/modules/2.2.14-6.0.6/misc/pt_drv.o: kernel-module version mismatch --/lib/modules/2.2.14-6.0.1/misc/pt_drv.o was compiled --for kernel version 2.2.14-5.0 --while this kernel is version 2.2.14-6.0.1. -- --PROBLEM: ---------- --You're using the wrong Kernel-header files. -- --The path --/usr/include/linux is a link to --/usr/src/linux/include/linux and --/usr/src/linux is normally a link to your current --kernel, i.e: --/usr/src/linux-2.2.14 -- --If you now upgrade your kernel and you have --forgotten to correct the link /usr/src/linux, then --every kernel-module you build outside the --kernelsource structure will include the wrong --version information. -- --SOLUTION: ----------- --Set the link /usr/src/linux --to your current kernel-source tree before recompiling --kernel-modules like pt_drv, then your version mismatch --problem should be solved. -- -- -- --SYMPTOM: "Device or resource busy" ---------- --Any attempt to "modprobe" or "make load" the driver leads --to this message. -- --PROBLEM: ---------- --The driver refuses to load. During startup, the driver performs --some tests according to the parallel port and the connected --scanners. --If the parallel port is not supported or the scanner cannot be --found, the driver returns an error and the system will report --"device or resource busy" -- --SOLUTION: ----------- --There's no way to provide a general solution. First of all --you should check your connections and the parallel port. --Also check power for your scanner. --If the problem still exists, enable the debug-messages of the --pt_drv module (see INSTALL). --Then check the messages after loading or send the output to --the mailing list. --Most of these problems are related to HW-problems. Before --giving up, check the scanner under Windows (not really a --good advice I know, but it helps to find HW-damage). --There was also one case were the internal plugs of the parport --connection were wrong... -- -- -- --SYMPTOM: "Unresolved symbols" ---------- --"make load" or "modprobe pt_drv" produces this message: -- --/sbin/modprobe pt_drv || exit 1 --/lib/modules/2.2.14-5.0/misc/pt_drv.o: unresolved symbol parport_unregister_device --/lib/modules/2.2.14-5.0/misc/pt_drv.o: unresolved symbol parport_enumerate --/lib/modules/2.2.14-5.0/misc/pt_drv.o: unresolved symbol parport_register_device --/lib/modules/2.2.14-5.0/misc/pt_drv.o: unresolved symbol parport_claim --/lib/modules/2.2.14-5.0/misc/pt_drv.o: unresolved symbol parport_release --/lib/modules/2.2.14-5.0/misc/pt_drv.o: insmod --/lib/modules/2.2.14-5.0/misc/pt_drv.o failed -- -- --PROBLEM: ---------- --The driver needs at least the parport_pc and the parport modules --to work. They MUST be loaded prior to pt_drv. If these modules --are not loaded you get this message. -- --SOLUTION: ----------- --Simply load the parport module. You can add this dependency to --your /etc/modules.conf (or /etc/conf.modules) file (see INSTALL). --Then every time you load pt_drv with modprobe, parport will be loaded --automatically. After modifying this file, call --depmod -va -- -- -- - SYMPTOM: Scanner makes awful noise - -------- - -@@ -138,7 +37,6 @@ The second case is often reported when t - already loaded. So remove lp.o before loading pt_drv. - - -- - SYMPTOM: Printer starts to print while scanning - -------- - -@@ -294,23 +192,6 @@ A: You should be able to use xscanimage - now the Acquire Image menu entry. That's all. - If not, start gimp from an xterm and have a look at the output. - -- --Q: Is there any way to load the plustek_driver at bootup-time? -- --A: Normally, there is no need to do so, because once you -- altered your /etc/conf.modules file (or /etc/modules.conf) -- and added the suggested stuff (see INSTALL file), you won't -- have to worry about loading the driver. It happens automagically. ;-) -- The driver will be loaded when needed (and eventually -- removed after a specific time of not using it). -- -- Nevertheless, another possibility is to do a modprobe pt_drv in the -- /etc/rc.d/boot.local (using SuSE) or -- /etc/rc.d/rc.local (using RedHat or Mandrake) file -- So the driver will be loaded at bootup-time... -- !!! YOUR SCANNER MUST BE ONLINE during power-up then !!! -- -- - Q: I wonder if Mandrake 7.1's sane rpm file has this support already built in. - My scanner light is coming on yet Xscanimage seems to report that there - is no scanner present. -Index: trunk/doc/plustek/MakeModule.sh -=================================================================== ---- trunk.orig/doc/plustek/MakeModule.sh -+++ /dev/null -@@ -1,116 +0,0 @@ --#!/bin/bash --#****************************************************************************** --# --# Bash-Script to create Plustek-Scannerdriver modules for Kernel 2.4, 2.6 and 3.x --# out of the backend sources... --# -- --BUILD_DIR=$PWD/build --SRC_DIR=$PWD/../../backend --MAKEFILE=$PWD/Makefile.kernel26 --KERNEL_V=`uname -r` --OSMINOR=`uname -r | cut -b 3` --OSMAJOR=`uname -r | cut -b 1` -- --# --# some intro ;-) --# --echo "This script will try and build a suitable kernel-module for your system." --echo "If you'd like to make the module WITH debug output, restart this script" --echo "with as follows:" --echo "./MakeModule.sh DEBUG=y" --echo "Press <ENTER> to continue or <CTRL><C> to cancel." --read -- --# --# we need to be root user... --# --echo -n "Check for root..." --if [ $EUID -ne 0 ]; then -- echo -e "\b\b\b - failed" -- echo "Please retry as root user." -- exit -1 --fi --echo -e "\b\b\b - done." -- --# --# Version checks... --# --echo -e "\nCheck for kernelversion:" --if [ "$OSMAJOR" == "3" ];then -- echo "Using makefile for kernel 2.6.x - okay for kernel 3 as well..." -- MAKEFILE=$PWD/Makefile.kernel26 --elif [ "$OSMINOR" == "6" ]; then -- echo "Using makefile for kernel 2.6.x" -- MAKEFILE=$PWD/Makefile.kernel26 --elif [ "$OSMINOR" == "4" ]; then -- echo "Using makefile for kernel 2.4.x" -- MAKEFILE=$PWD/Makefile.kernel24 --else -- echo "Your kernelversion >"$OSMAJOR"."$OSMINOR"< is probably not supported" -- exit -2 --fi -- --# --# Setup... --# --echo -e "Build-directory: \n"$BUILD_DIR --echo -n "Removing build-directory..." --rm -rf $BUILD_DIR --echo -e "\b\b\b - done." -- --echo -n "Creating build-directory..." --mkdir $BUILD_DIR --cd $BUILD_DIR --echo -e "\b\b\b - done.\n" -- --echo -n "Linking source files..." --C_FILES=`ls $SRC_DIR/plustek-pp_*.c` --H_FILES=`ls $SRC_DIR/plustek-pp_*.h` -- --for F in $C_FILES $H_FILES $SRC_DIR/plustek-pp.h $SRC_DIR/plustek_pp.c; do -- ln -s $F . --done --echo -e "\b\b\b - done." -- --echo -n "Copying Makefile to build-directory..." --cp $MAKEFILE Makefile --echo -e "\b\b\b - done." -- --# --# Building the module... --# --echo "Making the module..." --if [ "$OSMAJOR" == "2" -a "$OSMINOR" == "4" ]; then -- make all $1 --else -- make -C /lib/modules/$KERNEL_V/build/ SUBDIRS=$BUILD_DIR modules $1 --fi --RES=$? --cd .. --if [ $RES != 0 ]; then -- echo "There were some build errors..." -- exit -1 --fi --echo "done." -- --echo "Should I install the module?" --echo "Press <ENTER> to continue or <CTRL><C> to cancel." --read -- --make -C $BUILD_DIR install -- --echo "Should I try and load the module?" --echo "If this step fails, check the kernel-log." --echo "Press <ENTER> to continue or <CTRL><C> to cancel." --read -- --make -C $BUILD_DIR load --echo "done." -- --echo "Should I remove the build directory?" --echo "Press <ENTER> to continue or <CTRL><C> to cancel." --read -- --rm -rf $BUILD_DIR --echo "done." -Index: trunk/doc/plustek/Makefile.kernel24 -=================================================================== ---- trunk.orig/doc/plustek/Makefile.kernel24 -+++ /dev/null -@@ -1,250 +0,0 @@ --# Makefile for the plustek scanner driver (kernel-module) --# --############################################################################### --# --# define the directories --# --HOME_DIR := . --SRC_DIR := $(HOME_DIR) --INC_DIR := $(SRC_DIR) --OBJ_DIR := $(HOME_DIR)/obj --DOC_DIR := $(HOME_DIR)/doc --BACKEND := $(SRC_DIR) -- --# --# define the used tools --# --MD = mkdir -p --CC = gcc --TAR = tar --REF = cxref -- --# --# Comment/uncomment the following line to disable/enable debugging --# can also be set by commandline parameter: make all DEBUG=y --# --#DEBUG = y -- --# --# common compiler options --# --OPT = -fomit-frame-pointer -D_PTDRV_VERSTR=\"$(VERSIONSTR)\" -- --# --# cxref options --# --REFOPT = -xref-all -index-all -html32 -- --# --# Comment out if you are not running SMP. Someone take this out of here --# when the SMP stuff gets moved out of the kernel Makefile. --# SMP = 1 --# SMP_PROF = 1 -- --# --# add the following to get assembly listing --# -Wa,-alh,-L -g -- --# --# get some version numbers --# --ifeq ($(LINUXVERSION),) -- LINUXVERSION = $(shell uname -r) --endif -- --VERSIONSTR = $(shell grep "define BACKEND_VERSION" $(SRC_DIR)/plustek_pp.c | cut -b25-50 ) -- --# Change it here or specify it on the "make" commandline --ifeq ($(HEADER_PATH),) --MACHTYPE = $(shell env | grep debian-linux | wc -l | sed 's/ //g') --ifeq ($(MACHTYPE),1) --# debian -- HEADER_PATH = /usr/src/kernel-headers-$(LINUXVERSION)/include --else --# redhat, slackware -- HEADER_PATH = /usr/src/linux/include --endif --# HEADER_PATH = /usr/include --endif -- --ifeq ($(DEBUG),y) -- DEBFLAGS = -O -g -DDEBUG # "-O" is needed to expand inlines --else -- DEBFLAGS = -O2 --endif -- --# --# the new style reference --# --K24_HEADER_PATH = /lib/modules/$(LINUXVERSION)/build/include -- --# --# try to autodetect if we can use the new style header include references --# --KERNEL_HEADERS = $(shell if test -d $(K24_HEADER_PATH); then \ -- echo $(K24_HEADER_PATH); \ -- else \ -- echo $(HEADER_PATH); \ -- fi; ) -- --# --# seems to be necessary for kernels 2.4.x --# --MODVERFILE = $(shell if [ -e $(KERNEL_HEADERS)/linux/modversions.h ]; then \ -- echo $(KERNEL_HEADERS)/linux/modversions.h ; \ -- else \ -- echo $(KERNEL_HEADERS)/linux/modsetver.h ; \ -- fi ) -- --MODFLAGS = -DMODULE -- --# --# set MODVERSIONS if the kernel uses it --# --VERSUSED = $(shell grep 'define CONFIG_MODVERSIONS' \ -- $(KERNEL_HEADERS)/linux/autoconf.h | wc -l | sed 's/ //g') --ifeq ($(VERSUSED),1) -- MODFLAGS += -DMODVERSIONS -include $(MODVERFILE) --endif -- -- --WARNFLAGS = -Wall -Wstrict-prototypes --CFLAGS = $(WARNFLAGS) $(OPT) -D__KERNEL__ -I$(KERNEL_HEADERS) -I$(INC_DIR) -I$(BACKEND) $(DEBFLAGS) $(MODFLAGS) --MODLIB = /lib/modules/$(LINUXVERSION) -- --ifdef SMP --CFLAGS += -D__SMP__ -- --ifdef SMP_PROF --CFLAGS += -D__SMP_PROF__ --endif --endif -- --TARGET = pt_drv -- --OBJ = $(TARGET).o --NAMES := dac detect genericio image map misc models io procfs --NAMES := $(NAMES) motor p9636 ptdrv scale tpa p48xx p12 p12ccd --NAMES := $(addprefix plustek-pp_, $(NAMES)) --SRCS := $(addprefix $(SRC_DIR)/, $(NAMES)) --SRCS := $(addsuffix .c, $(SRCS)) --OBJS := $(addprefix $(OBJ_DIR)/, $(NAMES)) --OBJS := $(addsuffix .o, $(OBJS)) --INCS := scan dbg types scandata procs hwdefs sysdep --INCS := $(addsuffix .h, $(INCS)) --HDRS = $(addprefix $(INC_DIR)/plustek-pp_, $(INCS)) -- --# --# the header files we need from the backend --# --BACKINCS := plustek-pp.h --BACKINCS := $(addprefix $(BACKEND)/, $(BACKINCS)) -- --group = "root" --mode = "644" --INST_DIR = /lib/modules/$(LINUXVERSION)/kernel/drivers/char -- --info: -- @clear -- @echo "Makefile to create the Plustek-Scanner kernel-module:" -- @echo "all ... builds the module" -- @echo "all DEBUG=y ... builds the module with debug-messages enabled" -- @echo "clean ... cleans up the show" -- @echo "install ... installs the module to the library path" -- @echo "uninstall ... removes the module from the library path" -- @echo "load ... tries to load the module and creates device nodes" -- @echo "unload ... unloads the module" -- -- --all: .depend chkdir $(OBJ) -- --# --# create object directory --# --.PHONY : chkdir --chkdir: -- @-$(MD) $(OBJ_DIR) -- @-$(MD) $(DOC_DIR) -- --$(OBJ): $(OBJS) -- $(LD) -r $^ -o $@ -- --$(OBJS): Makefile $(HDRS) $(BACKINCS) -- --$(OBJ_DIR)/%.o : $(SRC_DIR)/%.c -- $(CC) $(CFLAGS) -c $< -o $@ -- --$(OBJ_DIR)/$(OBJ): VERSION1 VERSION0 -- --# --# copy the driver to the modules directory --# --install: -- mkdir -p $(INST_DIR) -- install -c -m $(mode) $(OBJ) $(INST_DIR) -- /sbin/depmod -a -- --# --# remove it --# --uninstall: -- rm -f $(INST_DIR)/$(OBJ) -- --# --# use modprobe to load the driver, remember to set the --# parameter in /etc/modules.conf (see sane-plustek_pp.man for more details) --# --load: $(INST_DIR)/$(OBJ) --# invoke modprobe with all arguments we got -- /sbin/modprobe $(TARGET) || exit 1 -- --# Remove stale nodes and replace them, then give gid and perms -- rm -f /dev/$(TARGET)* -- --# when using the devfs support, we check the /dev/scanner entries --# and only create links to the devfs nodes --# at least we create one link -- @if [ -e /dev/scanner/$(TARGET)* ]; then \ -- ln -s /dev/scanner/$(TARGET)0 /dev/$(TARGET); \ -- for name in `ls /dev/scanner | grep $(TARGET)`; do \ -- ln -s /dev/scanner/$$name /dev/$$name ; \ -- done \ -- else \ -- mknod /dev/$(TARGET) c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 0; \ -- mknod /dev/$(TARGET)0 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 0; \ -- mknod /dev/$(TARGET)1 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 1; \ -- mknod /dev/$(TARGET)2 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 2; \ -- mknod /dev/$(TARGET)3 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 3; \ -- \ -- chgrp $(group) /dev/$(TARGET)*; \ -- chmod $(mode) /dev/$(TARGET)*; \ -- fi -- --# --# unload the driver --# --unload: -- /sbin/modprobe -r $(TARGET) || exit 1 -- --# Remove stale nodes -- rm -f /dev/$(TARGET)* -- --# --# create reference docu --# --doc: chkdir -- $(REF) $(REFOPT) $(INC_DIR)/*.h $(SRC_DIR)/*.c $(BACKEND)/plustek-share.h \ -- -D__KERNEL__ -I$(KERNEL_HEADERS) -I$(INC_DIR) -I$(BACKEND) $(MODFLAGS) \ -- -D_PTDRV_V1=$(VERSION1) -D_PTDRV_V0=$(VERSION0) -D_PTDRV_BUILD=$(BUILD) -O$(DOC_DIR) -- --clean: -- @-rm -f $(OBJ_DIR)/*.o .depend depend dep $(REF).* *.html $(TARGET).o -- @-rm -rf $(OBJ_DIR) -- @-rm -rf $(DOC_DIR) -- --depend .depend dep: -- $(CC) $(CFLAGS) -M $(SRCS) > $@ -- --ifeq (.depend,$(wildcard .depend)) --#include .depend --endif -Index: trunk/doc/plustek/Makefile.kernel26 -=================================================================== ---- trunk.orig/doc/plustek/Makefile.kernel26 -+++ /dev/null -@@ -1,124 +0,0 @@ --# Makefile for the plustek scanner driver (kernel-module) --# --############################################################################### -- --# --# retrieve the version numbers --# --ifeq ($(LINUXVERSION),) -- LINUXVERSION = $(shell uname -r) --endif --LINUXRELEASE = $(shell uname -r | cut -d'.' -f3) -- --ifeq ($(VERSIONSTR),) -- ifeq ($(SUBDIRS),) -- VERSIONSTR = $(shell grep "define BACKEND_VERSION" $(M)/plustek_pp.c | cut -b25-50 ) -- else -- VERSIONSTR = $(shell grep "define BACKEND_VERSION" $(SUBDIRS)/plustek_pp.c | cut -b25-50 ) -- endif --endif -- --# --# extra flags --# --EXTRA_CFLAGS += -D_PTDRV_VERSTR=\"$(VERSIONSTR)\" -- --ifeq ($(DEBUG),y) -- EXTRA_CFLAGS += -DDEBUG --endif -- --# --# the module name --# --TARGET := pt_drv --MODULE := $(TARGET).ko -- --# --# our files... --# --NAMES := dac detect genericio image map misc models io procfs --NAMES := $(NAMES) motor p9636 ptdrv scale tpa p48xx p12 p12ccd --NAMES := $(addprefix plustek-pp_, $(NAMES)) --OBJS := $(addsuffix .o, $(NAMES)) -- --# --# now the kernel magic --# --ifneq ($(KERNELRELEASE),) --obj-m := $(TARGET).o -- --$(TARGET)-objs := $(OBJS) -- --else --KDIR := /lib/modules/$(shell uname -r)/build --PWD := $(shell pwd) -- --default: -- $(MAKE) -C $(KDIR) M=$(PWD) modules --endif -- --# --# the installation stuff --# --group = "root" --mode = "644" --INST_DIR = /lib/modules/$(LINUXVERSION)/kernel/drivers/parport -- --# --# copy the driver to the modules directory --# --install: -- mkdir -p $(INST_DIR) -- install -c -m $(mode) $(MODULE) $(INST_DIR) -- /sbin/depmod -a -- --# --# --# --uninstall: -- rm -f $(INST_DIR)/$(MODULE) -- --# --# use modprobe to load the driver, remember to set the --# parameter in /etc/conf.modules (see INSTALL for more details) --# --load: $(INST_DIR)/$(MODULE) --# invoke modprobe with all arguments we got -- /sbin/modprobe $(TARGET) || exit 1 -- --# Remove stale nodes and replace them, then give gid and perms -- rm -f /dev/$(TARGET)* -- --# when using the devfs support, we check the /dev/scanner entries --# and only create links to the devfs nodes --# at least we create one link -- @if [ -e /dev/scanner/$(TARGET)* ]; then \ -- ln -s /dev/scanner/$(TARGET)0 /dev/$(TARGET); \ -- for name in `ls /dev/scanner | grep $(TARGET)`; do \ -- ln -s /dev/scanner/$$name /dev/$$name ; \ -- done \ -- else \ -- mknod /dev/$(TARGET) c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 0; \ -- mknod /dev/$(TARGET)0 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 0; \ -- mknod /dev/$(TARGET)1 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 1; \ -- mknod /dev/$(TARGET)2 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 2; \ -- mknod /dev/$(TARGET)3 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 3; \ -- \ -- chgrp $(group) /dev/$(TARGET)*; \ -- chmod $(mode) /dev/$(TARGET)*; \ -- fi -- --# --# unload the driver --# --unload: -- /sbin/modprobe -r $(TARGET) || exit 1 -- --# Remove stale nodes -- rm -f /dev/$(TARGET)* -- --# --# cleanup the show --# --clean: -- @-rm -f *.o .depend depend dep $(MODULE) $(TARGET).o $(TARGET).mod.c .*.cmd -Index: trunk/doc/plustek/Plustek-PARPORT.txt -=================================================================== ---- trunk.orig/doc/plustek/Plustek-PARPORT.txt -+++ trunk/doc/plustek/Plustek-PARPORT.txt -@@ -1,46 +1,10 @@ - Plustek-PARPRORT.txt (2004-03-28) Gerhard Jäger <gerhard@gjaeger.de> - ==================================================================== - -- - Beginning with SANE-1.0.13, there's a backend called plustek_pp. - This is for controlling Plustek parallel-port scanner and compatible - devices. For a full listing, see plustek_pp.desc. - --This code formerly was available for creating the Linux kernelmodule --pt_drv. This should no longer be necessary. You should be able to use -+This code formerly was available for creating the Linux kernel module -+pt_drv. This is no longer be necessary. You should be able to use - the backend out of the box. -- -- --The kernel module ------------------- -- --As it might be helpful to create and use the kernel-module, this way still --exists. It's possible to create this module out of the backend sources --in sane-backends/backend. Simply do (as root user) -- --./MakeModule.sh -- --Then the module should be compiled, installed and loaded. -- --Add the following three lines to file /etc/modules.conf -- --alias char-major-40 pt_drv --pre-install pt_drv modprobe -k parport --options pt_drv lampoff=180 warmup=15 port=0x378 lOffonEnd=0 mov=0 slowIO=1 -- --See man page for sane-plustek_pp ("man sane-plustek_pp") for explanation of --these options. -- --Now "scanimage -L" should show something like this: --device `plustek:/dev/pt_drv' is a Plustek 9630P flatbed scanner -- -- --Known Problems: ----------------- -- --Sometimes it is necessary to change the ioctl-interface between the --driver and the backend, in this case the version number of the communication --protocol will be changed and newer drivers won't work with older backends --and vice versa. --In this case (error -9019 in the SANE debug output!!) you have to recompile SANE --AND the driver (have a look at the installation procedure above). -Index: trunk/doc/plustek/Plustek-USB.txt -=================================================================== ---- trunk.orig/doc/plustek/Plustek-USB.txt -+++ trunk/doc/plustek/Plustek-USB.txt -@@ -4,10 +4,7 @@ Plustek-USB.txt (2005-08-08) Gerhard Jä - NOTE: - ----- - --ALL YOU NEED TO RUN YOUR USB SCANNER IS ALREADY INCLUDED. THERE'S --NO NEED TO INSTALL THE KERNEL MODULE pt_drv. THIS ONE IS ONLY NEEDED --FOR THE PLUSTEK PARALLELPORT SCANNER. -- -+ALL YOU NEED TO RUN YOUR USB SCANNER IS ALREADY INCLUDED. - - List of all currently implemented devices - ----------------------------------------- -Index: trunk/doc/sane-plustek_pp.man -=================================================================== ---- trunk.orig/doc/sane-plustek_pp.man -+++ trunk/doc/sane-plustek_pp.man -@@ -9,18 +9,10 @@ The - library implements a SANE (Scanner Access Now Easy) backend that - provides access to Plustek ASIC 9600[1/3] and P9800[1/3] based - parallel port flatbed scanners. --The access of the scanner is either done directly by the backend --or via kernel module, called pt_drv which can be created out of --the --.B sane\-plustek_pp --backend code \- see also section --.B "BUILDING THE KERNEL MODULE" --for further information. - - .SH "SUPPORTED DEVICES" - --At present, the following scanners should work with this backend --and/or the kernel module: -+At present, the following scanners should work with this backend: - .PP - .B "PLUSTEK SCANNERS" - .PP -@@ -112,18 +104,14 @@ BrightScan OpticPro OpticPro P12 - .ft R - - .SH "DEVICE NAMES" --This backend works in two modes, the so called "direct-mode" --and the "kernel-mode". In direct-mode, the user-space backend is --used, in kernel-mode, you should have a kernel-module named pt_drv --loaded. --This backends default device is: -+This backend's default device is: - .PP - .RS - .I 0x378 - .RE - .PP --This "default device" will be used, if no configuration --file can be found. It is rather the base address of the parallel port -+This "default device" will be used if no configuration -+file can be found. It is the base address of the parallel port - on i386 machines. - .PP - As the backend supports up to four devices, it is possible to -@@ -150,24 +138,13 @@ For a proper setup, you will need at lea - .I device 0x378 - .RE - .PP --or --.RS --.I [kernel] --.br --.I device /dev/pt_drv --.RE --.PP - .I direct - tells the backend, that the following devicename (here - .IR 0x378 ) - has to be interpreted as parallel port scanner device. In --fact it is the address to use, alternatively you can use -+fact it is the address to use. Alternatively you can use - .I /dev/parport0 - if the backend has been compiled with libieee1284 support. --.I kernel --should only be used, when a kernel-module has been built --out of the backend sources. See below for more instructions --about this. - .PP - Further options: - .PP -@@ -235,157 +212,6 @@ See the - file for examples. - .PP - --.SH "BUILDING THE KERNEL MODULE" --As mentioned before, the --.B sane\-plustek_pp --backend code can also be compiled and installed as linux kernel module. To do so, --you will need the source-files of this sane\-backend installation. --Unpack this tar-ball and go to the directory: --.IR sane\-backends/doc/plustek . --Within this directory, you should find a script called: --.IR MakeModule.sh . --Now if your Linux kernelsources are installed correctly, --it should be possible to build, install and load the --module --.BR pt_drv . --.B Please note, --that the kernelsources need to be configured correctly. --Refer to your distributions --manual on how this is done. As root user, try --.PP --.I ./MakeModule.sh --.PP --the script will try and get all necessary information about your --running kernel and will lead you through the whole installation --process. --.br --.B Note: Installing and loading the can only be done as --superuser. --.PP -- --.SH "KERNEL MODULE SETUP" --The configuration of the kernel module is done by providing --some or more options found below to the kernel module at --load time. This can be done by invoking --.BR insmod (8) --with the appropriate parameters or appending the options to the file --.I /etc/modules.conf (kernel < 2.6.x) --or --.I /etc/modprobe.conf (kernel >= 2.6.x) --.PP --.B --The Options: --.br --lampoff=lll --.RS --The value --.I lll --tells the driver, after how many seconds to --switch-off the lamp(s). The default value is 180. --0 will disable this feature. --.br --.B HINT: --Do not use a value that is too small, because often --switching on/off the lamps will reduce their lifetime. --.RE --.PP --port=ppp --.RS --.I ppp --specifies the port base address, where the scanner --is connected to. The default value is 0x378, which --is normally a standard. --.RE --.PP --warmup=www --.RS --.I www --specifies the time in seconds, how long a lamp has to be on, --until the driver will start to scan. The default value is 30. --.RE --.PP --lOffonEnd=e --.RS --.I e --specifies the behaviour when unloading the driver, 1 --> switch --lamps off, 0 --> do not change lamp status --.RE --.PP --slowIO=s --.RS --.I s --specifies which I/O functions the driver should use, 1 --> use --delayed functions, 0 --> use the non-delayed ones --.RE --.PP --forceMode=fm --.RS --.I fm --specifies port mode which should be used, 0 --> autodetection, --1 --> use SPP mode and 2 --> use EPP mode --.RE --.PP --mov=m --.RS --.TP --.IR m " = 0" --default: no override --.TP --.IR m " = 1" --OpticPro 9630PL override (works if OP9630 --has been detected) forces legal size (14") --.TP --.IR m " = 2" --Primax 4800Direct override (works if OP600 --has been detected) swaps red/green color --.TP --.IR m " = 3" --OpticPro 9636 override (works if OP9636 has --been detected) disables backends --transparency/negative capabilities --.TP --.IR m " = 4" --OpticPro 9636P override (works if OP9636 has --been detected) disables backends --transparency/negative capabilities --.TP --.IR m " = 5" --OpticPro A3I override (works if OP12000 has --been detected) enables A3 scanning --.TP --.IR m " = 6" --OpticPro 4800P override (works if OP600 --has been detected) swaps red/green color --.TP --.IR m " = 7" --Primax 4800Direct 30bit override (works if --OP4830 has been detected) --.RE --.PP --Sample entry for file --.IR /etc/modules.conf : --.PP --.RS --alias char\-major\-40 pt_drv --.br --pre-install pt_drv modprobe -k parport --.br --options pt_drv lampoff=180 warmup=15 port=0x378 lOffonEnd=0 mov=0 slowIO=0 forceMode=0 --.RE --.PP --For multidevice support, simply add values separated by commas to --the different options --.PP --.RS --options pt_drv port=0x378,0x278 mov=0,4 slowIO=0,1 forceMode=0,1 --.RE --.PP --Remember to call --.BR depmod (8) --after changing --.IR /etc/conf.modules . --.PP -- - .SH "PARALLEL PORT MODES" - .PP - The current driver works best, when the parallel port -@@ -423,13 +249,6 @@ The static library implementing this bac - .I @LIBDIR@/libsane\-plustek_pp.so - The shared library implementing this backend (present on systems that - support dynamic loading). --.TP --.I /lib/modules/<Kernel-Version>/kernel/drivers/parport/pt_drv.o --The Linux kernelmodule for kernels < 2.6.x. --.TP --.I /lib/modules/<Kernel-Version>/kernel/drivers/parport/pt_drv.ko --The Linux kernelmodule for kernels >= 2.6.x. --.PP - - .SH ENVIRONMENT - .TP diff --git a/debian/patches/0195-genesys_fix_total_file_size_exceeding.patch b/debian/patches/0195-genesys_fix_total_file_size_exceeding.patch deleted file mode 100644 index 4b95241..0000000 --- a/debian/patches/0195-genesys_fix_total_file_size_exceeding.patch +++ /dev/null @@ -1,100 +0,0 @@ -Description: Fix out off memory on high resultions -Origin: upstream, https://gitlab.com/sane-project/backends/-/merge_requests/697 -Bug: https://gitlab.com/sane-project/backends/-/issues/580 -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942176 -Forwarded: no -Last-Update: 2022-03-27 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/backend/genesys/gl124.cpp -=================================================================== ---- trunk.orig/backend/genesys/gl124.cpp -+++ trunk/backend/genesys/gl124.cpp -@@ -745,7 +745,7 @@ void CommandSetGl124::init_regs_for_scan - dev->session = session; - - dev->total_bytes_read = 0; -- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; -+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines; - - DBG(DBG_info, "%s: total bytes to send to frontend = %zu\n", __func__, - dev->total_bytes_to_read); -Index: trunk/backend/genesys/gl646.cpp -=================================================================== ---- trunk.orig/backend/genesys/gl646.cpp -+++ trunk/backend/genesys/gl646.cpp -@@ -817,7 +817,8 @@ void CommandSetGl646::init_regs_for_scan - dev->session = session; - - dev->total_bytes_read = 0; -- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; -+ dev->total_bytes_to_read = (size_t) session.output_line_bytes_requested -+ * (size_t) session.params.lines; - - /* select color filter based on settings */ - regs->find_reg(0x04).value &= ~REG_0x04_FILTER; -Index: trunk/backend/genesys/gl841.cpp -=================================================================== ---- trunk.orig/backend/genesys/gl841.cpp -+++ trunk/backend/genesys/gl841.cpp -@@ -920,7 +920,7 @@ dummy \ scanned lines - dev->session = session; - - dev->total_bytes_read = 0; -- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; -+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines; - if (session.use_host_side_gray) { - dev->total_bytes_to_read /= 3; - } -Index: trunk/backend/genesys/gl842.cpp -=================================================================== ---- trunk.orig/backend/genesys/gl842.cpp -+++ trunk/backend/genesys/gl842.cpp -@@ -568,7 +568,7 @@ void CommandSetGl842::init_regs_for_scan - dev->session = session; - - dev->total_bytes_read = 0; -- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; -+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines; - } - - ScanSession CommandSetGl842::calculate_scan_session(const Genesys_Device* dev, -Index: trunk/backend/genesys/gl843.cpp -=================================================================== ---- trunk.orig/backend/genesys/gl843.cpp -+++ trunk/backend/genesys/gl843.cpp -@@ -1041,7 +1041,7 @@ void CommandSetGl843::init_regs_for_scan - dev->session = session; - - dev->total_bytes_read = 0; -- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; -+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines; - - DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read); - } -Index: trunk/backend/genesys/gl846.cpp -=================================================================== ---- trunk.orig/backend/genesys/gl846.cpp -+++ trunk/backend/genesys/gl846.cpp -@@ -658,7 +658,7 @@ void CommandSetGl846::init_regs_for_scan - dev->session = session; - - dev->total_bytes_read = 0; -- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; -+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines; - - DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read); - } -Index: trunk/backend/genesys/gl847.cpp -=================================================================== ---- trunk.orig/backend/genesys/gl847.cpp -+++ trunk/backend/genesys/gl847.cpp -@@ -624,7 +624,7 @@ void CommandSetGl847::init_regs_for_scan - dev->session = session; - - dev->total_bytes_read = 0; -- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; -+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines; - - DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read); - } diff --git a/debian/patches/0600-scanimage_manpage.patch b/debian/patches/0600-scanimage_manpage.patch deleted file mode 100644 index 6e8cc23..0000000 --- a/debian/patches/0600-scanimage_manpage.patch +++ /dev/null @@ -1,21 +0,0 @@ -Description: Add remark to options. -Author: Jörg Frings-Fürst <debian@jff-webhosting.net> -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=418630 -Forwarded: not-needed -Last-Update: 2015-01-18 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/doc/scanimage.man -=================================================================== ---- trunk.orig/doc/scanimage.man -+++ trunk/doc/scanimage.man -@@ -75,6 +75,9 @@ To print all available options: - scanimage \-h - - .SH OPTIONS -+\fBRemark:\fR Parameter are defined by the backends. So are \-\-mode Gray and \-\-mode Grayscale in use. -+Please read the backend documentation first. -+ - Parameters are separated by a blank from single-character options (e.g. - .BR "\-d epson" ) - and by a "=" from multi-character options (e.g. diff --git a/debian/patches/series b/debian/patches/series index f829f7c..81eddad 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,25 +1,14 @@ -#0011-test.patch -#0195-genesys_fix_total_file_size_exceeding.patch -#0035-trim-libraries-in-sane-backends.pc.in.patch 0040-remove_git.patch 0100-source_spelling.patch 0125-multiarch_dll_search_path.patch 0175-fix_tests.patch 0140-avahi.patch 0145-avahi.patch -#0600-scanimage_manpage.patch 0705-kfreebsd.patch 0725-fix_link_60-libsane_rule.patch 0150-i386-test.patch 0155-hurd_PATH_MAX.patch -#0045-disable_lock_test_at_build_time.patch 0050-Use-python3-shebang.patch -#0055-Fix_build_error.patch 0060-cross.patch -#0165-respect_local_only_parameter.patch -#0170-return_empty_list_when_local_devices_requested.patch 0605-fix_groff-warnings.patch -#0180-gt68xx_fix_use-after-free_two_memleaks.patch -#0185-Change_output_from_sane-find-scanner.patch -#0190-remove-kernel-driver-for-plustek_pp.patch 0200-disable-check-equal-stderr.patch |