diff --git a/ChangeLog b/ChangeLog index 4f8356749..6c81d6464 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ +2005-04-10 Jochen Eisinger + + * backend/mustek_pp.c, backend/mustek_pp.conf, sanei/sanei_pa4s2.c, + include/sane/sanei_pa4s2.h, doc/sane-mustek_pp.man: added global + option "no_epp" to work around a known bug in the linux parport + code. + 2005-04-02 Julien Blache + * doc/sane.man: typo fix from A Costa. 2005-04-01 Gerhard Jaeger diff --git a/backend/mustek_pp.c b/backend/mustek_pp.c index 9cf54a429..a57294045 100644 --- a/backend/mustek_pp.c +++ b/backend/mustek_pp.c @@ -894,13 +894,6 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) char *optname, *optval = 0; Mustek_pp_config_option *tmpoptions; - if (!name) - { - DBG (1, "sane_init: parse error in line %d: unexpected " - " ``option''\n", line); - continue; - } - config_line_ptr += 6; config_line_ptr = sanei_config_skip_whitespace (config_line_ptr); if (!*config_line_ptr) @@ -942,6 +935,36 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) continue; } + if (!strcmp (optname, "no_epp")) + { + u_int pa4s2_options; + if (name) + DBG (2, "sane_init: global option found in local scope, " + "executing anyway\n"); + free (optname); + if (optval) + { + DBG (1, "sane_init: unexpected value for option no_epp\n"); + free (optval); + continue; + } + DBG (3, "sane_init: disabling mode EPP\n"); + sanei_pa4s2_options (&pa4s2_options, SANE_FALSE); + pa4s2_options |= SANEI_PA4S2_OPT_NO_EPP; + sanei_pa4s2_options (&pa4s2_options, SANE_TRUE); + continue; + } + else if (!name) + { + DBG (1, "sane_init: parse error in line %d: unexpected " + " ``option''\n", line); + free (optname); + if (optval) + free (optval); + continue; + } + + /* Extend the (global) array of options */ tmpoptions = realloc(cfgoptions, (numcfgoptions+1)*sizeof(cfgoptions[0])); diff --git a/backend/mustek_pp.conf b/backend/mustek_pp.conf index ac0ec0f2a..17f0e265e 100644 --- a/backend/mustek_pp.conf +++ b/backend/mustek_pp.conf @@ -1,7 +1,20 @@ # For documentation see sane-mustek_pp(5) +# Global options: +# =============== # +# option no_epp +# +# Disable parallel port mode EPP: works around a known bug in +# the Linux parport code. Enable this option, if the backend +# hangs when trying to access the parallel port in EPP mode: +# +# # SANE_DEBUG_SANEI_PA4S2=128 scanimage -L +# ... +# hangs here -> [sanei_pa4s2] sanei_pa4s2_readbyte: read in EPP mode +# # Scanner definition template: +# ============================ # # scanner # option ? diff --git a/doc/sane-mustek_pp.man b/doc/sane-mustek_pp.man index 43a822479..cbd800180 100644 --- a/doc/sane-mustek_pp.man +++ b/doc/sane-mustek_pp.man @@ -110,14 +110,19 @@ protocol is still unknown (eg., SE 12000 P). .PP Some scanners work faster when .B EPP/ECP -is enabled in the BIOS. +is enabled in the BIOS. EPP mode however may lead to hard-locks on some Linux +systems. If that is the case for you, you can either disable ECP/EPP in your +BIOS or disable it in the backend itself (see GLOBAL OPTIONS). .PP -Note that the backend needs to run as root. To allow user access to the scanner -run the backend through the network interface (See saned(8) and sane\-net(5)). Note also that the backend +Note that the backend needs to run as root or has to have appropriate access +rights to /dev/parport* if libieee1284 support is compiled in. To allow user +access to the scanner run the backend through the network interface (See +saned(8) and sane\-net(5)). Note also that the backend .I does not support .I parport sharing , -i.e. if you try printing while scanning, your computer may crash. This backend +i.e. if you try printing while scanning, your computer may crash. To enable +parport sharing, you have to enable libieee1284 at compile time. This backend also conflicts with the .I sane\-musteka4s2 backend. You can only enable one of them in your dll.conf. However, you have @@ -385,6 +390,29 @@ scanner "Mustek 600 III EPP" parport0 ccd300 option top 56 .RE +.SH GLOBAL OPTIONS +.PP +You can control the overall behaviour of the mustek_pp backend by global +options which preceed any scanner definition in the mustek_pp.conf file. +.br +Currently, there is only one global option: + +.TP +.B Global options +.RS 4 +.PP +.HP +.B no_epp +Disable parallel port mode EPP: works around a known bug in the Linux parport +code. Enable this option, if the backend hangs when trying to access the +parallel port in EPP mode. +.br +Default value: use EPP +.PP +Example: option no_epp +.PP +.RE + .SH FILES .TP .I @CONFIGDIR@/mustek_pp.conf diff --git a/include/sane/sanei_pa4s2.h b/include/sane/sanei_pa4s2.h index 105e73952..c5394a863 100644 --- a/include/sane/sanei_pa4s2.h +++ b/include/sane/sanei_pa4s2.h @@ -56,6 +56,7 @@ #define SANEI_PA4S2_OPT_DEFAULT 0 /* normal mode */ #define SANEI_PA4S2_OPT_TRY_MODE_UNI 1 /* enable UNI protocoll */ #define SANEI_PA4S2_OPT_ALT_LOCK 2 /* use alternative lock cmd */ +#define SANEI_PA4S2_OPT_NO_EPP 4 /* do not try to use EPP */ /* @} */ /** Get list of possibly available devices diff --git a/sanei/sanei_pa4s2.c b/sanei/sanei_pa4s2.c index 5a3d247cd..5f43883a6 100644 --- a/sanei/sanei_pa4s2.c +++ b/sanei/sanei_pa4s2.c @@ -1253,6 +1253,14 @@ sanei_pa4s2_open (const char *dev, int *fd) } + if ((port[*fd].mode == PA4S2_MODE_EPP) && + ((sanei_pa4s2_interface_options & SANEI_PA4S2_OPT_NO_EPP) == 1)) + { + DBG (3, "sanei_pa4s2_open: skipping mode EPP\n"); + break; + } + + DBG (5, "sanei_pa4s2_open: trying mode %u\n", port[*fd].mode); sanei_pa4s2_enable (*fd, SANE_TRUE); @@ -1867,7 +1875,7 @@ sanei_pa4s2_options (u_int * options, int set) if ((set != SANE_TRUE) && (set != SANE_FALSE)) DBG (2, "sanei_pa4s2_options: value of set is invalid\n"); - if ((set == SANE_TRUE) && (*options > 3)) + if ((set == SANE_TRUE) && (*options > 7)) DBG (2, "sanei_pa4s2_options: value of *options is invalid\n"); if (set == SANE_TRUE)