SCM

[#301017] canon: inconsistent default option values/capabilities

View Trackers | Bugs | Export CSV

Date:
2004-10-31 20:41
Priority:
3
State:
Closed
Submitted by:
Mattias Ellert (ellert-guest)
Assigned to:
Dr. Ulrich K. Deiters (ukd-guest)
Category:
backends (drivers)
Group:
Resolution:
None
Summary:
canon: inconsistent default option values/capabilities

Detailed description
The following bug report is a cut-and-paste summary of a resent e-mail exchange. I was asked to post it to the bug reporter so that it won't be lost. So here we go...

To me it looks like a bug in the canon backend.

This is what I think is happening:

When the backend is activated the OPT_NEGATIVE (Film type) and OPT_NEGATIVE_TYPE (Negative film type) options default start-up values are inconsistent. The default Film type is "Slides" and the default Negative film type is "Film type 0", and by default (and here is the inconsistency) both options are active. The Negative film type option should only be active when the Film Type option is set to "Negatives".

When at start-up of the interface, the saved settings are reapplied, it first sets the Film Type to "Slides". Since the film type already is set to "Slides" as a default start-up value this shouldn't change anything and the canon backend does not report to the frontend that the option descriptions should be reread. But setting the Film type to "Slides" make the Negative film type option inactive.

As the next step the interface applies the saved setting for the Negative film type. The interface checks whether this option is active and only tries to set it if it is, so even with the inconsistent start-up values this should not be a problem. However, you are now using the canon backend through the net backend and saned. The net backend keeps a cache of the option descriptors and only rereads them over the network when necessary. Since the canon backend (due to the inconsistent start-up values) have changed the invalid status of the Negative film type option without informing saned and the net backend, the net backend will use its cached option descriptors which still says the option is active. So when the interface tries to set this option it gets an invalid parameter error and bails out in an assert even though it has checked that the option (according to the cached option descriptor) is valid and settable.

Your problem will be solved by fixing the start-up values of the canon backend to make them internally consistent. Either by changing the start-up value of the Film type option to "Negatives" (and keeping the start-up state of the Negative film type option as valid) or by changing the start-up state of the Negative film type option to invalid (and keeping the start-up value of the film type option as "Slides"). To fix this requires the source code of the canon backend to be patched and the canon backend to be recompiled on your server machine.

There are two possible fixes, depending of what you want the start-up default values to be. One of the following two patches should fix the problem, but DO NOT apply both of them!!!!

Either change the default Film type to "Negatives":

--- sane-backends-2004-10-24-cvs/backend/canon.c.~1.13.~ Sun Oct 3 19:34:33 2004
+++ sane-backends-2004-10-24-cvs/backend/canon.c Mon Oct 25 22:15:39 2004
@@ -1183,7 +1183,7 @@
s->opt[OPT_NEGATIVE].constraint.string_list = filmtype_list;
s->opt[OPT_NEGATIVE].cap |=
(s->hw->info.is_filmscanner)? 0 : SANE_CAP_INACTIVE;
- s->val[OPT_NEGATIVE].s = strdup (filmtype_list[1]);
+ s->val[OPT_NEGATIVE].s = strdup (filmtype_list[0]);

/* Negative film type */
s->opt[OPT_NEGATIVE_TYPE].name = "negative-film-type";

or set the start-up capability of the Negative Film Type to invalid.

--- sane-backends-2004-10-24-cvs/backend/canon.c.~1.13.~ Sun Oct 3 19:34:33 2004
+++ sane-backends-2004-10-24-cvs/backend/canon.c Mon Oct 25 22:15:39 2004
@@ -1193,8 +1193,7 @@
s->opt[OPT_NEGATIVE_TYPE].size = max_string_size (negative_filmtype_list);
s->opt[OPT_NEGATIVE_TYPE].constraint_type = SANE_CONSTRAINT_STRING_LIST;
s->opt[OPT_NEGATIVE_TYPE].constraint.string_list = negative_filmtype_list;
- s->opt[OPT_NEGATIVE_TYPE].cap |=
- (s->hw->info.is_filmscanner) ? 0 : SANE_CAP_INACTIVE;
+ s->opt[OPT_NEGATIVE_TYPE].cap |= SANE_CAP_INACTIVE;
s->val[OPT_NEGATIVE_TYPE].s = strdup (negative_filmtype_list[0]);

/* Scanning speed */

Either of the two patches would make the start-up option values internally consistent. Which one you choose is up to what you want the default start-up value of the Film type option to be. DO NOT APPLY BOTH PATCHES!!!!

Followups: Sort comments antichronologically

Message
Date: 2004-11-03 07:28
Sender: Dr. Ulrich K. Deiters

Logged In: YES user_id=2930The bug will be fixed in the forthcoming release of the backend, which should be ready in a couple of days. Those who are in a hurry should contact me and ask for a preliminary version of the backend.

Attached Files:

Changes:

Field Old Value Date By
close_date2004-11-03 07:282004-11-03 07:28ukd-guest
status_idOpen2004-11-03 07:28ukd-guest
assigned_tonone2004-11-02 18:21hmg-guest
Powered By FusionForge