Re: v0.67, finally!

Oliver.Rauch@Wolfsburg.DE
Sun, 2 Nov 1997 10:31:25 +0100 (MET)

Hello David, hello UMAX-owners,

the umax-backend hangs in sane-0.67, but here is a patch
that corrects it!

There has changed something in the way the options between
xscanimage (and may be scanimage too) and the umax-backend
were handled and so we got into an endless loop.
At the end of the mail there is a fix for it!

just kill everything until ------------------, save the file
as umax-patch, move it to sane-0.67/backend and then do
cd sane-0.67/backend
patch umax.c <umax-patch

I also had problems to compile the umax-backend because
usleep and strdup were not found any more.
Simple trick at first: use old sane-0.66/backend/Makefile
if you have it!

Bye
Oliver
--------------------------

--- umax.c Sat Oct 25 04:44:47 1997
+++ /home/oli/scanner/sane-0.67/backend/umax.c Sun Nov 2 10:02:15 1997
@@ -1357,88 +1357,100 @@
scanner->val[option].w = *(SANE_Word *) val;
if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
if (scanner->val[option].w == SANE_FALSE) /* 8 bit mode */
- {
+ {
scanner->opt[OPT_GAMMA_VECTOR].constraint.range = &u8_range;
scanner->output_bytes = 1; /* 8 bits output */
- }
+ }
else /* 10 bit mode */
- {
+ {
scanner->opt[OPT_GAMMA_VECTOR].constraint.range = &u10_range;
scanner->output_bytes = 2; /* 10 bits output */
- }
+ }
return SANE_STATUS_GOOD;

case OPT_ANALOG_GAMMA_BIND:
- scanner->val[option].w = *(SANE_Word *) val;
- if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
- if (scanner->val[option].w == SANE_FALSE)
- {
- scanner->opt[OPT_ANALOG_GAMMA].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_ANALOG_GAMMA_R].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_ANALOG_GAMMA_G].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_ANALOG_GAMMA_B].cap &= ~SANE_CAP_INACTIVE;
- }
- else
- {
- scanner->opt[OPT_ANALOG_GAMMA].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_ANALOG_GAMMA_R].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_ANALOG_GAMMA_G].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_ANALOG_GAMMA_B].cap |= SANE_CAP_INACTIVE;
- }
+ if (scanner->val[option].w != *(SANE_Word *) val)
+ {
+ scanner->val[option].w = *(SANE_Word *) val;
+ if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
+ if (scanner->val[option].w == SANE_FALSE)
+ {
+ scanner->opt[OPT_ANALOG_GAMMA].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_ANALOG_GAMMA_R].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_ANALOG_GAMMA_G].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_ANALOG_GAMMA_B].cap &= ~SANE_CAP_INACTIVE;
+ }
+ else
+ {
+ scanner->opt[OPT_ANALOG_GAMMA].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_ANALOG_GAMMA_R].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_ANALOG_GAMMA_G].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_ANALOG_GAMMA_B].cap |= SANE_CAP_INACTIVE;
+ }
+ }
return SANE_STATUS_GOOD;

case OPT_HIGHLIGHT_BIND:
- scanner->val[option].w = *(SANE_Word *) val;
- if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
- if (scanner->val[option].w == SANE_FALSE)
- {
- scanner->opt[OPT_HIGHLIGHT].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_HIGHLIGHT_R].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_HIGHLIGHT_G].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_HIGHLIGHT_B].cap &= ~SANE_CAP_INACTIVE;
- }
- else
- {
- scanner->opt[OPT_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_HIGHLIGHT_R].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_HIGHLIGHT_G].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_HIGHLIGHT_B].cap |= SANE_CAP_INACTIVE;
- }
+ if (scanner->val[option].w != *(SANE_Word *) val)
+ {
+ scanner->val[option].w = *(SANE_Word *) val;
+ if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
+ if (scanner->val[option].w == SANE_FALSE)
+ {
+ scanner->opt[OPT_HIGHLIGHT].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_HIGHLIGHT_R].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_HIGHLIGHT_G].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_HIGHLIGHT_B].cap &= ~SANE_CAP_INACTIVE;
+ }
+ else
+ {
+ scanner->opt[OPT_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_HIGHLIGHT_R].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_HIGHLIGHT_G].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_HIGHLIGHT_B].cap |= SANE_CAP_INACTIVE;
+ }
+ }
return SANE_STATUS_GOOD;

case OPT_SHADOW_BIND:
- scanner->val[option].w = *(SANE_Word *) val;
- if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
- if (scanner->val[option].w == SANE_FALSE)
- {
- scanner->opt[OPT_SHADOW].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_SHADOW_R].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_SHADOW_G].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_SHADOW_B].cap &= ~SANE_CAP_INACTIVE;
- }
- else
+ if (scanner->val[option].w != *(SANE_Word *) val)
{
- scanner->opt[OPT_SHADOW].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_SHADOW_R].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_SHADOW_G].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_SHADOW_B].cap |= SANE_CAP_INACTIVE;
- }
+ scanner->val[option].w = *(SANE_Word *) val;
+ if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
+ if (scanner->val[option].w == SANE_FALSE)
+ {
+ scanner->opt[OPT_SHADOW].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_SHADOW_R].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_SHADOW_G].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_SHADOW_B].cap &= ~SANE_CAP_INACTIVE;
+ }
+ else
+ {
+ scanner->opt[OPT_SHADOW].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_SHADOW_R].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_SHADOW_G].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_SHADOW_B].cap |= SANE_CAP_INACTIVE;
+ }
+ }
return SANE_STATUS_GOOD;

case OPT_RESOLUTION_BIND:
- scanner->val[option].w = *(SANE_Word *) val;
+ if (scanner->val[option].w != *(SANE_Word *) val)
+ {
+ scanner->val[option].w = *(SANE_Word *) val;

- if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
- if (scanner->val[option].w == SANE_FALSE)
- { /* don't bind */
- scanner->opt[OPT_Y_RESOLUTION].cap &= ~SANE_CAP_INACTIVE;
- scanner->opt[OPT_X_RESOLUTION].title = "X-Resolution";
- }
- else
- { /* bind */
- scanner->opt[OPT_Y_RESOLUTION].cap |= SANE_CAP_INACTIVE;
- scanner->opt[OPT_X_RESOLUTION].title = SANE_TITLE_SCAN_RESOLUTION;
- }
+ if (info) { *info |= SANE_INFO_RELOAD_OPTIONS; }
+ if (scanner->val[option].w == SANE_FALSE)
+ { /* don't bind */
+ scanner->opt[OPT_Y_RESOLUTION].cap &= ~SANE_CAP_INACTIVE;
+ scanner->opt[OPT_X_RESOLUTION].title = "X-Resolution";
+ }
+ else
+ { /* bind */
+ scanner->opt[OPT_Y_RESOLUTION].cap |= SANE_CAP_INACTIVE;
+ scanner->opt[OPT_X_RESOLUTION].title = SANE_TITLE_SCAN_RESOLUTION;
+ }
+ }
return SANE_STATUS_GOOD;

/* side-effect-free word-array options: */

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com